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

odata.msgraph.client.beta.entity.TimeOffRequest 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.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 odata.msgraph.client.beta.complex.IdentitySet;
import odata.msgraph.client.beta.enums.ScheduleChangeRequestActor;
import odata.msgraph.client.beta.enums.ScheduleChangeState;

@JsonPropertyOrder({
    "@odata.type", 
    "endDateTime", 
    "startDateTime", 
    "timeOffReasonId"})
@JsonInclude(Include.NON_NULL)
public class TimeOffRequest extends ScheduleChangeRequest implements ODataEntityType {

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

    @JsonProperty("endDateTime")
    protected OffsetDateTime endDateTime;

    @JsonProperty("startDateTime")
    protected OffsetDateTime startDateTime;

    @JsonProperty("timeOffReasonId")
    protected String timeOffReasonId;

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

    public static final class Builder {
        private String id;
        private IdentitySet createdBy;
        private OffsetDateTime createdDateTime;
        private IdentitySet lastModifiedBy;
        private OffsetDateTime lastModifiedDateTime;
        private ScheduleChangeRequestActor assignedTo;
        private OffsetDateTime managerActionDateTime;
        private String managerActionMessage;
        private String managerUserId;
        private OffsetDateTime senderDateTime;
        private String senderMessage;
        private String senderUserId;
        private ScheduleChangeState state;
        private OffsetDateTime endDateTime;
        private OffsetDateTime startDateTime;
        private String timeOffReasonId;
        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 createdBy(IdentitySet createdBy) {
            this.createdBy = createdBy;
            this.changedFields = changedFields.add("createdBy");
            return this;
        }

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

        public Builder lastModifiedBy(IdentitySet lastModifiedBy) {
            this.lastModifiedBy = lastModifiedBy;
            this.changedFields = changedFields.add("lastModifiedBy");
            return this;
        }

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

        public Builder assignedTo(ScheduleChangeRequestActor assignedTo) {
            this.assignedTo = assignedTo;
            this.changedFields = changedFields.add("assignedTo");
            return this;
        }

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

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

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

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

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

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

        public Builder state(ScheduleChangeState state) {
            this.state = state;
            this.changedFields = changedFields.add("state");
            return this;
        }

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

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

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

        public TimeOffRequest build() {
            TimeOffRequest _x = new TimeOffRequest();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.timeOffRequest";
            _x.id = id;
            _x.createdBy = createdBy;
            _x.createdDateTime = createdDateTime;
            _x.lastModifiedBy = lastModifiedBy;
            _x.lastModifiedDateTime = lastModifiedDateTime;
            _x.assignedTo = assignedTo;
            _x.managerActionDateTime = managerActionDateTime;
            _x.managerActionMessage = managerActionMessage;
            _x.managerUserId = managerUserId;
            _x.senderDateTime = senderDateTime;
            _x.senderMessage = senderMessage;
            _x.senderUserId = senderUserId;
            _x.state = state;
            _x.endDateTime = endDateTime;
            _x.startDateTime = startDateTime;
            _x.timeOffReasonId = timeOffReasonId;
            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="endDateTime")
    @JsonIgnore
    public Optional getEndDateTime() {
        return Optional.ofNullable(endDateTime);
    }

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

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

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

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

    public TimeOffRequest withTimeOffReasonId(String timeOffReasonId) {
        TimeOffRequest _x = _copy();
        _x.changedFields = changedFields.add("timeOffReasonId");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.timeOffRequest");
        _x.timeOffReasonId = timeOffReasonId;
        return _x;
    }

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

    private TimeOffRequest _copy() {
        TimeOffRequest _x = new TimeOffRequest();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.createdBy = createdBy;
        _x.createdDateTime = createdDateTime;
        _x.lastModifiedBy = lastModifiedBy;
        _x.lastModifiedDateTime = lastModifiedDateTime;
        _x.assignedTo = assignedTo;
        _x.managerActionDateTime = managerActionDateTime;
        _x.managerActionMessage = managerActionMessage;
        _x.managerUserId = managerUserId;
        _x.senderDateTime = senderDateTime;
        _x.senderMessage = senderMessage;
        _x.senderUserId = senderUserId;
        _x.state = state;
        _x.endDateTime = endDateTime;
        _x.startDateTime = startDateTime;
        _x.timeOffReasonId = timeOffReasonId;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("TimeOffRequest[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("createdBy=");
        b.append(this.createdBy);
        b.append(", ");
        b.append("createdDateTime=");
        b.append(this.createdDateTime);
        b.append(", ");
        b.append("lastModifiedBy=");
        b.append(this.lastModifiedBy);
        b.append(", ");
        b.append("lastModifiedDateTime=");
        b.append(this.lastModifiedDateTime);
        b.append(", ");
        b.append("assignedTo=");
        b.append(this.assignedTo);
        b.append(", ");
        b.append("managerActionDateTime=");
        b.append(this.managerActionDateTime);
        b.append(", ");
        b.append("managerActionMessage=");
        b.append(this.managerActionMessage);
        b.append(", ");
        b.append("managerUserId=");
        b.append(this.managerUserId);
        b.append(", ");
        b.append("senderDateTime=");
        b.append(this.senderDateTime);
        b.append(", ");
        b.append("senderMessage=");
        b.append(this.senderMessage);
        b.append(", ");
        b.append("senderUserId=");
        b.append(this.senderUserId);
        b.append(", ");
        b.append("state=");
        b.append(this.state);
        b.append(", ");
        b.append("endDateTime=");
        b.append(this.endDateTime);
        b.append(", ");
        b.append("startDateTime=");
        b.append(this.startDateTime);
        b.append(", ");
        b.append("timeOffReasonId=");
        b.append(this.timeOffReasonId);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy