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

odata.msgraph.client.entity.AccessPackageAssignmentRequest Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package odata.msgraph.client.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.ActionRequestNoReturn;
import com.github.davidmoten.odata.client.ClientException;
import com.github.davidmoten.odata.client.CollectionPage;
import com.github.davidmoten.odata.client.HttpRequestOptions;
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.Action;
import com.github.davidmoten.odata.client.annotation.NavigationProperty;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.Checks;
import com.github.davidmoten.odata.client.internal.ParameterMap;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.TypedObject;
import com.github.davidmoten.odata.client.internal.UnmappedFieldsImpl;

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.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import odata.msgraph.client.complex.AccessPackageAnswer;
import odata.msgraph.client.complex.CustomExtensionCalloutInstance;
import odata.msgraph.client.complex.CustomExtensionData;
import odata.msgraph.client.complex.EntitlementManagementSchedule;
import odata.msgraph.client.entity.request.AccessPackageRequest;
import odata.msgraph.client.entity.request.AccessPackageSubjectRequest;
import odata.msgraph.client.enums.AccessPackageRequestState;
import odata.msgraph.client.enums.AccessPackageRequestType;

@JsonPropertyOrder({
    "@odata.type", 
    "answers", 
    "completedDateTime", 
    "createdDateTime", 
    "customExtensionCalloutInstances", 
    "requestType", 
    "schedule", 
    "state", 
    "status"})
@JsonInclude(Include.NON_NULL)
public class AccessPackageAssignmentRequest extends Entity implements ODataEntityType {

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

    @JsonProperty("answers")
    protected List answers;

    @JsonProperty("answers@nextLink")
    protected String answersNextLink;

    @JsonProperty("completedDateTime")
    protected OffsetDateTime completedDateTime;

    @JsonProperty("createdDateTime")
    protected OffsetDateTime createdDateTime;

    @JsonProperty("customExtensionCalloutInstances")
    protected List customExtensionCalloutInstances;

    @JsonProperty("customExtensionCalloutInstances@nextLink")
    protected String customExtensionCalloutInstancesNextLink;

    @JsonProperty("requestType")
    protected AccessPackageRequestType requestType;

    @JsonProperty("schedule")
    protected EntitlementManagementSchedule schedule;

    @JsonProperty("state")
    protected AccessPackageRequestState state;

    @JsonProperty("status")
    protected String status;

    protected AccessPackageAssignmentRequest() {
        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 builderAccessPackageAssignmentRequest() {
        return new Builder();
    }

    public static final class Builder {
        private String id;
        private List answers;
        private String answersNextLink;
        private OffsetDateTime completedDateTime;
        private OffsetDateTime createdDateTime;
        private List customExtensionCalloutInstances;
        private String customExtensionCalloutInstancesNextLink;
        private AccessPackageRequestType requestType;
        private EntitlementManagementSchedule schedule;
        private AccessPackageRequestState state;
        private String status;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

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

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

        public Builder answers(AccessPackageAnswer... answers) {
            return answers(Arrays.asList(answers));
        }

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

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

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

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

        public Builder customExtensionCalloutInstances(CustomExtensionCalloutInstance... customExtensionCalloutInstances) {
            return customExtensionCalloutInstances(Arrays.asList(customExtensionCalloutInstances));
        }

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

        public Builder requestType(AccessPackageRequestType requestType) {
            this.requestType = requestType;
            this.changedFields = changedFields.add("requestType");
            return this;
        }

        public Builder schedule(EntitlementManagementSchedule schedule) {
            this.schedule = schedule;
            this.changedFields = changedFields.add("schedule");
            return this;
        }

        public Builder state(AccessPackageRequestState state) {
            this.state = state;
            this.changedFields = changedFields.add("state");
            return this;
        }

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

        public AccessPackageAssignmentRequest build() {
            AccessPackageAssignmentRequest _x = new AccessPackageAssignmentRequest();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.accessPackageAssignmentRequest";
            _x.id = id;
            _x.answers = answers;
            _x.answersNextLink = answersNextLink;
            _x.completedDateTime = completedDateTime;
            _x.createdDateTime = createdDateTime;
            _x.customExtensionCalloutInstances = customExtensionCalloutInstances;
            _x.customExtensionCalloutInstancesNextLink = customExtensionCalloutInstancesNextLink;
            _x.requestType = requestType;
            _x.schedule = schedule;
            _x.state = state;
            _x.status = status;
            return _x;
        }
    }

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

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

    @Property(name="answers")
    @JsonIgnore
    public CollectionPage getAnswers() {
        return new CollectionPage(contextPath, AccessPackageAnswer.class, this.answers, Optional.ofNullable(answersNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
    }

    public AccessPackageAssignmentRequest withAnswers(List answers) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("answers");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.answers = answers;
        return _x;
    }

    @Property(name="answers")
    @JsonIgnore
    public CollectionPage getAnswers(HttpRequestOptions options) {
        return new CollectionPage(contextPath, AccessPackageAnswer.class, this.answers, Optional.ofNullable(answersNextLink), Collections.emptyList(), options);
    }

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

    public AccessPackageAssignmentRequest withCompletedDateTime(OffsetDateTime completedDateTime) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("completedDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.completedDateTime = completedDateTime;
        return _x;
    }

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

    public AccessPackageAssignmentRequest withCreatedDateTime(OffsetDateTime createdDateTime) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("createdDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.createdDateTime = createdDateTime;
        return _x;
    }

    @Property(name="customExtensionCalloutInstances")
    @JsonIgnore
    public CollectionPage getCustomExtensionCalloutInstances() {
        return new CollectionPage(contextPath, CustomExtensionCalloutInstance.class, this.customExtensionCalloutInstances, Optional.ofNullable(customExtensionCalloutInstancesNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
    }

    public AccessPackageAssignmentRequest withCustomExtensionCalloutInstances(List customExtensionCalloutInstances) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("customExtensionCalloutInstances");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.customExtensionCalloutInstances = customExtensionCalloutInstances;
        return _x;
    }

    @Property(name="customExtensionCalloutInstances")
    @JsonIgnore
    public CollectionPage getCustomExtensionCalloutInstances(HttpRequestOptions options) {
        return new CollectionPage(contextPath, CustomExtensionCalloutInstance.class, this.customExtensionCalloutInstances, Optional.ofNullable(customExtensionCalloutInstancesNextLink), Collections.emptyList(), options);
    }

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

    public AccessPackageAssignmentRequest withRequestType(AccessPackageRequestType requestType) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("requestType");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.requestType = requestType;
        return _x;
    }

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

    public AccessPackageAssignmentRequest withSchedule(EntitlementManagementSchedule schedule) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("schedule");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.schedule = schedule;
        return _x;
    }

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

    public AccessPackageAssignmentRequest withState(AccessPackageRequestState state) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("state");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.state = state;
        return _x;
    }

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

    public AccessPackageAssignmentRequest withStatus(String status) {
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = changedFields.add("status");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentRequest");
        _x.status = status;
        return _x;
    }

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

    @NavigationProperty(name="accessPackage")
    @JsonIgnore
    public AccessPackageRequest getAccessPackage() {
        return new AccessPackageRequest(contextPath.addSegment("accessPackage"), RequestHelper.getValue(unmappedFields, "accessPackage"));
    }

    @NavigationProperty(name="assignment")
    @JsonIgnore
    public odata.msgraph.client.entity.request.AccessPackageAssignmentRequest getAssignment() {
        return new odata.msgraph.client.entity.request.AccessPackageAssignmentRequest(contextPath.addSegment("assignment"), RequestHelper.getValue(unmappedFields, "assignment"));
    }

    @NavigationProperty(name="requestor")
    @JsonIgnore
    public AccessPackageSubjectRequest getRequestor() {
        return new AccessPackageSubjectRequest(contextPath.addSegment("requestor"), RequestHelper.getValue(unmappedFields, "requestor"));
    }

    @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 AccessPackageAssignmentRequest patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
        AccessPackageAssignmentRequest _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 AccessPackageAssignmentRequest put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
        AccessPackageAssignmentRequest _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    private AccessPackageAssignmentRequest _copy() {
        AccessPackageAssignmentRequest _x = new AccessPackageAssignmentRequest();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.answers = answers;
        _x.completedDateTime = completedDateTime;
        _x.createdDateTime = createdDateTime;
        _x.customExtensionCalloutInstances = customExtensionCalloutInstances;
        _x.requestType = requestType;
        _x.schedule = schedule;
        _x.state = state;
        _x.status = status;
        return _x;
    }

    @Action(name = "cancel")
    @JsonIgnore
    public ActionRequestNoReturn cancel() {
        Map _parameters = ParameterMap.empty();
        return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.cancel"), _parameters);
    }

    @Action(name = "reprocess")
    @JsonIgnore
    public ActionRequestNoReturn reprocess() {
        Map _parameters = ParameterMap.empty();
        return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.reprocess"), _parameters);
    }

    @Action(name = "resume")
    @JsonIgnore
    public ActionRequestNoReturn resume(String source, String type, CustomExtensionData data) {
        Map _parameters = ParameterMap
            .put("source", "Edm.String", Checks.checkIsAscii(source))
            .put("type", "Edm.String", Checks.checkIsAscii(type))
            .put("data", "microsoft.graph.customExtensionData", data)
            .build();
        return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.resume"), _parameters);
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("AccessPackageAssignmentRequest[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("answers=");
        b.append(this.answers);
        b.append(", ");
        b.append("completedDateTime=");
        b.append(this.completedDateTime);
        b.append(", ");
        b.append("createdDateTime=");
        b.append(this.createdDateTime);
        b.append(", ");
        b.append("customExtensionCalloutInstances=");
        b.append(this.customExtensionCalloutInstances);
        b.append(", ");
        b.append("requestType=");
        b.append(this.requestType);
        b.append(", ");
        b.append("schedule=");
        b.append(this.schedule);
        b.append(", ");
        b.append("state=");
        b.append(this.state);
        b.append(", ");
        b.append("status=");
        b.append(this.status);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy