odata.msgraph.client.beta.entity.NotificationMessageTemplate 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.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.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.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.Map;
import java.util.Optional;
import odata.msgraph.client.beta.entity.collection.request.LocalizedNotificationMessageCollectionRequest;
import odata.msgraph.client.beta.enums.NotificationTemplateBrandingOptions;
/**
* “Notification messages are messages that are sent to end users who are determined
* to be not-compliant with the compliance policies defined by the administrator.
* Administrators choose notifications and configure them in the Intune Admin
* Console using the compliance policy creation page under the “Actions for non-
* compliance” section. Use the notificationMessageTemplate object to create your
* own custom notifications for administrators to choose while configuring actions
* for non-compliance.”
*/@JsonPropertyOrder({
"@odata.type",
"brandingOptions",
"defaultLocale",
"displayName",
"lastModifiedDateTime",
"roleScopeTagIds"})
@JsonInclude(Include.NON_NULL)
public class NotificationMessageTemplate extends Entity implements ODataEntityType {
@Override
public String odataTypeName() {
return "microsoft.graph.notificationMessageTemplate";
}
@JsonProperty("brandingOptions")
protected NotificationTemplateBrandingOptions brandingOptions;
@JsonProperty("defaultLocale")
protected String defaultLocale;
@JsonProperty("displayName")
protected String displayName;
@JsonProperty("lastModifiedDateTime")
protected OffsetDateTime lastModifiedDateTime;
@JsonProperty("roleScopeTagIds")
protected List roleScopeTagIds;
@JsonProperty("roleScopeTagIds@nextLink")
protected String roleScopeTagIdsNextLink;
protected NotificationMessageTemplate() {
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 builderNotificationMessageTemplate() {
return new Builder();
}
public static final class Builder {
private String id;
private NotificationTemplateBrandingOptions brandingOptions;
private String defaultLocale;
private String displayName;
private OffsetDateTime lastModifiedDateTime;
private List roleScopeTagIds;
private String roleScopeTagIdsNextLink;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder id(String id) {
this.id = id;
this.changedFields = changedFields.add("id");
return this;
}
/**
* “The Message Template Branding Options. Branding is defined in the Intune Admin
* Console.”
*
* @param brandingOptions
* value of {@code brandingOptions} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder brandingOptions(NotificationTemplateBrandingOptions brandingOptions) {
this.brandingOptions = brandingOptions;
this.changedFields = changedFields.add("brandingOptions");
return this;
}
/**
* “The default locale to fallback onto when the requested locale is not available.”
*
* @param defaultLocale
* value of {@code defaultLocale} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder defaultLocale(String defaultLocale) {
this.defaultLocale = defaultLocale;
this.changedFields = changedFields.add("defaultLocale");
return this;
}
/**
* “Display name for the Notification Message Template.”
*
* @param displayName
* value of {@code displayName} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder displayName(String displayName) {
this.displayName = displayName;
this.changedFields = changedFields.add("displayName");
return this;
}
/**
* “DateTime the object was last modified.”
*
* @param lastModifiedDateTime
* value of {@code lastModifiedDateTime} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder lastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
this.lastModifiedDateTime = lastModifiedDateTime;
this.changedFields = changedFields.add("lastModifiedDateTime");
return this;
}
/**
* “List of Scope Tags for this Entity instance.”
*
* @param roleScopeTagIds
* value of {@code roleScopeTagIds} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder roleScopeTagIds(List roleScopeTagIds) {
this.roleScopeTagIds = roleScopeTagIds;
this.changedFields = changedFields.add("roleScopeTagIds");
return this;
}
/**
* “List of Scope Tags for this Entity instance.”
*
* @param roleScopeTagIds
* value of {@code roleScopeTagIds} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder roleScopeTagIds(String... roleScopeTagIds) {
return roleScopeTagIds(Arrays.asList(roleScopeTagIds));
}
/**
* “List of Scope Tags for this Entity instance.”
*
* @param roleScopeTagIdsNextLink
* value of {@code roleScopeTagIds@nextLink} property (as defined in service metadata)
* @return {@code this} (for method chaining)
*/
public Builder roleScopeTagIdsNextLink(String roleScopeTagIdsNextLink) {
this.roleScopeTagIdsNextLink = roleScopeTagIdsNextLink;
this.changedFields = changedFields.add("roleScopeTagIds");
return this;
}
public NotificationMessageTemplate build() {
NotificationMessageTemplate _x = new NotificationMessageTemplate();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = new UnmappedFieldsImpl();
_x.odataType = "microsoft.graph.notificationMessageTemplate";
_x.id = id;
_x.brandingOptions = brandingOptions;
_x.defaultLocale = defaultLocale;
_x.displayName = displayName;
_x.lastModifiedDateTime = lastModifiedDateTime;
_x.roleScopeTagIds = roleScopeTagIds;
_x.roleScopeTagIdsNextLink = roleScopeTagIdsNextLink;
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()));
}
}
/**
* “The Message Template Branding Options. Branding is defined in the Intune Admin
* Console.”
*
* @return property brandingOptions
*/
@Property(name="brandingOptions")
@JsonIgnore
public Optional getBrandingOptions() {
return Optional.ofNullable(brandingOptions);
}
/**
* Returns an immutable copy of {@code this} with just the {@code brandingOptions}
* 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 Message Template Branding Options. Branding is defined in the Intune Admin
* Console.”
*
* @param brandingOptions
* new value of {@code brandingOptions} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code brandingOptions} field changed
*/
public NotificationMessageTemplate withBrandingOptions(NotificationTemplateBrandingOptions brandingOptions) {
NotificationMessageTemplate _x = _copy();
_x.changedFields = changedFields.add("brandingOptions");
_x.odataType = Util.nvl(odataType, "microsoft.graph.notificationMessageTemplate");
_x.brandingOptions = brandingOptions;
return _x;
}
/**
* “The default locale to fallback onto when the requested locale is not available.”
*
* @return property defaultLocale
*/
@Property(name="defaultLocale")
@JsonIgnore
public Optional getDefaultLocale() {
return Optional.ofNullable(defaultLocale);
}
/**
* Returns an immutable copy of {@code this} with just the {@code defaultLocale}
* 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 default locale to fallback onto when the requested locale is not available.”
*
* @param defaultLocale
* new value of {@code defaultLocale} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code defaultLocale} field changed
*/
public NotificationMessageTemplate withDefaultLocale(String defaultLocale) {
NotificationMessageTemplate _x = _copy();
_x.changedFields = changedFields.add("defaultLocale");
_x.odataType = Util.nvl(odataType, "microsoft.graph.notificationMessageTemplate");
_x.defaultLocale = defaultLocale;
return _x;
}
/**
* “Display name for the Notification Message Template.”
*
* @return property displayName
*/
@Property(name="displayName")
@JsonIgnore
public Optional getDisplayName() {
return Optional.ofNullable(displayName);
}
/**
* Returns an immutable copy of {@code this} with just the {@code displayName}
* 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.
*
* “Display name for the Notification Message Template.”
*
* @param displayName
* new value of {@code displayName} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code displayName} field changed
*/
public NotificationMessageTemplate withDisplayName(String displayName) {
NotificationMessageTemplate _x = _copy();
_x.changedFields = changedFields.add("displayName");
_x.odataType = Util.nvl(odataType, "microsoft.graph.notificationMessageTemplate");
_x.displayName = displayName;
return _x;
}
/**
* “DateTime the object was last modified.”
*
* @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.
*
* “DateTime the object was last modified.”
*
* @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 NotificationMessageTemplate withLastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
NotificationMessageTemplate _x = _copy();
_x.changedFields = changedFields.add("lastModifiedDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.notificationMessageTemplate");
_x.lastModifiedDateTime = lastModifiedDateTime;
return _x;
}
/**
* “List of Scope Tags for this Entity instance.”
*
* @return property roleScopeTagIds
*/
@Property(name="roleScopeTagIds")
@JsonIgnore
public CollectionPage getRoleScopeTagIds() {
return new CollectionPage(contextPath, String.class, this.roleScopeTagIds, Optional.ofNullable(roleScopeTagIdsNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
}
/**
* Returns an immutable copy of {@code this} with just the {@code roleScopeTagIds}
* 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.
*
* “List of Scope Tags for this Entity instance.”
*
* @param roleScopeTagIds
* new value of {@code roleScopeTagIds} field (as defined in service metadata)
* @return immutable copy of {@code this} with just the {@code roleScopeTagIds} field changed
*/
public NotificationMessageTemplate withRoleScopeTagIds(List roleScopeTagIds) {
NotificationMessageTemplate _x = _copy();
_x.changedFields = changedFields.add("roleScopeTagIds");
_x.odataType = Util.nvl(odataType, "microsoft.graph.notificationMessageTemplate");
_x.roleScopeTagIds = roleScopeTagIds;
return _x;
}
/**
* “List of Scope Tags for this Entity instance.”
*
* @param options
* specify connect and read timeouts
* @return property roleScopeTagIds
*/
@Property(name="roleScopeTagIds")
@JsonIgnore
public CollectionPage getRoleScopeTagIds(HttpRequestOptions options) {
return new CollectionPage(contextPath, String.class, this.roleScopeTagIds, Optional.ofNullable(roleScopeTagIdsNextLink), Collections.emptyList(), options);
}
public NotificationMessageTemplate withUnmappedField(String name, String value) {
NotificationMessageTemplate _x = _copy();
_x.setUnmappedField(name, value);
return _x;
}
/**
* “The list of localized messages for this Notification Message Template.”
*
* @return navigational property localizedNotificationMessages
*/
@NavigationProperty(name="localizedNotificationMessages")
@JsonIgnore
public LocalizedNotificationMessageCollectionRequest getLocalizedNotificationMessages() {
return new LocalizedNotificationMessageCollectionRequest(
contextPath.addSegment("localizedNotificationMessages"), RequestHelper.getValue(unmappedFields, "localizedNotificationMessages"));
}
@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 NotificationMessageTemplate patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
NotificationMessageTemplate _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 NotificationMessageTemplate put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
NotificationMessageTemplate _x = _copy();
_x.changedFields = null;
return _x;
}
private NotificationMessageTemplate _copy() {
NotificationMessageTemplate _x = new NotificationMessageTemplate();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields.copy();
_x.odataType = odataType;
_x.id = id;
_x.brandingOptions = brandingOptions;
_x.defaultLocale = defaultLocale;
_x.displayName = displayName;
_x.lastModifiedDateTime = lastModifiedDateTime;
_x.roleScopeTagIds = roleScopeTagIds;
return _x;
}
@Action(name = "sendTestMessage")
@JsonIgnore
public ActionRequestNoReturn sendTestMessage() {
Map _parameters = ParameterMap.empty();
return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.sendTestMessage"), _parameters);
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("NotificationMessageTemplate[");
b.append("id=");
b.append(this.id);
b.append(", ");
b.append("brandingOptions=");
b.append(this.brandingOptions);
b.append(", ");
b.append("defaultLocale=");
b.append(this.defaultLocale);
b.append(", ");
b.append("displayName=");
b.append(this.displayName);
b.append(", ");
b.append("lastModifiedDateTime=");
b.append(this.lastModifiedDateTime);
b.append(", ");
b.append("roleScopeTagIds=");
b.append(this.roleScopeTagIds);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}