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

microsoft.dynamics.crm.entity.Postcomment Maven / Gradle / Ivy

The newest version!
package microsoft.dynamics.crm.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.time.OffsetDateTime;
import java.util.Optional;
import java.util.UUID;

import microsoft.dynamics.crm.entity.request.OrganizationRequest;
import microsoft.dynamics.crm.entity.request.PostRequest;
import microsoft.dynamics.crm.entity.request.SystemuserRequest;

@JsonPropertyOrder({
    "@odata.type", 
    "text", 
    "timezoneruleversionnumber", 
    "utcconversiontimezonecode", 
    "_organizationid_value", 
    "_createdonbehalfby_value", 
    "_createdby_value", 
    "_postid_value", 
    "postcommentid", 
    "createdon"})
@JsonInclude(Include.NON_NULL)
public class Postcomment extends Crmbaseentity implements ODataEntityType {

    @Override
    public String odataTypeName() {
        return "Microsoft.Dynamics.CRM.postcomment";
    }

    @JsonProperty("text")
    protected String text;

    @JsonProperty("timezoneruleversionnumber")
    protected Integer timezoneruleversionnumber;

    @JsonProperty("utcconversiontimezonecode")
    protected Integer utcconversiontimezonecode;

    @JsonProperty("_organizationid_value")
    protected UUID _organizationid_value;

    @JsonProperty("_createdonbehalfby_value")
    protected UUID _createdonbehalfby_value;

    @JsonProperty("_createdby_value")
    protected UUID _createdby_value;

    @JsonProperty("_postid_value")
    protected UUID _postid_value;

    @JsonProperty("postcommentid")
    protected UUID postcommentid;

    @JsonProperty("createdon")
    protected OffsetDateTime createdon;

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

    public static final class Builder {
        private String text;
        private Integer timezoneruleversionnumber;
        private Integer utcconversiontimezonecode;
        private UUID _organizationid_value;
        private UUID _createdonbehalfby_value;
        private UUID _createdby_value;
        private UUID _postid_value;
        private UUID postcommentid;
        private OffsetDateTime createdon;
        private ChangedFields changedFields = ChangedFields.EMPTY;

        Builder() {
            // prevent instantiation
        }

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

        public Builder timezoneruleversionnumber(Integer timezoneruleversionnumber) {
            this.timezoneruleversionnumber = timezoneruleversionnumber;
            this.changedFields = changedFields.add("timezoneruleversionnumber");
            return this;
        }

        public Builder utcconversiontimezonecode(Integer utcconversiontimezonecode) {
            this.utcconversiontimezonecode = utcconversiontimezonecode;
            this.changedFields = changedFields.add("utcconversiontimezonecode");
            return this;
        }

        public Builder _organizationid_value(UUID _organizationid_value) {
            this._organizationid_value = _organizationid_value;
            this.changedFields = changedFields.add("_organizationid_value");
            return this;
        }

        public Builder _createdonbehalfby_value(UUID _createdonbehalfby_value) {
            this._createdonbehalfby_value = _createdonbehalfby_value;
            this.changedFields = changedFields.add("_createdonbehalfby_value");
            return this;
        }

        public Builder _createdby_value(UUID _createdby_value) {
            this._createdby_value = _createdby_value;
            this.changedFields = changedFields.add("_createdby_value");
            return this;
        }

        public Builder _postid_value(UUID _postid_value) {
            this._postid_value = _postid_value;
            this.changedFields = changedFields.add("_postid_value");
            return this;
        }

        public Builder postcommentid(UUID postcommentid) {
            this.postcommentid = postcommentid;
            this.changedFields = changedFields.add("postcommentid");
            return this;
        }

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

        public Postcomment build() {
            Postcomment _x = new Postcomment();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "Microsoft.Dynamics.CRM.postcomment";
            _x.text = text;
            _x.timezoneruleversionnumber = timezoneruleversionnumber;
            _x.utcconversiontimezonecode = utcconversiontimezonecode;
            _x._organizationid_value = _organizationid_value;
            _x._createdonbehalfby_value = _createdonbehalfby_value;
            _x._createdby_value = _createdby_value;
            _x._postid_value = _postid_value;
            _x.postcommentid = postcommentid;
            _x.createdon = createdon;
            return _x;
        }
    }

    @Override
    @JsonIgnore
    public ChangedFields getChangedFields() {
        return changedFields;
    }

    @Override
    public void postInject(boolean addKeysToContextPath) {
        if (addKeysToContextPath && postcommentid != null) {
            contextPath = contextPath.clearQueries().addKeys(new NameValue(postcommentid, UUID.class));
        }
    }

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

    public Postcomment withText(String text) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("text");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x.text = text;
        return _x;
    }

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

    public Postcomment withTimezoneruleversionnumber(Integer timezoneruleversionnumber) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("timezoneruleversionnumber");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x.timezoneruleversionnumber = timezoneruleversionnumber;
        return _x;
    }

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

    public Postcomment withUtcconversiontimezonecode(Integer utcconversiontimezonecode) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("utcconversiontimezonecode");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x.utcconversiontimezonecode = utcconversiontimezonecode;
        return _x;
    }

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

    public Postcomment with_organizationid_value(UUID _organizationid_value) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("_organizationid_value");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x._organizationid_value = _organizationid_value;
        return _x;
    }

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

    public Postcomment with_createdonbehalfby_value(UUID _createdonbehalfby_value) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("_createdonbehalfby_value");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x._createdonbehalfby_value = _createdonbehalfby_value;
        return _x;
    }

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

    public Postcomment with_createdby_value(UUID _createdby_value) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("_createdby_value");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x._createdby_value = _createdby_value;
        return _x;
    }

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

    public Postcomment with_postid_value(UUID _postid_value) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("_postid_value");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x._postid_value = _postid_value;
        return _x;
    }

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

    public Postcomment withPostcommentid(UUID postcommentid) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("postcommentid");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x.postcommentid = postcommentid;
        return _x;
    }

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

    public Postcomment withCreatedon(OffsetDateTime createdon) {
        Postcomment _x = _copy();
        _x.changedFields = changedFields.add("createdon");
        _x.odataType = Util.nvl(odataType, "Microsoft.Dynamics.CRM.postcomment");
        _x.createdon = createdon;
        return _x;
    }

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

    @NavigationProperty(name="createdby")
    @JsonIgnore
    public SystemuserRequest getCreatedby() {
        return new SystemuserRequest(contextPath.addSegment("createdby"), RequestHelper.getValue(unmappedFields, "createdby"));
    }

    @NavigationProperty(name="organizationid")
    @JsonIgnore
    public OrganizationRequest getOrganizationid() {
        return new OrganizationRequest(contextPath.addSegment("organizationid"), RequestHelper.getValue(unmappedFields, "organizationid"));
    }

    @NavigationProperty(name="createdonbehalfby")
    @JsonIgnore
    public SystemuserRequest getCreatedonbehalfby() {
        return new SystemuserRequest(contextPath.addSegment("createdonbehalfby"), RequestHelper.getValue(unmappedFields, "createdonbehalfby"));
    }

    @NavigationProperty(name="postid")
    @JsonIgnore
    public PostRequest getPostid() {
        return new PostRequest(contextPath.addSegment("postid"), RequestHelper.getValue(unmappedFields, "postid"));
    }

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

    private Postcomment _copy() {
        Postcomment _x = new Postcomment();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.text = text;
        _x.timezoneruleversionnumber = timezoneruleversionnumber;
        _x.utcconversiontimezonecode = utcconversiontimezonecode;
        _x._organizationid_value = _organizationid_value;
        _x._createdonbehalfby_value = _createdonbehalfby_value;
        _x._createdby_value = _createdby_value;
        _x._postid_value = _postid_value;
        _x.postcommentid = postcommentid;
        _x.createdon = createdon;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("Postcomment[");
        b.append("text=");
        b.append(this.text);
        b.append(", ");
        b.append("timezoneruleversionnumber=");
        b.append(this.timezoneruleversionnumber);
        b.append(", ");
        b.append("utcconversiontimezonecode=");
        b.append(this.utcconversiontimezonecode);
        b.append(", ");
        b.append("_organizationid_value=");
        b.append(this._organizationid_value);
        b.append(", ");
        b.append("_createdonbehalfby_value=");
        b.append(this._createdonbehalfby_value);
        b.append(", ");
        b.append("_createdby_value=");
        b.append(this._createdby_value);
        b.append(", ");
        b.append("_postid_value=");
        b.append(this._postid_value);
        b.append(", ");
        b.append("postcommentid=");
        b.append(this.postcommentid);
        b.append(", ");
        b.append("createdon=");
        b.append(this.createdon);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy