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

odata.msgraph.client.entity.UnifiedRoleScheduleInstanceBase 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.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.util.Optional;

import odata.msgraph.client.entity.request.AppScopeRequest;
import odata.msgraph.client.entity.request.DirectoryObjectRequest;
import odata.msgraph.client.entity.request.UnifiedRoleDefinitionRequest;

@JsonPropertyOrder({
    "@odata.type", 
    "appScopeId", 
    "directoryScopeId", 
    "principalId", 
    "roleDefinitionId"})
@JsonInclude(Include.NON_NULL)
public class UnifiedRoleScheduleInstanceBase extends Entity implements ODataEntityType {

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

    @JsonProperty("appScopeId")
    protected String appScopeId;

    @JsonProperty("directoryScopeId")
    protected String directoryScopeId;

    @JsonProperty("principalId")
    protected String principalId;

    @JsonProperty("roleDefinitionId")
    protected String roleDefinitionId;

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

    public static final class Builder {
        private String id;
        private String appScopeId;
        private String directoryScopeId;
        private String principalId;
        private String roleDefinitionId;
        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 appScopeId(String appScopeId) {
            this.appScopeId = appScopeId;
            this.changedFields = changedFields.add("appScopeId");
            return this;
        }

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

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

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

        public UnifiedRoleScheduleInstanceBase build() {
            UnifiedRoleScheduleInstanceBase _x = new UnifiedRoleScheduleInstanceBase();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.unifiedRoleScheduleInstanceBase";
            _x.id = id;
            _x.appScopeId = appScopeId;
            _x.directoryScopeId = directoryScopeId;
            _x.principalId = principalId;
            _x.roleDefinitionId = roleDefinitionId;
            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="appScopeId")
    @JsonIgnore
    public Optional getAppScopeId() {
        return Optional.ofNullable(appScopeId);
    }

    public UnifiedRoleScheduleInstanceBase withAppScopeId(String appScopeId) {
        UnifiedRoleScheduleInstanceBase _x = _copy();
        _x.changedFields = changedFields.add("appScopeId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.unifiedRoleScheduleInstanceBase");
        _x.appScopeId = appScopeId;
        return _x;
    }

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

    public UnifiedRoleScheduleInstanceBase withDirectoryScopeId(String directoryScopeId) {
        UnifiedRoleScheduleInstanceBase _x = _copy();
        _x.changedFields = changedFields.add("directoryScopeId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.unifiedRoleScheduleInstanceBase");
        _x.directoryScopeId = directoryScopeId;
        return _x;
    }

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

    public UnifiedRoleScheduleInstanceBase withPrincipalId(String principalId) {
        UnifiedRoleScheduleInstanceBase _x = _copy();
        _x.changedFields = changedFields.add("principalId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.unifiedRoleScheduleInstanceBase");
        _x.principalId = principalId;
        return _x;
    }

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

    public UnifiedRoleScheduleInstanceBase withRoleDefinitionId(String roleDefinitionId) {
        UnifiedRoleScheduleInstanceBase _x = _copy();
        _x.changedFields = changedFields.add("roleDefinitionId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.unifiedRoleScheduleInstanceBase");
        _x.roleDefinitionId = roleDefinitionId;
        return _x;
    }

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

    @NavigationProperty(name="appScope")
    @JsonIgnore
    public AppScopeRequest getAppScope() {
        return new AppScopeRequest(contextPath.addSegment("appScope"), RequestHelper.getValue(unmappedFields, "appScope"));
    }

    @NavigationProperty(name="directoryScope")
    @JsonIgnore
    public DirectoryObjectRequest getDirectoryScope() {
        return new DirectoryObjectRequest(contextPath.addSegment("directoryScope"), RequestHelper.getValue(unmappedFields, "directoryScope"));
    }

    @NavigationProperty(name="principal")
    @JsonIgnore
    public DirectoryObjectRequest getPrincipal() {
        return new DirectoryObjectRequest(contextPath.addSegment("principal"), RequestHelper.getValue(unmappedFields, "principal"));
    }

    @NavigationProperty(name="roleDefinition")
    @JsonIgnore
    public UnifiedRoleDefinitionRequest getRoleDefinition() {
        return new UnifiedRoleDefinitionRequest(contextPath.addSegment("roleDefinition"), RequestHelper.getValue(unmappedFields, "roleDefinition"));
    }

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

    private UnifiedRoleScheduleInstanceBase _copy() {
        UnifiedRoleScheduleInstanceBase _x = new UnifiedRoleScheduleInstanceBase();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.appScopeId = appScopeId;
        _x.directoryScopeId = directoryScopeId;
        _x.principalId = principalId;
        _x.roleDefinitionId = roleDefinitionId;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("UnifiedRoleScheduleInstanceBase[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("appScopeId=");
        b.append(this.appScopeId);
        b.append(", ");
        b.append("directoryScopeId=");
        b.append(this.directoryScopeId);
        b.append(", ");
        b.append("principalId=");
        b.append(this.principalId);
        b.append(", ");
        b.append("roleDefinitionId=");
        b.append(this.roleDefinitionId);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy