All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.epos.eposdatamodel.Operation Maven / Gradle / Ivy

There is a newer version: 2.5.21
Show newest version
package org.epos.eposdatamodel;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * A description of a web service operation.
 */
public class Operation extends EPOSDataModelEntity {

    /**
     * The HTTP method.
     **/
    private String method;

    /**
     * This property is used to specify the output format of the Operation. The possible values are listed here: https://www.iana.org/assignments/media-types/media-types.xhtml
     **/
    private List returns;

    /**
     * The syntax of the template literal is specified by the [RFC6570] URI Template syntax.
     **/
    private String template;

    /**
     * A variable-to-property mapping of the IRI template.
     **/
    private List mapping;

    /**
     * Reverse reference to the related webservice.
     */
    private List webservice;


    public void addMapping(LinkedEntity mapping) {
        if (this.mapping == null) {
            ArrayList tmpList = new ArrayList<>();
            tmpList.add(mapping);
            this.setMapping(tmpList);
        } else {
            this.getMapping().add(mapping);
        }
    }

    public void addReturns(String returns) {
        if (this.getReturns() == null) {
            ArrayList returnsList = new ArrayList<>();
            returnsList.add(returns);
            this.setReturns(returnsList);
        } else {
            this.getReturns().add(returns);
        }
    }


    public Operation method(String method) {
        this.method = method;
        return this;
    }

    /**
     * The HTTP method.
     *
     * @return method
     **/

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Operation returns(List returns) {
        this.returns = returns;
        return this;
    }

    public Operation addReturnsItem(String returnsItem) {
        if (this.returns == null) {
            this.returns = new ArrayList<>();
        }
        this.returns.add(returnsItem);
        return this;
    }

    /**
     * This property is used to specify the output format of the Operation. The possible values are listed here: https://www.iana.org/assignments/media-types/media-types.xhtml
     *
     * @return returns
     **/

    public List getReturns() {
        return returns;
    }

    public void setReturns(List returns) {
        this.returns = returns;
    }

    public Operation template(String template) {
        this.template = template;
        return this;
    }

    /**
     * The syntax of the template literal is specified by the [RFC6570] URI Template syntax.
     *
     * @return template
     **/

    public String getTemplate() {
        return template;
    }

    public void setTemplate(String template) {
        this.template = template;
    }

    public Operation mapping(List mapping) {
        this.mapping = mapping;
        return this;
    }

    public Operation addMappingItem(LinkedEntity mapping) {
        if (this.mapping == null) {
            this.mapping = new ArrayList<>();
        }
        this.mapping.add(mapping);
        return this;
    }


    /**
     * A variable-to-property mapping of the IRI template.
     *
     * @return spatialExtent
     **/
    public List getMapping() {
        return mapping;
    }

    public void setMapping(List mapping) {
        this.mapping = mapping;
    }


    public List getWebservice() {
        return webservice;
    }

    public Operation setWebservice(List webservice) {
        this.webservice = webservice;
        return this;
    }

    public Operation addWebservice(LinkedEntity webservice) {
        if (this.webservice == null) {
            this.webservice = new ArrayList<>();
        }
        this.webservice.add(webservice);
        return this;
    }

    @Override
    public String toString() {
        return "Operation{" +
                "method='" + method + '\'' +
                ", returns=" + returns +
                ", template='" + template + '\'' +
                ", mapping=" + mapping +
                ", webservice=" + webservice +
                "} " + super.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Operation operation = (Operation) o;
        return Objects.equals(getMethod(), operation.getMethod()) && Objects.equals(getReturns(), operation.getReturns()) && Objects.equals(getTemplate(), operation.getTemplate()) && Objects.equals(getMapping(), operation.getMapping()) && Objects.equals(getWebservice(), operation.getWebservice());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), getMethod(), getReturns(), getTemplate(), getMapping(), getWebservice());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy