001
002package com.commercetools.api.models.message;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.annotation.Nullable;
009import javax.validation.constraints.NotNull;
010
011import com.commercetools.api.models.associate_role.Permission;
012import com.fasterxml.jackson.annotation.*;
013import com.fasterxml.jackson.databind.annotation.*;
014
015import io.vrap.rmf.base.client.utils.Generated;
016
017/**
018 *  <p>Generated after a successful Set Permissions update action.</p>
019 *
020 * <hr>
021 * Example to create an instance using the builder pattern
022 * <div class=code-example>
023 * <pre><code class='java'>
024 *     AssociateRolePermissionsSetMessage associateRolePermissionsSetMessage = AssociateRolePermissionsSetMessage.builder()
025 *             .id("{id}")
026 *             .version(0.3)
027 *             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
028 *             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
029 *             .sequenceNumber(0.3)
030 *             .resource(resourceBuilder -> resourceBuilder)
031 *             .resourceVersion(0.3)
032 *             .plusPermissions(permissionsBuilder -> permissionsBuilder)
033 *             .build()
034 * </code></pre>
035 * </div>
036 */
037@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
038@JsonDeserialize(as = AssociateRolePermissionsSetMessageImpl.class)
039public interface AssociateRolePermissionsSetMessage extends Message {
040
041    /**
042     * discriminator value for AssociateRolePermissionsSetMessage
043     */
044    String ASSOCIATE_ROLE_PERMISSIONS_SET = "AssociateRolePermissionsSet";
045
046    /**
047     *  <p>Permission assigned to the AssociateRole.</p>
048     * @return permissions
049     */
050    @NotNull
051    @JsonProperty("permissions")
052    public List<Permission> getPermissions();
053
054    /**
055     *  <p>Permission assigned to the AssociateRole.</p>
056     * @param permissions values to be set
057     */
058
059    @JsonIgnore
060    public void setPermissions(final Permission... permissions);
061
062    /**
063     *  <p>Permission assigned to the AssociateRole.</p>
064     * @param permissions values to be set
065     */
066
067    public void setPermissions(final List<Permission> permissions);
068
069    /**
070     * factory method
071     * @return instance of AssociateRolePermissionsSetMessage
072     */
073    public static AssociateRolePermissionsSetMessage of() {
074        return new AssociateRolePermissionsSetMessageImpl();
075    }
076
077    /**
078     * factory method to create a shallow copy AssociateRolePermissionsSetMessage
079     * @param template instance to be copied
080     * @return copy instance
081     */
082    public static AssociateRolePermissionsSetMessage of(final AssociateRolePermissionsSetMessage template) {
083        AssociateRolePermissionsSetMessageImpl instance = new AssociateRolePermissionsSetMessageImpl();
084        instance.setId(template.getId());
085        instance.setVersion(template.getVersion());
086        instance.setCreatedAt(template.getCreatedAt());
087        instance.setLastModifiedAt(template.getLastModifiedAt());
088        instance.setLastModifiedBy(template.getLastModifiedBy());
089        instance.setCreatedBy(template.getCreatedBy());
090        instance.setSequenceNumber(template.getSequenceNumber());
091        instance.setResource(template.getResource());
092        instance.setResourceVersion(template.getResourceVersion());
093        instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers());
094        instance.setPermissions(template.getPermissions());
095        return instance;
096    }
097
098    /**
099     * factory method to create a deep copy of AssociateRolePermissionsSetMessage
100     * @param template instance to be copied
101     * @return copy instance
102     */
103    @Nullable
104    public static AssociateRolePermissionsSetMessage deepCopy(
105            @Nullable final AssociateRolePermissionsSetMessage template) {
106        if (template == null) {
107            return null;
108        }
109        AssociateRolePermissionsSetMessageImpl instance = new AssociateRolePermissionsSetMessageImpl();
110        instance.setId(template.getId());
111        instance.setVersion(template.getVersion());
112        instance.setCreatedAt(template.getCreatedAt());
113        instance.setLastModifiedAt(template.getLastModifiedAt());
114        instance.setLastModifiedBy(
115            com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy()));
116        instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy()));
117        instance.setSequenceNumber(template.getSequenceNumber());
118        instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource()));
119        instance.setResourceVersion(template.getResourceVersion());
120        instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers
121                .deepCopy(template.getResourceUserProvidedIdentifiers()));
122        instance.setPermissions(Optional.ofNullable(template.getPermissions()).map(ArrayList::new).orElse(null));
123        return instance;
124    }
125
126    /**
127     * builder factory method for AssociateRolePermissionsSetMessage
128     * @return builder
129     */
130    public static AssociateRolePermissionsSetMessageBuilder builder() {
131        return AssociateRolePermissionsSetMessageBuilder.of();
132    }
133
134    /**
135     * create builder for AssociateRolePermissionsSetMessage instance
136     * @param template instance with prefilled values for the builder
137     * @return builder
138     */
139    public static AssociateRolePermissionsSetMessageBuilder builder(final AssociateRolePermissionsSetMessage template) {
140        return AssociateRolePermissionsSetMessageBuilder.of(template);
141    }
142
143    /**
144     * accessor map function
145     * @param <T> mapped type
146     * @param helper function to map the object
147     * @return mapped value
148     */
149    default <T> T withAssociateRolePermissionsSetMessage(Function<AssociateRolePermissionsSetMessage, T> helper) {
150        return helper.apply(this);
151    }
152
153    /**
154     * gives a TypeReference for usage with Jackson DataBind
155     * @return TypeReference
156     */
157    public static com.fasterxml.jackson.core.type.TypeReference<AssociateRolePermissionsSetMessage> typeReference() {
158        return new com.fasterxml.jackson.core.type.TypeReference<AssociateRolePermissionsSetMessage>() {
159            @Override
160            public String toString() {
161                return "TypeReference<AssociateRolePermissionsSetMessage>";
162            }
163        };
164    }
165}