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

odata.msgraph.client.entity.AccessPackageAssignmentPolicy 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.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.NavigationProperty;
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.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.Optional;

import odata.msgraph.client.complex.AccessPackageAssignmentApprovalSettings;
import odata.msgraph.client.complex.AccessPackageAssignmentRequestorSettings;
import odata.msgraph.client.complex.AccessPackageAssignmentReviewSettings;
import odata.msgraph.client.complex.AccessPackageAutomaticRequestSettings;
import odata.msgraph.client.complex.ExpirationPattern;
import odata.msgraph.client.complex.SubjectSet;
import odata.msgraph.client.entity.collection.request.AccessPackageQuestionCollectionRequest;
import odata.msgraph.client.entity.collection.request.CustomExtensionStageSettingCollectionRequest;
import odata.msgraph.client.entity.request.AccessPackageCatalogRequest;
import odata.msgraph.client.entity.request.AccessPackageRequest;
import odata.msgraph.client.enums.AllowedTargetScope;

@JsonPropertyOrder({
    "@odata.type", 
    "allowedTargetScope", 
    "automaticRequestSettings", 
    "createdDateTime", 
    "description", 
    "displayName", 
    "expiration", 
    "modifiedDateTime", 
    "requestApprovalSettings", 
    "requestorSettings", 
    "reviewSettings", 
    "specificAllowedTargets", 
    "questions"})
@JsonInclude(Include.NON_NULL)
public class AccessPackageAssignmentPolicy extends Entity implements ODataEntityType {

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

    @JsonProperty("allowedTargetScope")
    protected AllowedTargetScope allowedTargetScope;

    @JsonProperty("automaticRequestSettings")
    protected AccessPackageAutomaticRequestSettings automaticRequestSettings;

    @JsonProperty("createdDateTime")
    protected OffsetDateTime createdDateTime;

    @JsonProperty("description")
    protected String description;

    @JsonProperty("displayName")
    protected String displayName;

    @JsonProperty("expiration")
    protected ExpirationPattern expiration;

    @JsonProperty("modifiedDateTime")
    protected OffsetDateTime modifiedDateTime;

    @JsonProperty("requestApprovalSettings")
    protected AccessPackageAssignmentApprovalSettings requestApprovalSettings;

    @JsonProperty("requestorSettings")
    protected AccessPackageAssignmentRequestorSettings requestorSettings;

    @JsonProperty("reviewSettings")
    protected AccessPackageAssignmentReviewSettings reviewSettings;

    @JsonProperty("specificAllowedTargets")
    protected List specificAllowedTargets;

    @JsonProperty("specificAllowedTargets@nextLink")
    protected String specificAllowedTargetsNextLink;

    @JsonProperty("questions")
    protected List questions;

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

    public static final class Builder {
        private String id;
        private AllowedTargetScope allowedTargetScope;
        private AccessPackageAutomaticRequestSettings automaticRequestSettings;
        private OffsetDateTime createdDateTime;
        private String description;
        private String displayName;
        private ExpirationPattern expiration;
        private OffsetDateTime modifiedDateTime;
        private AccessPackageAssignmentApprovalSettings requestApprovalSettings;
        private AccessPackageAssignmentRequestorSettings requestorSettings;
        private AccessPackageAssignmentReviewSettings reviewSettings;
        private List specificAllowedTargets;
        private String specificAllowedTargetsNextLink;
        private List questions;
        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 allowedTargetScope(AllowedTargetScope allowedTargetScope) {
            this.allowedTargetScope = allowedTargetScope;
            this.changedFields = changedFields.add("allowedTargetScope");
            return this;
        }

        public Builder automaticRequestSettings(AccessPackageAutomaticRequestSettings automaticRequestSettings) {
            this.automaticRequestSettings = automaticRequestSettings;
            this.changedFields = changedFields.add("automaticRequestSettings");
            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 expiration(ExpirationPattern expiration) {
            this.expiration = expiration;
            this.changedFields = changedFields.add("expiration");
            return this;
        }

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

        public Builder requestApprovalSettings(AccessPackageAssignmentApprovalSettings requestApprovalSettings) {
            this.requestApprovalSettings = requestApprovalSettings;
            this.changedFields = changedFields.add("requestApprovalSettings");
            return this;
        }

        public Builder requestorSettings(AccessPackageAssignmentRequestorSettings requestorSettings) {
            this.requestorSettings = requestorSettings;
            this.changedFields = changedFields.add("requestorSettings");
            return this;
        }

        public Builder reviewSettings(AccessPackageAssignmentReviewSettings reviewSettings) {
            this.reviewSettings = reviewSettings;
            this.changedFields = changedFields.add("reviewSettings");
            return this;
        }

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

        public Builder specificAllowedTargets(SubjectSet... specificAllowedTargets) {
            return specificAllowedTargets(Arrays.asList(specificAllowedTargets));
        }

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

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

        public Builder questions(AccessPackageQuestion... questions) {
            return questions(Arrays.asList(questions));
        }

        public AccessPackageAssignmentPolicy build() {
            AccessPackageAssignmentPolicy _x = new AccessPackageAssignmentPolicy();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.accessPackageAssignmentPolicy";
            _x.id = id;
            _x.allowedTargetScope = allowedTargetScope;
            _x.automaticRequestSettings = automaticRequestSettings;
            _x.createdDateTime = createdDateTime;
            _x.description = description;
            _x.displayName = displayName;
            _x.expiration = expiration;
            _x.modifiedDateTime = modifiedDateTime;
            _x.requestApprovalSettings = requestApprovalSettings;
            _x.requestorSettings = requestorSettings;
            _x.reviewSettings = reviewSettings;
            _x.specificAllowedTargets = specificAllowedTargets;
            _x.specificAllowedTargetsNextLink = specificAllowedTargetsNextLink;
            _x.questions = questions;
            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="allowedTargetScope")
    @JsonIgnore
    public Optional getAllowedTargetScope() {
        return Optional.ofNullable(allowedTargetScope);
    }

    public AccessPackageAssignmentPolicy withAllowedTargetScope(AllowedTargetScope allowedTargetScope) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("allowedTargetScope");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.allowedTargetScope = allowedTargetScope;
        return _x;
    }

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

    public AccessPackageAssignmentPolicy withAutomaticRequestSettings(AccessPackageAutomaticRequestSettings automaticRequestSettings) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("automaticRequestSettings");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.automaticRequestSettings = automaticRequestSettings;
        return _x;
    }

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

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

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

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

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

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

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

    public AccessPackageAssignmentPolicy withExpiration(ExpirationPattern expiration) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("expiration");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.expiration = expiration;
        return _x;
    }

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

    public AccessPackageAssignmentPolicy withModifiedDateTime(OffsetDateTime modifiedDateTime) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("modifiedDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.modifiedDateTime = modifiedDateTime;
        return _x;
    }

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

    public AccessPackageAssignmentPolicy withRequestApprovalSettings(AccessPackageAssignmentApprovalSettings requestApprovalSettings) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("requestApprovalSettings");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.requestApprovalSettings = requestApprovalSettings;
        return _x;
    }

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

    public AccessPackageAssignmentPolicy withRequestorSettings(AccessPackageAssignmentRequestorSettings requestorSettings) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("requestorSettings");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.requestorSettings = requestorSettings;
        return _x;
    }

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

    public AccessPackageAssignmentPolicy withReviewSettings(AccessPackageAssignmentReviewSettings reviewSettings) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("reviewSettings");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.reviewSettings = reviewSettings;
        return _x;
    }

    @Property(name="specificAllowedTargets")
    @JsonIgnore
    public CollectionPage getSpecificAllowedTargets() {
        return new CollectionPage(contextPath, SubjectSet.class, this.specificAllowedTargets, Optional.ofNullable(specificAllowedTargetsNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
    }

    public AccessPackageAssignmentPolicy withSpecificAllowedTargets(List specificAllowedTargets) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("specificAllowedTargets");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.specificAllowedTargets = specificAllowedTargets;
        return _x;
    }

    @Property(name="specificAllowedTargets")
    @JsonIgnore
    public CollectionPage getSpecificAllowedTargets(HttpRequestOptions options) {
        return new CollectionPage(contextPath, SubjectSet.class, this.specificAllowedTargets, Optional.ofNullable(specificAllowedTargetsNextLink), Collections.emptyList(), options);
    }

    public AccessPackageAssignmentPolicy withUnmappedField(String name, Object value) {
        AccessPackageAssignmentPolicy _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="catalog")
    @JsonIgnore
    public AccessPackageCatalogRequest getCatalog() {
        return new AccessPackageCatalogRequest(contextPath.addSegment("catalog"), RequestHelper.getValue(unmappedFields, "catalog"));
    }

    @NavigationProperty(name="customExtensionStageSettings")
    @JsonIgnore
    public CustomExtensionStageSettingCollectionRequest getCustomExtensionStageSettings() {
        return new CustomExtensionStageSettingCollectionRequest(
                        contextPath.addSegment("customExtensionStageSettings"), RequestHelper.getValue(unmappedFields, "customExtensionStageSettings"));
    }

    @NavigationProperty(name="questions")
    @JsonIgnore
    public AccessPackageQuestionCollectionRequest getQuestions() {
        return new AccessPackageQuestionCollectionRequest(
                        contextPath.addSegment("questions"), Optional.ofNullable(questions));
    }

    public AccessPackageAssignmentPolicy withQuestions(List questions) {
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = changedFields.add("questions");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageAssignmentPolicy");
        _x.questions = questions;
        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 AccessPackageAssignmentPolicy patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
        AccessPackageAssignmentPolicy _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 AccessPackageAssignmentPolicy put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
        AccessPackageAssignmentPolicy _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    private AccessPackageAssignmentPolicy _copy() {
        AccessPackageAssignmentPolicy _x = new AccessPackageAssignmentPolicy();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.allowedTargetScope = allowedTargetScope;
        _x.automaticRequestSettings = automaticRequestSettings;
        _x.createdDateTime = createdDateTime;
        _x.description = description;
        _x.displayName = displayName;
        _x.expiration = expiration;
        _x.modifiedDateTime = modifiedDateTime;
        _x.requestApprovalSettings = requestApprovalSettings;
        _x.requestorSettings = requestorSettings;
        _x.reviewSettings = reviewSettings;
        _x.specificAllowedTargets = specificAllowedTargets;
        _x.questions = questions;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("AccessPackageAssignmentPolicy[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("allowedTargetScope=");
        b.append(this.allowedTargetScope);
        b.append(", ");
        b.append("automaticRequestSettings=");
        b.append(this.automaticRequestSettings);
        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("expiration=");
        b.append(this.expiration);
        b.append(", ");
        b.append("modifiedDateTime=");
        b.append(this.modifiedDateTime);
        b.append(", ");
        b.append("requestApprovalSettings=");
        b.append(this.requestApprovalSettings);
        b.append(", ");
        b.append("requestorSettings=");
        b.append(this.requestorSettings);
        b.append(", ");
        b.append("reviewSettings=");
        b.append(this.reviewSettings);
        b.append(", ");
        b.append("specificAllowedTargets=");
        b.append(this.specificAllowedTargets);
        b.append(", ");
        b.append("questions=");
        b.append(this.questions);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy