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

odata.msgraph.client.entity.AccessPackageSubject 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.ConnectedOrganizationRequest;
import odata.msgraph.client.enums.AccessPackageSubjectType;

@JsonPropertyOrder({
    "@odata.type", 
    "displayName", 
    "email", 
    "objectId", 
    "onPremisesSecurityIdentifier", 
    "principalName", 
    "subjectType"})
@JsonInclude(Include.NON_NULL)
public class AccessPackageSubject extends Entity implements ODataEntityType {

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

    @JsonProperty("displayName")
    protected String displayName;

    @JsonProperty("email")
    protected String email;

    @JsonProperty("objectId")
    protected String objectId;

    @JsonProperty("onPremisesSecurityIdentifier")
    protected String onPremisesSecurityIdentifier;

    @JsonProperty("principalName")
    protected String principalName;

    @JsonProperty("subjectType")
    protected AccessPackageSubjectType subjectType;

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

    public static final class Builder {
        private String id;
        private String displayName;
        private String email;
        private String objectId;
        private String onPremisesSecurityIdentifier;
        private String principalName;
        private AccessPackageSubjectType subjectType;
        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 displayName(String displayName) {
            this.displayName = displayName;
            this.changedFields = changedFields.add("displayName");
            return this;
        }

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

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

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

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

        public Builder subjectType(AccessPackageSubjectType subjectType) {
            this.subjectType = subjectType;
            this.changedFields = changedFields.add("subjectType");
            return this;
        }

        public AccessPackageSubject build() {
            AccessPackageSubject _x = new AccessPackageSubject();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.accessPackageSubject";
            _x.id = id;
            _x.displayName = displayName;
            _x.email = email;
            _x.objectId = objectId;
            _x.onPremisesSecurityIdentifier = onPremisesSecurityIdentifier;
            _x.principalName = principalName;
            _x.subjectType = subjectType;
            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="displayName")
    @JsonIgnore
    public Optional getDisplayName() {
        return Optional.ofNullable(displayName);
    }

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

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

    public AccessPackageSubject withEmail(String email) {
        AccessPackageSubject _x = _copy();
        _x.changedFields = changedFields.add("email");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageSubject");
        _x.email = email;
        return _x;
    }

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

    public AccessPackageSubject withObjectId(String objectId) {
        AccessPackageSubject _x = _copy();
        _x.changedFields = changedFields.add("objectId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageSubject");
        _x.objectId = objectId;
        return _x;
    }

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

    public AccessPackageSubject withOnPremisesSecurityIdentifier(String onPremisesSecurityIdentifier) {
        AccessPackageSubject _x = _copy();
        _x.changedFields = changedFields.add("onPremisesSecurityIdentifier");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageSubject");
        _x.onPremisesSecurityIdentifier = onPremisesSecurityIdentifier;
        return _x;
    }

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

    public AccessPackageSubject withPrincipalName(String principalName) {
        AccessPackageSubject _x = _copy();
        _x.changedFields = changedFields.add("principalName");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageSubject");
        _x.principalName = principalName;
        return _x;
    }

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

    public AccessPackageSubject withSubjectType(AccessPackageSubjectType subjectType) {
        AccessPackageSubject _x = _copy();
        _x.changedFields = changedFields.add("subjectType");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.accessPackageSubject");
        _x.subjectType = subjectType;
        return _x;
    }

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

    @NavigationProperty(name="connectedOrganization")
    @JsonIgnore
    public ConnectedOrganizationRequest getConnectedOrganization() {
        return new ConnectedOrganizationRequest(contextPath.addSegment("connectedOrganization"), RequestHelper.getValue(unmappedFields, "connectedOrganization"));
    }

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

    private AccessPackageSubject _copy() {
        AccessPackageSubject _x = new AccessPackageSubject();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.displayName = displayName;
        _x.email = email;
        _x.objectId = objectId;
        _x.onPremisesSecurityIdentifier = onPremisesSecurityIdentifier;
        _x.principalName = principalName;
        _x.subjectType = subjectType;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("AccessPackageSubject[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("displayName=");
        b.append(this.displayName);
        b.append(", ");
        b.append("email=");
        b.append(this.email);
        b.append(", ");
        b.append("objectId=");
        b.append(this.objectId);
        b.append(", ");
        b.append("onPremisesSecurityIdentifier=");
        b.append(this.onPremisesSecurityIdentifier);
        b.append(", ");
        b.append("principalName=");
        b.append(this.principalName);
        b.append(", ");
        b.append("subjectType=");
        b.append(this.subjectType);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy