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.Valid; 010import javax.validation.constraints.NotNull; 011 012import com.commercetools.api.models.product.ProductProjection; 013import com.fasterxml.jackson.annotation.*; 014import com.fasterxml.jackson.databind.annotation.*; 015 016import io.vrap.rmf.base.client.utils.Generated; 017 018/** 019 * <p>Generated after a successful Delete Product request.</p> 020 * 021 * <hr> 022 * Example to create an instance using the builder pattern 023 * <div class=code-example> 024 * <pre><code class='java'> 025 * ProductDeletedMessage productDeletedMessage = ProductDeletedMessage.builder() 026 * .id("{id}") 027 * .version(0.3) 028 * .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 029 * .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z")) 030 * .sequenceNumber(0.3) 031 * .resource(resourceBuilder -> resourceBuilder) 032 * .resourceVersion(0.3) 033 * .plusRemovedImageUrls(removedImageUrlsBuilder -> removedImageUrlsBuilder) 034 * .build() 035 * </code></pre> 036 * </div> 037 */ 038@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 039@JsonDeserialize(as = ProductDeletedMessageImpl.class) 040public interface ProductDeletedMessage extends Message { 041 042 /** 043 * discriminator value for ProductDeletedMessage 044 */ 045 String PRODUCT_DELETED = "ProductDeleted"; 046 047 /** 048 * <p>List of image URLs that were removed during the Delete Product request.</p> 049 * @return removedImageUrls 050 */ 051 @NotNull 052 @JsonProperty("removedImageUrls") 053 public List<String> getRemovedImageUrls(); 054 055 /** 056 * <p>Current Product Projection of the deleted Product.</p> 057 * @return currentProjection 058 */ 059 @Valid 060 @JsonProperty("currentProjection") 061 public ProductProjection getCurrentProjection(); 062 063 /** 064 * <p>List of image URLs that were removed during the Delete Product request.</p> 065 * @param removedImageUrls values to be set 066 */ 067 068 @JsonIgnore 069 public void setRemovedImageUrls(final String... removedImageUrls); 070 071 /** 072 * <p>List of image URLs that were removed during the Delete Product request.</p> 073 * @param removedImageUrls values to be set 074 */ 075 076 public void setRemovedImageUrls(final List<String> removedImageUrls); 077 078 /** 079 * <p>Current Product Projection of the deleted Product.</p> 080 * @param currentProjection value to be set 081 */ 082 083 public void setCurrentProjection(final ProductProjection currentProjection); 084 085 /** 086 * factory method 087 * @return instance of ProductDeletedMessage 088 */ 089 public static ProductDeletedMessage of() { 090 return new ProductDeletedMessageImpl(); 091 } 092 093 /** 094 * factory method to create a shallow copy ProductDeletedMessage 095 * @param template instance to be copied 096 * @return copy instance 097 */ 098 public static ProductDeletedMessage of(final ProductDeletedMessage template) { 099 ProductDeletedMessageImpl instance = new ProductDeletedMessageImpl(); 100 instance.setId(template.getId()); 101 instance.setVersion(template.getVersion()); 102 instance.setCreatedAt(template.getCreatedAt()); 103 instance.setLastModifiedAt(template.getLastModifiedAt()); 104 instance.setLastModifiedBy(template.getLastModifiedBy()); 105 instance.setCreatedBy(template.getCreatedBy()); 106 instance.setSequenceNumber(template.getSequenceNumber()); 107 instance.setResource(template.getResource()); 108 instance.setResourceVersion(template.getResourceVersion()); 109 instance.setResourceUserProvidedIdentifiers(template.getResourceUserProvidedIdentifiers()); 110 instance.setRemovedImageUrls(template.getRemovedImageUrls()); 111 instance.setCurrentProjection(template.getCurrentProjection()); 112 return instance; 113 } 114 115 /** 116 * factory method to create a deep copy of ProductDeletedMessage 117 * @param template instance to be copied 118 * @return copy instance 119 */ 120 @Nullable 121 public static ProductDeletedMessage deepCopy(@Nullable final ProductDeletedMessage template) { 122 if (template == null) { 123 return null; 124 } 125 ProductDeletedMessageImpl instance = new ProductDeletedMessageImpl(); 126 instance.setId(template.getId()); 127 instance.setVersion(template.getVersion()); 128 instance.setCreatedAt(template.getCreatedAt()); 129 instance.setLastModifiedAt(template.getLastModifiedAt()); 130 instance.setLastModifiedBy( 131 com.commercetools.api.models.common.LastModifiedBy.deepCopy(template.getLastModifiedBy())); 132 instance.setCreatedBy(com.commercetools.api.models.common.CreatedBy.deepCopy(template.getCreatedBy())); 133 instance.setSequenceNumber(template.getSequenceNumber()); 134 instance.setResource(com.commercetools.api.models.common.Reference.deepCopy(template.getResource())); 135 instance.setResourceVersion(template.getResourceVersion()); 136 instance.setResourceUserProvidedIdentifiers(com.commercetools.api.models.message.UserProvidedIdentifiers 137 .deepCopy(template.getResourceUserProvidedIdentifiers())); 138 instance.setRemovedImageUrls( 139 Optional.ofNullable(template.getRemovedImageUrls()).map(ArrayList::new).orElse(null)); 140 instance.setCurrentProjection( 141 com.commercetools.api.models.product.ProductProjection.deepCopy(template.getCurrentProjection())); 142 return instance; 143 } 144 145 /** 146 * builder factory method for ProductDeletedMessage 147 * @return builder 148 */ 149 public static ProductDeletedMessageBuilder builder() { 150 return ProductDeletedMessageBuilder.of(); 151 } 152 153 /** 154 * create builder for ProductDeletedMessage instance 155 * @param template instance with prefilled values for the builder 156 * @return builder 157 */ 158 public static ProductDeletedMessageBuilder builder(final ProductDeletedMessage template) { 159 return ProductDeletedMessageBuilder.of(template); 160 } 161 162 /** 163 * accessor map function 164 * @param <T> mapped type 165 * @param helper function to map the object 166 * @return mapped value 167 */ 168 default <T> T withProductDeletedMessage(Function<ProductDeletedMessage, T> helper) { 169 return helper.apply(this); 170 } 171 172 /** 173 * gives a TypeReference for usage with Jackson DataBind 174 * @return TypeReference 175 */ 176 public static com.fasterxml.jackson.core.type.TypeReference<ProductDeletedMessage> typeReference() { 177 return new com.fasterxml.jackson.core.type.TypeReference<ProductDeletedMessage>() { 178 @Override 179 public String toString() { 180 return "TypeReference<ProductDeletedMessage>"; 181 } 182 }; 183 } 184}