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

odata.msgraph.client.entity.Printer Maven / Gradle / Ivy

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.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.NavigationProperty;
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.Boolean;
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.complex.PrinterCapabilities;
import odata.msgraph.client.complex.PrinterDefaults;
import odata.msgraph.client.complex.PrinterLocation;
import odata.msgraph.client.complex.PrinterStatus;
import odata.msgraph.client.entity.collection.request.PrintConnectorCollectionRequest;
import odata.msgraph.client.entity.collection.request.PrintTaskTriggerCollectionRequest;
import odata.msgraph.client.entity.collection.request.PrinterShareCollectionRequest;

@JsonPropertyOrder({
    "@odata.type", 
    "hasPhysicalDevice", 
    "isShared", 
    "lastSeenDateTime", 
    "registeredDateTime"})
@JsonInclude(Include.NON_NULL)
public class Printer extends PrinterBase implements ODataEntityType {

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

    @JsonProperty("hasPhysicalDevice")
    protected Boolean hasPhysicalDevice;

    @JsonProperty("isShared")
    protected Boolean isShared;

    @JsonProperty("lastSeenDateTime")
    protected OffsetDateTime lastSeenDateTime;

    @JsonProperty("registeredDateTime")
    protected OffsetDateTime registeredDateTime;

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

    public static final class Builder {
        private String id;
        private PrinterCapabilities capabilities;
        private PrinterDefaults defaults;
        private String displayName;
        private Boolean isAcceptingJobs;
        private PrinterLocation location;
        private String manufacturer;
        private String model;
        private PrinterStatus status;
        private Boolean hasPhysicalDevice;
        private Boolean isShared;
        private OffsetDateTime lastSeenDateTime;
        private OffsetDateTime registeredDateTime;
        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 capabilities(PrinterCapabilities capabilities) {
            this.capabilities = capabilities;
            this.changedFields = changedFields.add("capabilities");
            return this;
        }

        public Builder defaults(PrinterDefaults defaults) {
            this.defaults = defaults;
            this.changedFields = changedFields.add("defaults");
            return this;
        }

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

        public Builder isAcceptingJobs(Boolean isAcceptingJobs) {
            this.isAcceptingJobs = isAcceptingJobs;
            this.changedFields = changedFields.add("isAcceptingJobs");
            return this;
        }

        public Builder location(PrinterLocation location) {
            this.location = location;
            this.changedFields = changedFields.add("location");
            return this;
        }

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

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

        public Builder status(PrinterStatus status) {
            this.status = status;
            this.changedFields = changedFields.add("status");
            return this;
        }

        public Builder hasPhysicalDevice(Boolean hasPhysicalDevice) {
            this.hasPhysicalDevice = hasPhysicalDevice;
            this.changedFields = changedFields.add("hasPhysicalDevice");
            return this;
        }

        public Builder isShared(Boolean isShared) {
            this.isShared = isShared;
            this.changedFields = changedFields.add("isShared");
            return this;
        }

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

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

        public Printer build() {
            Printer _x = new Printer();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.printer";
            _x.id = id;
            _x.capabilities = capabilities;
            _x.defaults = defaults;
            _x.displayName = displayName;
            _x.isAcceptingJobs = isAcceptingJobs;
            _x.location = location;
            _x.manufacturer = manufacturer;
            _x.model = model;
            _x.status = status;
            _x.hasPhysicalDevice = hasPhysicalDevice;
            _x.isShared = isShared;
            _x.lastSeenDateTime = lastSeenDateTime;
            _x.registeredDateTime = registeredDateTime;
            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="hasPhysicalDevice")
    @JsonIgnore
    public Optional getHasPhysicalDevice() {
        return Optional.ofNullable(hasPhysicalDevice);
    }

    public Printer withHasPhysicalDevice(Boolean hasPhysicalDevice) {
        Printer _x = _copy();
        _x.changedFields = changedFields.add("hasPhysicalDevice");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.printer");
        _x.hasPhysicalDevice = hasPhysicalDevice;
        return _x;
    }

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

    public Printer withIsShared(Boolean isShared) {
        Printer _x = _copy();
        _x.changedFields = changedFields.add("isShared");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.printer");
        _x.isShared = isShared;
        return _x;
    }

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

    public Printer withLastSeenDateTime(OffsetDateTime lastSeenDateTime) {
        Printer _x = _copy();
        _x.changedFields = changedFields.add("lastSeenDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.printer");
        _x.lastSeenDateTime = lastSeenDateTime;
        return _x;
    }

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

    public Printer withRegisteredDateTime(OffsetDateTime registeredDateTime) {
        Printer _x = _copy();
        _x.changedFields = changedFields.add("registeredDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.printer");
        _x.registeredDateTime = registeredDateTime;
        return _x;
    }

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

    @NavigationProperty(name="connectors")
    @JsonIgnore
    public PrintConnectorCollectionRequest getConnectors() {
        return new PrintConnectorCollectionRequest(
                        contextPath.addSegment("connectors"), RequestHelper.getValue(unmappedFields, "connectors"));
    }

    @NavigationProperty(name="shares")
    @JsonIgnore
    public PrinterShareCollectionRequest getShares() {
        return new PrinterShareCollectionRequest(
                        contextPath.addSegment("shares"), RequestHelper.getValue(unmappedFields, "shares"));
    }

    @NavigationProperty(name="taskTriggers")
    @JsonIgnore
    public PrintTaskTriggerCollectionRequest getTaskTriggers() {
        return new PrintTaskTriggerCollectionRequest(
                        contextPath.addSegment("taskTriggers"), RequestHelper.getValue(unmappedFields, "taskTriggers"));
    }

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

    private Printer _copy() {
        Printer _x = new Printer();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.capabilities = capabilities;
        _x.defaults = defaults;
        _x.displayName = displayName;
        _x.isAcceptingJobs = isAcceptingJobs;
        _x.location = location;
        _x.manufacturer = manufacturer;
        _x.model = model;
        _x.status = status;
        _x.hasPhysicalDevice = hasPhysicalDevice;
        _x.isShared = isShared;
        _x.lastSeenDateTime = lastSeenDateTime;
        _x.registeredDateTime = registeredDateTime;
        return _x;
    }

    @Action(name = "restoreFactoryDefaults")
    @JsonIgnore
    public ActionRequestNoReturn restoreFactoryDefaults() {
        Map _parameters = ParameterMap.empty();
        return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.restoreFactoryDefaults"), _parameters);
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Printer[");
        b.append("id=");
        b.append(this.id);
        b.append(", ");
        b.append("capabilities=");
        b.append(this.capabilities);
        b.append(", ");
        b.append("defaults=");
        b.append(this.defaults);
        b.append(", ");
        b.append("displayName=");
        b.append(this.displayName);
        b.append(", ");
        b.append("isAcceptingJobs=");
        b.append(this.isAcceptingJobs);
        b.append(", ");
        b.append("location=");
        b.append(this.location);
        b.append(", ");
        b.append("manufacturer=");
        b.append(this.manufacturer);
        b.append(", ");
        b.append("model=");
        b.append(this.model);
        b.append(", ");
        b.append("status=");
        b.append(this.status);
        b.append(", ");
        b.append("hasPhysicalDevice=");
        b.append(this.hasPhysicalDevice);
        b.append(", ");
        b.append("isShared=");
        b.append(this.isShared);
        b.append(", ");
        b.append("lastSeenDateTime=");
        b.append(this.lastSeenDateTime);
        b.append(", ");
        b.append("registeredDateTime=");
        b.append(this.registeredDateTime);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy