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

odata.msgraph.client.security.entity.RetentionEvent Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package odata.msgraph.client.security.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.CollectionPage;
import com.github.davidmoten.odata.client.HttpRequestOptions;
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.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.time.OffsetDateTime;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import odata.msgraph.client.complex.IdentitySet;
import odata.msgraph.client.entity.Entity;
import odata.msgraph.client.security.complex.EventPropagationResult;
import odata.msgraph.client.security.complex.EventQuery;
import odata.msgraph.client.security.complex.RetentionEventStatus;
import odata.msgraph.client.security.entity.request.RetentionEventTypeRequest;

@JsonPropertyOrder({
    "@odata.type", 
    "createdBy", 
    "createdDateTime", 
    "description", 
    "displayName", 
    "eventPropagationResults", 
    "eventQueries", 
    "eventStatus", 
    "eventTriggerDateTime", 
    "lastModifiedBy", 
    "lastModifiedDateTime", 
    "lastStatusUpdateDateTime"})
@JsonInclude(Include.NON_NULL)
public class RetentionEvent extends Entity implements ODataEntityType {

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

    @JsonProperty("createdBy")
    protected IdentitySet createdBy;

    @JsonProperty("createdDateTime")
    protected OffsetDateTime createdDateTime;

    @JsonProperty("description")
    protected String description;

    @JsonProperty("displayName")
    protected String displayName;

    @JsonProperty("eventPropagationResults")
    protected List eventPropagationResults;

    @JsonProperty("eventPropagationResults@nextLink")
    protected String eventPropagationResultsNextLink;

    @JsonProperty("eventQueries")
    protected List eventQueries;

    @JsonProperty("eventQueries@nextLink")
    protected String eventQueriesNextLink;

    @JsonProperty("eventStatus")
    protected RetentionEventStatus eventStatus;

    @JsonProperty("eventTriggerDateTime")
    protected OffsetDateTime eventTriggerDateTime;

    @JsonProperty("lastModifiedBy")
    protected IdentitySet lastModifiedBy;

    @JsonProperty("lastModifiedDateTime")
    protected OffsetDateTime lastModifiedDateTime;

    @JsonProperty("lastStatusUpdateDateTime")
    protected OffsetDateTime lastStatusUpdateDateTime;

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

    public static final class Builder {
        private String id;
        private IdentitySet createdBy;
        private OffsetDateTime createdDateTime;
        private String description;
        private String displayName;
        private List eventPropagationResults;
        private String eventPropagationResultsNextLink;
        private List eventQueries;
        private String eventQueriesNextLink;
        private RetentionEventStatus eventStatus;
        private OffsetDateTime eventTriggerDateTime;
        private IdentitySet lastModifiedBy;
        private OffsetDateTime lastModifiedDateTime;
        private OffsetDateTime lastStatusUpdateDateTime;
        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 description(String description) {
            this.description = description;
            this.changedFields = changedFields.add("description");
            return this;
        }

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

        public Builder eventPropagationResults(List eventPropagationResults) {
            this.eventPropagationResults = eventPropagationResults;
            this.changedFields = changedFields.add("eventPropagationResults");
            return this;
        }

        public Builder eventPropagationResults(EventPropagationResult... eventPropagationResults) {
            return eventPropagationResults(Arrays.asList(eventPropagationResults));
        }

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

        public Builder eventQueries(List eventQueries) {
            this.eventQueries = eventQueries;
            this.changedFields = changedFields.add("eventQueries");
            return this;
        }

        public Builder eventQueries(EventQuery... eventQueries) {
            return eventQueries(Arrays.asList(eventQueries));
        }

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

        public Builder eventStatus(RetentionEventStatus eventStatus) {
            this.eventStatus = eventStatus;
            this.changedFields = changedFields.add("eventStatus");
            return this;
        }

        public Builder eventTriggerDateTime(OffsetDateTime eventTriggerDateTime) {
            this.eventTriggerDateTime = eventTriggerDateTime;
            this.changedFields = changedFields.add("eventTriggerDateTime");
            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 lastStatusUpdateDateTime(OffsetDateTime lastStatusUpdateDateTime) {
            this.lastStatusUpdateDateTime = lastStatusUpdateDateTime;
            this.changedFields = changedFields.add("lastStatusUpdateDateTime");
            return this;
        }

        public RetentionEvent build() {
            RetentionEvent _x = new RetentionEvent();
            _x.contextPath = null;
            _x.changedFields = changedFields;
            _x.unmappedFields = new UnmappedFieldsImpl();
            _x.odataType = "microsoft.graph.security.retentionEvent";
            _x.id = id;
            _x.createdBy = createdBy;
            _x.createdDateTime = createdDateTime;
            _x.description = description;
            _x.displayName = displayName;
            _x.eventPropagationResults = eventPropagationResults;
            _x.eventPropagationResultsNextLink = eventPropagationResultsNextLink;
            _x.eventQueries = eventQueries;
            _x.eventQueriesNextLink = eventQueriesNextLink;
            _x.eventStatus = eventStatus;
            _x.eventTriggerDateTime = eventTriggerDateTime;
            _x.lastModifiedBy = lastModifiedBy;
            _x.lastModifiedDateTime = lastModifiedDateTime;
            _x.lastStatusUpdateDateTime = lastStatusUpdateDateTime;
            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));
        }
    }

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

    public RetentionEvent withCreatedBy(IdentitySet createdBy) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("createdBy");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.createdBy = createdBy;
        return _x;
    }

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

    public RetentionEvent withCreatedDateTime(OffsetDateTime createdDateTime) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("createdDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.createdDateTime = createdDateTime;
        return _x;
    }

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

    public RetentionEvent withDescription(String description) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("description");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.description = description;
        return _x;
    }

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

    public RetentionEvent withDisplayName(String displayName) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("displayName");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.displayName = displayName;
        return _x;
    }

    @Property(name="eventPropagationResults")
    @JsonIgnore
    public CollectionPage getEventPropagationResults() {
        return new CollectionPage(contextPath, EventPropagationResult.class, this.eventPropagationResults, Optional.ofNullable(eventPropagationResultsNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
    }

    public RetentionEvent withEventPropagationResults(List eventPropagationResults) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("eventPropagationResults");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.eventPropagationResults = eventPropagationResults;
        return _x;
    }

    @Property(name="eventPropagationResults")
    @JsonIgnore
    public CollectionPage getEventPropagationResults(HttpRequestOptions options) {
        return new CollectionPage(contextPath, EventPropagationResult.class, this.eventPropagationResults, Optional.ofNullable(eventPropagationResultsNextLink), Collections.emptyList(), options);
    }

    @Property(name="eventQueries")
    @JsonIgnore
    public CollectionPage getEventQueries() {
        return new CollectionPage(contextPath, EventQuery.class, this.eventQueries, Optional.ofNullable(eventQueriesNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
    }

    public RetentionEvent withEventQueries(List eventQueries) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("eventQueries");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.eventQueries = eventQueries;
        return _x;
    }

    @Property(name="eventQueries")
    @JsonIgnore
    public CollectionPage getEventQueries(HttpRequestOptions options) {
        return new CollectionPage(contextPath, EventQuery.class, this.eventQueries, Optional.ofNullable(eventQueriesNextLink), Collections.emptyList(), options);
    }

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

    public RetentionEvent withEventStatus(RetentionEventStatus eventStatus) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("eventStatus");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.eventStatus = eventStatus;
        return _x;
    }

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

    public RetentionEvent withEventTriggerDateTime(OffsetDateTime eventTriggerDateTime) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("eventTriggerDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.eventTriggerDateTime = eventTriggerDateTime;
        return _x;
    }

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

    public RetentionEvent withLastModifiedBy(IdentitySet lastModifiedBy) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("lastModifiedBy");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.lastModifiedBy = lastModifiedBy;
        return _x;
    }

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

    public RetentionEvent withLastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("lastModifiedDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.lastModifiedDateTime = lastModifiedDateTime;
        return _x;
    }

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

    public RetentionEvent withLastStatusUpdateDateTime(OffsetDateTime lastStatusUpdateDateTime) {
        RetentionEvent _x = _copy();
        _x.changedFields = changedFields.add("lastStatusUpdateDateTime");
        _x.odataType = Util.nvl(odataType, "microsoft.graph.security.retentionEvent");
        _x.lastStatusUpdateDateTime = lastStatusUpdateDateTime;
        return _x;
    }

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

    @NavigationProperty(name="retentionEventType")
    @JsonIgnore
    public RetentionEventTypeRequest getRetentionEventType() {
        return new RetentionEventTypeRequest(contextPath.addSegment("retentionEventType"), RequestHelper.getValue(unmappedFields, "retentionEventType"));
    }

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

    private RetentionEvent _copy() {
        RetentionEvent _x = new RetentionEvent();
        _x.contextPath = contextPath;
        _x.changedFields = changedFields;
        _x.unmappedFields = unmappedFields.copy();
        _x.odataType = odataType;
        _x.id = id;
        _x.createdBy = createdBy;
        _x.createdDateTime = createdDateTime;
        _x.description = description;
        _x.displayName = displayName;
        _x.eventPropagationResults = eventPropagationResults;
        _x.eventQueries = eventQueries;
        _x.eventStatus = eventStatus;
        _x.eventTriggerDateTime = eventTriggerDateTime;
        _x.lastModifiedBy = lastModifiedBy;
        _x.lastModifiedDateTime = lastModifiedDateTime;
        _x.lastStatusUpdateDateTime = lastStatusUpdateDateTime;
        return _x;
    }

    @Override
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("RetentionEvent[");
        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("description=");
        b.append(this.description);
        b.append(", ");
        b.append("displayName=");
        b.append(this.displayName);
        b.append(", ");
        b.append("eventPropagationResults=");
        b.append(this.eventPropagationResults);
        b.append(", ");
        b.append("eventQueries=");
        b.append(this.eventQueries);
        b.append(", ");
        b.append("eventStatus=");
        b.append(this.eventStatus);
        b.append(", ");
        b.append("eventTriggerDateTime=");
        b.append(this.eventTriggerDateTime);
        b.append(", ");
        b.append("lastModifiedBy=");
        b.append(this.lastModifiedBy);
        b.append(", ");
        b.append("lastModifiedDateTime=");
        b.append(this.lastModifiedDateTime);
        b.append(", ");
        b.append("lastStatusUpdateDateTime=");
        b.append(this.lastStatusUpdateDateTime);
        b.append("]");
        b.append(",unmappedFields=");
        b.append(unmappedFields);
        b.append(",odataType=");
        b.append(odataType);
        return b.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy