odata.msgraph.client.entity.UserInstallStateSummary Maven / Gradle / Ivy
Show all versions of odata-client-msgraph Show documentation
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.Integer;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import odata.msgraph.client.entity.collection.request.DeviceInstallStateCollectionRequest;
/**
* “Contains properties for the installation state summary for a user.”
*/@JsonPropertyOrder({
"@odata.type",
"failedDeviceCount",
"installedDeviceCount",
"notInstalledDeviceCount",
"userName",
"deviceStates"})
@JsonInclude(Include.NON_NULL)
public class UserInstallStateSummary extends Entity implements ODataEntityType {
@Override
public String odataTypeName() {
return "microsoft.graph.userInstallStateSummary";
}
@JsonProperty("failedDeviceCount")
protected Integer failedDeviceCount;
@JsonProperty("installedDeviceCount")
protected Integer installedDeviceCount;
@JsonProperty("notInstalledDeviceCount")
protected Integer notInstalledDeviceCount;
@JsonProperty("userName")
protected String userName;
@JsonProperty("deviceStates")
protected List deviceStates;
protected UserInstallStateSummary() {
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 builderUserInstallStateSummary() {
return new Builder();
}
public static final class Builder {
private String id;
private Integer failedDeviceCount;
private Integer installedDeviceCount;
private Integer notInstalledDeviceCount;
private String userName;
private List deviceStates;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder id(String id) {
this.id = id;
this.changedFields = changedFields.add("id");
return this;
}
/**
* “Failed Device Count.”
*
* @param failedDeviceCount
* value of {@code failedDeviceCount} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder failedDeviceCount(Integer failedDeviceCount) {
this.failedDeviceCount = failedDeviceCount;
this.changedFields = changedFields.add("failedDeviceCount");
return this;
}
/**
* “Installed Device Count.”
*
* @param installedDeviceCount
* value of {@code installedDeviceCount} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder installedDeviceCount(Integer installedDeviceCount) {
this.installedDeviceCount = installedDeviceCount;
this.changedFields = changedFields.add("installedDeviceCount");
return this;
}
/**
* “Not installed device count.”
*
* @param notInstalledDeviceCount
* value of {@code notInstalledDeviceCount} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder notInstalledDeviceCount(Integer notInstalledDeviceCount) {
this.notInstalledDeviceCount = notInstalledDeviceCount;
this.changedFields = changedFields.add("notInstalledDeviceCount");
return this;
}
/**
* “User name.”
*
* @param userName
* value of {@code userName} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder userName(String userName) {
this.userName = userName;
this.changedFields = changedFields.add("userName");
return this;
}
/**
* “The install state of the eBook.”
*
* @param deviceStates
* value of {@code deviceStates} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder deviceStates(List deviceStates) {
this.deviceStates = deviceStates;
this.changedFields = changedFields.add("deviceStates");
return this;
}
/**
* “The install state of the eBook.”
*
* @param deviceStates
* value of {@code deviceStates} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder deviceStates(DeviceInstallState... deviceStates) {
return deviceStates(Arrays.asList(deviceStates));
}
public UserInstallStateSummary build() {
UserInstallStateSummary _x = new UserInstallStateSummary();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = new UnmappedFieldsImpl();
_x.odataType = "microsoft.graph.userInstallStateSummary";
_x.id = id;
_x.failedDeviceCount = failedDeviceCount;
_x.installedDeviceCount = installedDeviceCount;
_x.notInstalledDeviceCount = notInstalledDeviceCount;
_x.userName = userName;
_x.deviceStates = deviceStates;
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));
}
}
/**
* “Failed Device Count.”
*
* @return property failedDeviceCount
*/
@Property(name="failedDeviceCount")
@JsonIgnore
public Optional getFailedDeviceCount() {
return Optional.ofNullable(failedDeviceCount);
}
/**
* Returns an immutable copy of {@code this} with just the {@code failedDeviceCount
* } 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.
*
* “Failed Device Count.”
*
* @param failedDeviceCount
* new value of {@code failedDeviceCount} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code failedDeviceCount} field changed
*/
public UserInstallStateSummary withFailedDeviceCount(Integer failedDeviceCount) {
UserInstallStateSummary _x = _copy();
_x.changedFields = changedFields.add("failedDeviceCount");
_x.odataType = Util.nvl(odataType, "microsoft.graph.userInstallStateSummary");
_x.failedDeviceCount = failedDeviceCount;
return _x;
}
/**
* “Installed Device Count.”
*
* @return property installedDeviceCount
*/
@Property(name="installedDeviceCount")
@JsonIgnore
public Optional getInstalledDeviceCount() {
return Optional.ofNullable(installedDeviceCount);
}
/**
* Returns an immutable copy of {@code this} with just the {@code
* installedDeviceCount} 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.
*
* “Installed Device Count.”
*
* @param installedDeviceCount
* new value of {@code installedDeviceCount} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code installedDeviceCount} field changed
*/
public UserInstallStateSummary withInstalledDeviceCount(Integer installedDeviceCount) {
UserInstallStateSummary _x = _copy();
_x.changedFields = changedFields.add("installedDeviceCount");
_x.odataType = Util.nvl(odataType, "microsoft.graph.userInstallStateSummary");
_x.installedDeviceCount = installedDeviceCount;
return _x;
}
/**
* “Not installed device count.”
*
* @return property notInstalledDeviceCount
*/
@Property(name="notInstalledDeviceCount")
@JsonIgnore
public Optional getNotInstalledDeviceCount() {
return Optional.ofNullable(notInstalledDeviceCount);
}
/**
* Returns an immutable copy of {@code this} with just the {@code
* notInstalledDeviceCount} 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.
*
* “Not installed device count.”
*
* @param notInstalledDeviceCount
* new value of {@code notInstalledDeviceCount} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code notInstalledDeviceCount} field changed
*/
public UserInstallStateSummary withNotInstalledDeviceCount(Integer notInstalledDeviceCount) {
UserInstallStateSummary _x = _copy();
_x.changedFields = changedFields.add("notInstalledDeviceCount");
_x.odataType = Util.nvl(odataType, "microsoft.graph.userInstallStateSummary");
_x.notInstalledDeviceCount = notInstalledDeviceCount;
return _x;
}
/**
* “User name.”
*
* @return property userName
*/
@Property(name="userName")
@JsonIgnore
public Optional getUserName() {
return Optional.ofNullable(userName);
}
/**
* Returns an immutable copy of {@code this} with just the {@code userName} 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.
*
* “User name.”
*
* @param userName
* new value of {@code userName} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code userName} field changed
*/
public UserInstallStateSummary withUserName(String userName) {
UserInstallStateSummary _x = _copy();
_x.changedFields = changedFields.add("userName");
_x.odataType = Util.nvl(odataType, "microsoft.graph.userInstallStateSummary");
_x.userName = userName;
return _x;
}
public UserInstallStateSummary withUnmappedField(String name, Object value) {
UserInstallStateSummary _x = _copy();
_x.setUnmappedField(name, value);
return _x;
}
/**
* “The install state of the eBook.”
*
* @return navigational property deviceStates
*/
@NavigationProperty(name="deviceStates")
@JsonIgnore
public DeviceInstallStateCollectionRequest getDeviceStates() {
return new DeviceInstallStateCollectionRequest(
contextPath.addSegment("deviceStates"), Optional.ofNullable(deviceStates));
}
/**
* Returns an immutable copy of {@code this} with just the {@code deviceStates}
* 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.
*
* “The install state of the eBook.”
*
* @param deviceStates
* new value of {@code deviceStates} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code deviceStates} field changed
*/
public UserInstallStateSummary withDeviceStates(List deviceStates) {
UserInstallStateSummary _x = _copy();
_x.changedFields = changedFields.add("deviceStates");
_x.odataType = Util.nvl(odataType, "microsoft.graph.userInstallStateSummary");
_x.deviceStates = deviceStates;
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 UserInstallStateSummary patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
UserInstallStateSummary _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 UserInstallStateSummary put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
UserInstallStateSummary _x = _copy();
_x.changedFields = null;
return _x;
}
private UserInstallStateSummary _copy() {
UserInstallStateSummary _x = new UserInstallStateSummary();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields.copy();
_x.odataType = odataType;
_x.id = id;
_x.failedDeviceCount = failedDeviceCount;
_x.installedDeviceCount = installedDeviceCount;
_x.notInstalledDeviceCount = notInstalledDeviceCount;
_x.userName = userName;
_x.deviceStates = deviceStates;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("UserInstallStateSummary[");
b.append("id=");
b.append(this.id);
b.append(", ");
b.append("failedDeviceCount=");
b.append(this.failedDeviceCount);
b.append(", ");
b.append("installedDeviceCount=");
b.append(this.installedDeviceCount);
b.append(", ");
b.append("notInstalledDeviceCount=");
b.append(this.notInstalledDeviceCount);
b.append(", ");
b.append("userName=");
b.append(this.userName);
b.append(", ");
b.append("deviceStates=");
b.append(this.deviceStates);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}