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

odata.msgraph.client.beta.entity.AccessReview Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package odata.msgraph.client.beta.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.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.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.Map;
import java.util.Optional;

import odata.msgraph.client.beta.complex.AccessReviewSettings;
import odata.msgraph.client.beta.complex.Identity;
import odata.msgraph.client.beta.complex.UserIdentity;
import odata.msgraph.client.beta.entity.collection.request.AccessReviewCollectionRequest;
import odata.msgraph.client.beta.entity.collection.request.AccessReviewDecisionCollectionRequest;
import odata.msgraph.client.beta.entity.collection.request.AccessReviewReviewerCollectionRequest;

@JsonPropertyOrder({
    "@odata.type", 
    "businessFlowTemplateId", 
    "createdBy", 
    "description", 
    "displayName", 
    "endDateTime", 
    "reviewedEntity", 
    "reviewerType", 
    "settings", 
    "startDateTime", 
    "status"})
@JsonInclude(Include.NON_NULL)
public class AccessReview extends Entity implements ODataEntityType {

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

    @JsonProperty("businessFlowTemplateId")
    protected String businessFlowTemplateId;

    @JsonProperty("createdBy")
    protected UserIdentity createdBy;

    @JsonProperty("description")
    protected String description;

    @JsonProperty("displayName")
    protected String displayName;

    @JsonProperty("endDateTime")
    protected OffsetDateTime endDateTime;

    @JsonProperty("reviewedEntity")
    protected Identity reviewedEntity;

    @JsonProperty("reviewerType")
    protected String reviewerType;

    @JsonProperty("settings")
    protected AccessReviewSettings settings;

    @JsonProperty("startDateTime")
    protected OffsetDateTime startDateTime;

    @JsonProperty("status")
    protected String status;

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

    public static final class Builder {
        private String id;
        private String businessFlowTemplateId;
        private UserIdentity createdBy;
        private String description;
        private String displayName;
        private OffsetDateTime endDateTime;
        private Identity reviewedEntity;
        private String reviewerType;
        private AccessReviewSettings settings;
        private OffsetDateTime startDateTime;
        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 businessFlowTemplateId(String businessFlowTemplateId) {
            this.businessFlowTemplateId = businessFlowTemplateId;
            this.changedFields = changedFields.add("businessFlowTemplateId");
            return this;
        }

        public Builder createdBy(UserIdentity createdBy) {
            this.createdBy = createdBy;
            this.changedFields = changedFields.add("createdBy");
            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 endDateTime(OffsetDateTime endDateTime) {
            this.endDateTime = endDateTime;
            this.changedFields = changedFields.add("endDateTime");
            return this;
        }

        public Builder reviewedEntity(Identity reviewedEntity) {
            this.reviewedEntity = reviewedEntity;
            this.changedFields = changedFields.add("reviewedEntity");
            return this;
        }

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

        public Builder settings(AccessReviewSettings settings) {
            this.settings = settings;
            this.changedFields = changedFields.add("settings");
            return this;
        }

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

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

        public AccessReview build() {
            AccessReview _x = new AccessReview();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.accessReview";
            _x.id = id;
            _x.businessFlowTemplateId = businessFlowTemplateId;
            _x.createdBy = createdBy;
            _x.description = description;
            _x.displayName = displayName;
            _x.endDateTime = endDateTime;
            _x.reviewedEntity = reviewedEntity;
            _x.reviewerType = reviewerType;
            _x.settings = settings;
            _x.startDateTime = startDateTime;
            _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.toString()));
        }
    }

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

    public AccessReview withBusinessFlowTemplateId(String businessFlowTemplateId) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("businessFlowTemplateId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.businessFlowTemplateId = businessFlowTemplateId;
        return _x;
    }

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

    public AccessReview withCreatedBy(UserIdentity createdBy) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("createdBy");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.createdBy = createdBy;
        return _x;
    }

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

    public AccessReview withDescription(String description) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("description");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.description = description;
        return _x;
    }

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

    public AccessReview withDisplayName(String displayName) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("displayName");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.displayName = displayName;
        return _x;
    }

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

    public AccessReview withEndDateTime(OffsetDateTime endDateTime) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("endDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.endDateTime = endDateTime;
        return _x;
    }

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

    public AccessReview withReviewedEntity(Identity reviewedEntity) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("reviewedEntity");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.reviewedEntity = reviewedEntity;
        return _x;
    }

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

    public AccessReview withReviewerType(String reviewerType) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("reviewerType");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.reviewerType = reviewerType;
        return _x;
    }

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

    public AccessReview withSettings(AccessReviewSettings settings) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("settings");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.settings = settings;
        return _x;
    }

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

    public AccessReview withStartDateTime(OffsetDateTime startDateTime) {
        AccessReview _x = _copy();
        _x.changedFields = changedFields.add("startDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessReview");
        _x.startDateTime = startDateTime;
        return _x;
    }

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

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

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

    @NavigationProperty(name="decisions")
    @JsonIgnore
    public AccessReviewDecisionCollectionRequest getDecisions() {
        return new AccessReviewDecisionCollectionRequest(
                        contextPath.addSegment("decisions"), RequestHelper.getValue(unmappedFields, "decisions"));
    }

    @NavigationProperty(name="instances")
    @JsonIgnore
    public AccessReviewCollectionRequest getInstances() {
        return new AccessReviewCollectionRequest(
                        contextPath.addSegment("instances"), RequestHelper.getValue(unmappedFields, "instances"));
    }

    @NavigationProperty(name="myDecisions")
    @JsonIgnore
    public AccessReviewDecisionCollectionRequest getMyDecisions() {
        return new AccessReviewDecisionCollectionRequest(
                        contextPath.addSegment("myDecisions"), RequestHelper.getValue(unmappedFields, "myDecisions"));
    }

    @NavigationProperty(name="reviewers")
    @JsonIgnore
    public AccessReviewReviewerCollectionRequest getReviewers() {
        return new AccessReviewReviewerCollectionRequest(
                        contextPath.addSegment("reviewers"), RequestHelper.getValue(unmappedFields, "reviewers"));
    }

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

    private AccessReview _copy() {
        AccessReview _x = new AccessReview();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.businessFlowTemplateId = businessFlowTemplateId;
        _x.createdBy = createdBy;
        _x.description = description;
        _x.displayName = displayName;
        _x.endDateTime = endDateTime;
        _x.reviewedEntity = reviewedEntity;
        _x.reviewerType = reviewerType;
        _x.settings = settings;
        _x.startDateTime = startDateTime;
        _x.status = status;
        return _x;
    }

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

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

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

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

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("AccessReview[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("businessFlowTemplateId=");
        b.append(this.businessFlowTemplateId);
        b.append(", ");
        b.append("createdBy=");
        b.append(this.createdBy);
        b.append(", ");
        b.append("description=");
        b.append(this.description);
        b.append(", ");
        b.append("displayName=");
        b.append(this.displayName);
        b.append(", ");
        b.append("endDateTime=");
        b.append(this.endDateTime);
        b.append(", ");
        b.append("reviewedEntity=");
        b.append(this.reviewedEntity);
        b.append(", ");
        b.append("reviewerType=");
        b.append(this.reviewerType);
        b.append(", ");
        b.append("settings=");
        b.append(this.settings);
        b.append(", ");
        b.append("startDateTime=");
        b.append(this.startDateTime);
        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