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

odata.msgraph.client.identitygovernance.entity.WorkflowVersion Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package odata.msgraph.client.identitygovernance.entity;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.github.davidmoten.odata.client.ClientException;
import com.github.davidmoten.odata.client.NameValue;
import com.github.davidmoten.odata.client.ODataEntityType;
import com.github.davidmoten.odata.client.RequestOptions;
import com.github.davidmoten.odata.client.UnmappedFields;
import com.github.davidmoten.odata.client.Util;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.UnmappedFieldsImpl;

import java.lang.Boolean;
import java.lang.Integer;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import odata.msgraph.client.identitygovernance.complex.WorkflowExecutionConditions;
import odata.msgraph.client.identitygovernance.enums.LifecycleWorkflowCategory;

@JsonPropertyOrder({
    "@odata.type", 
    "versionNumber"})
@JsonInclude(Include.NON_NULL)
public class WorkflowVersion extends WorkflowBase implements ODataEntityType {

    @Override
    public String odataTypeName() {
        return "microsoft.graph.identityGovernance.workflowVersion";
    }

    @JsonProperty("versionNumber")
    protected Integer versionNumber;

    protected WorkflowVersion() {
        super();
    }

    /**
     * Returns a builder which is used to create a new
     * instance of this class (given that this class is immutable).
     *
     * @return a new Builder for this class
     */
    // Suffix used on builder factory method to differentiate the method
    // from static builder methods on superclasses
    public static Builder builderWorkflowVersion() {
        return new Builder();
    }

    public static final class Builder {
        private LifecycleWorkflowCategory category;
        private OffsetDateTime createdDateTime;
        private String description;
        private String displayName;
        private WorkflowExecutionConditions executionConditions;
        private Boolean isEnabled;
        private Boolean isSchedulingEnabled;
        private OffsetDateTime lastModifiedDateTime;
        private List tasks;
        private Integer versionNumber;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

        public Builder category(LifecycleWorkflowCategory category) {
            this.category = category;
            this.changedFields = changedFields.add("category");
            return this;
        }

        public Builder createdDateTime(OffsetDateTime createdDateTime) {
            this.createdDateTime = createdDateTime;
            this.changedFields = changedFields.add("createdDateTime");
            return this;
        }

        public Builder description(String description) {
            this.description = description;
            this.changedFields = changedFields.add("description");
            return this;
        }

        public Builder displayName(String displayName) {
            this.displayName = displayName;
            this.changedFields = changedFields.add("displayName");
            return this;
        }

        public Builder executionConditions(WorkflowExecutionConditions executionConditions) {
            this.executionConditions = executionConditions;
            this.changedFields = changedFields.add("executionConditions");
            return this;
        }

        public Builder isEnabled(Boolean isEnabled) {
            this.isEnabled = isEnabled;
            this.changedFields = changedFields.add("isEnabled");
            return this;
        }

        public Builder isSchedulingEnabled(Boolean isSchedulingEnabled) {
            this.isSchedulingEnabled = isSchedulingEnabled;
            this.changedFields = changedFields.add("isSchedulingEnabled");
            return this;
        }

        public Builder lastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
            this.lastModifiedDateTime = lastModifiedDateTime;
            this.changedFields = changedFields.add("lastModifiedDateTime");
            return this;
        }

        public Builder tasks(List tasks) {
            this.tasks = tasks;
            this.changedFields = changedFields.add("tasks");
            return this;
        }

        public Builder tasks(Task... tasks) {
            return tasks(Arrays.asList(tasks));
        }

        public Builder versionNumber(Integer versionNumber) {
            this.versionNumber = versionNumber;
            this.changedFields = changedFields.add("versionNumber");
            return this;
        }

        public WorkflowVersion build() {
            WorkflowVersion _x = new WorkflowVersion();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.identityGovernance.workflowVersion";
            _x.category = category;
            _x.createdDateTime = createdDateTime;
            _x.description = description;
            _x.displayName = displayName;
            _x.executionConditions = executionConditions;
            _x.isEnabled = isEnabled;
            _x.isSchedulingEnabled = isSchedulingEnabled;
            _x.lastModifiedDateTime = lastModifiedDateTime;
            _x.tasks = tasks;
            _x.versionNumber = versionNumber;
            return _x;
        }
    }

    @Override
    @JsonIgnore
    public ChangedFields getChangedFields() {
        return changedFields;
    }

    @Override
    public void postInject(boolean addKeysToContextPath) {
        if (addKeysToContextPath && versionNumber != null) {
            contextPath = contextPath.clearQueries().addKeys(new NameValue(versionNumber, Integer.class));
        }
    }

    @Property(name="versionNumber")
    @JsonIgnore
    public Optional getVersionNumber() {
        return Optional.ofNullable(versionNumber);
    }

    public WorkflowVersion withVersionNumber(Integer versionNumber) {
        WorkflowVersion _x = _copy();
        _x.changedFields = changedFields.add("versionNumber");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.identityGovernance.workflowVersion");
        _x.versionNumber = versionNumber;
        return _x;
    }

    public WorkflowVersion withUnmappedField(String name, Object value) {
        WorkflowVersion _x = _copy();
        _x.setUnmappedField(name, value);
        return _x;
    }

    @JsonAnySetter
    private void setUnmappedField(String name, Object value) {
        if (unmappedFields == null) {
            unmappedFields = new UnmappedFieldsImpl();
        }
        unmappedFields.put(name, value);
    }

    @JsonAnyGetter
    private UnmappedFieldsImpl unmappedFields() {
        return unmappedFields == null ? UnmappedFieldsImpl.EMPTY : unmappedFields;
    }

    @Override
    public UnmappedFields getUnmappedFields() {
        return unmappedFields();
    }

    /**
     * Submits only changed fields for update and returns an 
     * immutable copy of {@code this} with changed fields reset.
     *
     * @return a copy of {@code this} with changed fields reset
     * @throws ClientException if HTTP response is not as expected
     */
    public WorkflowVersion patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
        WorkflowVersion _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    /**
     * Submits all fields for update and returns an immutable copy of {@code this}
     * with changed fields reset (they were ignored anyway).
     *
     * @return a copy of {@code this} with changed fields reset
     * @throws ClientException if HTTP response is not as expected
     */
    public WorkflowVersion put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
        WorkflowVersion _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    private WorkflowVersion _copy() {
        WorkflowVersion _x = new WorkflowVersion();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.category = category;
        _x.createdDateTime = createdDateTime;
        _x.description = description;
        _x.displayName = displayName;
        _x.executionConditions = executionConditions;
        _x.isEnabled = isEnabled;
        _x.isSchedulingEnabled = isSchedulingEnabled;
        _x.lastModifiedDateTime = lastModifiedDateTime;
        _x.tasks = tasks;
        _x.versionNumber = versionNumber;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("WorkflowVersion[");
        b.append("category=");
        b.append(this.category);
        b.append(", ");
        b.append("createdDateTime=");
        b.append(this.createdDateTime);
        b.append(", ");
        b.append("description=");
        b.append(this.description);
        b.append(", ");
        b.append("displayName=");
        b.append(this.displayName);
        b.append(", ");
        b.append("executionConditions=");
        b.append(this.executionConditions);
        b.append(", ");
        b.append("isEnabled=");
        b.append(this.isEnabled);
        b.append(", ");
        b.append("isSchedulingEnabled=");
        b.append(this.isSchedulingEnabled);
        b.append(", ");
        b.append("lastModifiedDateTime=");
        b.append(this.lastModifiedDateTime);
        b.append(", ");
        b.append("tasks=");
        b.append(this.tasks);
        b.append(", ");
        b.append("versionNumber=");
        b.append(this.versionNumber);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy