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

odata.msgraph.client.entity.AppRoleAssignment 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.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.Optional;
import java.util.UUID;

@JsonPropertyOrder({
    "@odata.type", 
    "appRoleId", 
    "createdDateTime", 
    "principalDisplayName", 
    "principalId", 
    "principalType", 
    "resourceDisplayName", 
    "resourceId"})
@JsonInclude(Include.NON_NULL)
public class AppRoleAssignment extends DirectoryObject implements ODataEntityType {

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

    @JsonProperty("appRoleId")
    protected UUID appRoleId;

    @JsonProperty("createdDateTime")
    protected OffsetDateTime createdDateTime;

    @JsonProperty("principalDisplayName")
    protected String principalDisplayName;

    @JsonProperty("principalId")
    protected UUID principalId;

    @JsonProperty("principalType")
    protected String principalType;

    @JsonProperty("resourceDisplayName")
    protected String resourceDisplayName;

    @JsonProperty("resourceId")
    protected UUID resourceId;

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

    public static final class Builder {
        private String id;
        private OffsetDateTime deletedDateTime;
        private UUID appRoleId;
        private OffsetDateTime createdDateTime;
        private String principalDisplayName;
        private UUID principalId;
        private String principalType;
        private String resourceDisplayName;
        private UUID resourceId;
        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 deletedDateTime(OffsetDateTime deletedDateTime) {
            this.deletedDateTime = deletedDateTime;
            this.changedFields = changedFields.add("deletedDateTime");
            return this;
        }

        public Builder appRoleId(UUID appRoleId) {
            this.appRoleId = appRoleId;
            this.changedFields = changedFields.add("appRoleId");
            return this;
        }

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

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

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

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

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

        public Builder resourceId(UUID resourceId) {
            this.resourceId = resourceId;
            this.changedFields = changedFields.add("resourceId");
            return this;
        }

        public AppRoleAssignment build() {
            AppRoleAssignment _x = new AppRoleAssignment();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.appRoleAssignment";
            _x.id = id;
            _x.deletedDateTime = deletedDateTime;
            _x.appRoleId = appRoleId;
            _x.createdDateTime = createdDateTime;
            _x.principalDisplayName = principalDisplayName;
            _x.principalId = principalId;
            _x.principalType = principalType;
            _x.resourceDisplayName = resourceDisplayName;
            _x.resourceId = resourceId;
            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="appRoleId")
    @JsonIgnore
    public Optional getAppRoleId() {
        return Optional.ofNullable(appRoleId);
    }

    public AppRoleAssignment withAppRoleId(UUID appRoleId) {
        AppRoleAssignment _x = _copy();
        _x.changedFields = changedFields.add("appRoleId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.appRoleAssignment");
        _x.appRoleId = appRoleId;
        return _x;
    }

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

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

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

    public AppRoleAssignment withPrincipalDisplayName(String principalDisplayName) {
        AppRoleAssignment _x = _copy();
        _x.changedFields = changedFields.add("principalDisplayName");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.appRoleAssignment");
        _x.principalDisplayName = principalDisplayName;
        return _x;
    }

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

    public AppRoleAssignment withPrincipalId(UUID principalId) {
        AppRoleAssignment _x = _copy();
        _x.changedFields = changedFields.add("principalId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.appRoleAssignment");
        _x.principalId = principalId;
        return _x;
    }

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

    public AppRoleAssignment withPrincipalType(String principalType) {
        AppRoleAssignment _x = _copy();
        _x.changedFields = changedFields.add("principalType");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.appRoleAssignment");
        _x.principalType = principalType;
        return _x;
    }

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

    public AppRoleAssignment withResourceDisplayName(String resourceDisplayName) {
        AppRoleAssignment _x = _copy();
        _x.changedFields = changedFields.add("resourceDisplayName");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.appRoleAssignment");
        _x.resourceDisplayName = resourceDisplayName;
        return _x;
    }

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

    public AppRoleAssignment withResourceId(UUID resourceId) {
        AppRoleAssignment _x = _copy();
        _x.changedFields = changedFields.add("resourceId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.appRoleAssignment");
        _x.resourceId = resourceId;
        return _x;
    }

    public AppRoleAssignment withUnmappedField(String name, Object value) {
        AppRoleAssignment _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 AppRoleAssignment patch() {
        RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
        AppRoleAssignment _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 AppRoleAssignment put() {
        RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
        AppRoleAssignment _x = _copy();
        _x.changedFields = null;
        return _x;
    }

    private AppRoleAssignment _copy() {
        AppRoleAssignment _x = new AppRoleAssignment();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.deletedDateTime = deletedDateTime;
        _x.appRoleId = appRoleId;
        _x.createdDateTime = createdDateTime;
        _x.principalDisplayName = principalDisplayName;
        _x.principalId = principalId;
        _x.principalType = principalType;
        _x.resourceDisplayName = resourceDisplayName;
        _x.resourceId = resourceId;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("AppRoleAssignment[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("deletedDateTime=");
        b.append(this.deletedDateTime);
        b.append(", ");
        b.append("appRoleId=");
        b.append(this.appRoleId);
        b.append(", ");
        b.append("createdDateTime=");
        b.append(this.createdDateTime);
        b.append(", ");
        b.append("principalDisplayName=");
        b.append(this.principalDisplayName);
        b.append(", ");
        b.append("principalId=");
        b.append(this.principalId);
        b.append(", ");
        b.append("principalType=");
        b.append(this.principalType);
        b.append(", ");
        b.append("resourceDisplayName=");
        b.append(this.resourceDisplayName);
        b.append(", ");
        b.append("resourceId=");
        b.append(this.resourceId);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy