odata.msgraph.client.beta.entity.ChangeTrackedEntity Maven / Gradle / Ivy
Show all versions of odata-client-msgraph-beta Show documentation
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.ActionRequestNoReturn;
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.Action;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.ParameterMap;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.TypedObject;
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.Map;
import java.util.Optional;
import odata.msgraph.client.beta.complex.IdentitySet;
@JsonPropertyOrder({
"@odata.type",
"createdBy",
"createdDateTime",
"lastModifiedBy",
"lastModifiedDateTime"})
@JsonInclude(Include.NON_NULL)
public class ChangeTrackedEntity extends Entity implements ODataEntityType {
@Override
public String odataTypeName() {
return "microsoft.graph.changeTrackedEntity";
}
@JsonProperty("createdBy")
protected IdentitySet createdBy;
@JsonProperty("createdDateTime")
protected OffsetDateTime createdDateTime;
@JsonProperty("lastModifiedBy")
protected IdentitySet lastModifiedBy;
@JsonProperty("lastModifiedDateTime")
protected OffsetDateTime lastModifiedDateTime;
protected ChangeTrackedEntity() {
super();
}
@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="createdBy")
@JsonIgnore
public Optional getCreatedBy() {
return Optional.ofNullable(createdBy);
}
public ChangeTrackedEntity withCreatedBy(IdentitySet createdBy) {
ChangeTrackedEntity _x = _copy();
_x.changedFields = changedFields.add("createdBy");
_x.odataType = Util.nvl(odataType, "microsoft.graph.changeTrackedEntity");
_x.createdBy = createdBy;
return _x;
}
/**
*
* Org.OData.Core.V1.Computed
*
* true
*
* @return property createdDateTime
*/
@Property(name="createdDateTime")
@JsonIgnore
public Optional getCreatedDateTime() {
return Optional.ofNullable(createdDateTime);
}
/**
* Returns an immutable copy of {@code this} with just the {@code createdDateTime}
* field changed. Field description below. The field name is also added to an
* internal map of changed fields in the returned object so that when {@code this.
* patch()} is called (if available)on the returned object only the changed fields
* are submitted.
*
* Org.OData.Core.V1.Computed
*
* true
*
* @param createdDateTime
* new value of {@code createdDateTime} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code createdDateTime} field changed
*/
public ChangeTrackedEntity withCreatedDateTime(OffsetDateTime createdDateTime) {
ChangeTrackedEntity _x = _copy();
_x.changedFields = changedFields.add("createdDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.changeTrackedEntity");
_x.createdDateTime = createdDateTime;
return _x;
}
/**
*
* Org.OData.Core.V1.Computed
*
* true
*
* @return property lastModifiedBy
*/
@Property(name="lastModifiedBy")
@JsonIgnore
public Optional getLastModifiedBy() {
return Optional.ofNullable(lastModifiedBy);
}
/**
* Returns an immutable copy of {@code this} with just the {@code lastModifiedBy}
* field changed. Field description below. The field name is also added to an
* internal map of changed fields in the returned object so that when {@code this.
* patch()} is called (if available)on the returned object only the changed fields
* are submitted.
*
* Org.OData.Core.V1.Computed
*
* true
*
* @param lastModifiedBy
* new value of {@code lastModifiedBy} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code lastModifiedBy} field changed
*/
public ChangeTrackedEntity withLastModifiedBy(IdentitySet lastModifiedBy) {
ChangeTrackedEntity _x = _copy();
_x.changedFields = changedFields.add("lastModifiedBy");
_x.odataType = Util.nvl(odataType, "microsoft.graph.changeTrackedEntity");
_x.lastModifiedBy = lastModifiedBy;
return _x;
}
/**
*
* Org.OData.Core.V1.Computed
*
* true
*
* @return property lastModifiedDateTime
*/
@Property(name="lastModifiedDateTime")
@JsonIgnore
public Optional getLastModifiedDateTime() {
return Optional.ofNullable(lastModifiedDateTime);
}
/**
* Returns an immutable copy of {@code this} with just the {@code
* lastModifiedDateTime} field changed. Field description below. The field name is
* also added to an internal map of changed fields in the returned object so that
* when {@code this.patch()} is called (if available)on the returned object only
* the changed fields are submitted.
*
* Org.OData.Core.V1.Computed
*
* true
*
* @param lastModifiedDateTime
* new value of {@code lastModifiedDateTime} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code lastModifiedDateTime} field changed
*/
public ChangeTrackedEntity withLastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
ChangeTrackedEntity _x = _copy();
_x.changedFields = changedFields.add("lastModifiedDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.changeTrackedEntity");
_x.lastModifiedDateTime = lastModifiedDateTime;
return _x;
}
public ChangeTrackedEntity withUnmappedField(String name, String value) {
ChangeTrackedEntity _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 ChangeTrackedEntity patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
ChangeTrackedEntity _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 ChangeTrackedEntity put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
ChangeTrackedEntity _x = _copy();
_x.changedFields = null;
return _x;
}
private ChangeTrackedEntity _copy() {
ChangeTrackedEntity _x = new ChangeTrackedEntity();
_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;
return _x;
}
@Action(name = "stageForDeletion")
@JsonIgnore
public ActionRequestNoReturn stageForDeletion() {
Map _parameters = ParameterMap.empty();
return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.stageForDeletion"), _parameters);
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("ChangeTrackedEntity[");
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(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}