001 002package com.commercetools.api.models.error; 003 004import java.time.*; 005import java.util.*; 006import java.util.function.Function; 007import java.util.stream.Collectors; 008 009import javax.annotation.Nullable; 010import javax.validation.Valid; 011import javax.validation.constraints.NotNull; 012 013import com.commercetools.api.models.common.LocalizedString; 014import com.fasterxml.jackson.annotation.*; 015import com.fasterxml.jackson.databind.annotation.*; 016 017import io.vrap.rmf.base.client.utils.Generated; 018 019/** 020 * <p>Returned when update actions could not be applied to the resource (for example, because a referenced resource does not exist). This would result in a 400 Bad Request response if the same update action was sent from a regular client.</p> 021 * 022 * <hr> 023 * Example to create an instance using the builder pattern 024 * <div class=code-example> 025 * <pre><code class='java'> 026 * ExtensionUpdateActionsFailedError extensionUpdateActionsFailedError = ExtensionUpdateActionsFailedError.builder() 027 * .message("{message}") 028 * .plusExtensionErrors(extensionErrorsBuilder -> extensionErrorsBuilder) 029 * .build() 030 * </code></pre> 031 * </div> 032 */ 033@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 034@JsonDeserialize(as = ExtensionUpdateActionsFailedErrorImpl.class) 035public interface ExtensionUpdateActionsFailedError extends ErrorObject { 036 037 /** 038 * discriminator value for ExtensionUpdateActionsFailedError 039 */ 040 String EXTENSION_UPDATE_ACTIONS_FAILED = "ExtensionUpdateActionsFailed"; 041 042 /** 043 * 044 * @return code 045 */ 046 @NotNull 047 @JsonProperty("code") 048 public String getCode(); 049 050 /** 051 * <p><code>"The extension returned update actions that could not be executed."</code></p> 052 * @return message 053 */ 054 @NotNull 055 @JsonProperty("message") 056 public String getMessage(); 057 058 /** 059 * <p>User-defined localized description of the error.</p> 060 * @return localizedMessage 061 */ 062 @Valid 063 @JsonProperty("localizedMessage") 064 public LocalizedString getLocalizedMessage(); 065 066 /** 067 * <p>Any information that should be returned to the API caller.</p> 068 * @return extensionExtraInfo 069 */ 070 @Valid 071 @JsonProperty("extensionExtraInfo") 072 public Object getExtensionExtraInfo(); 073 074 /** 075 * <p>Additional errors related to the API Extension.</p> 076 * @return extensionErrors 077 */ 078 @NotNull 079 @Valid 080 @JsonProperty("extensionErrors") 081 public List<ExtensionError> getExtensionErrors(); 082 083 /** 084 * <p><code>"The extension returned update actions that could not be executed."</code></p> 085 * @param message value to be set 086 */ 087 088 public void setMessage(final String message); 089 090 /** 091 * <p>User-defined localized description of the error.</p> 092 * @param localizedMessage value to be set 093 */ 094 095 public void setLocalizedMessage(final LocalizedString localizedMessage); 096 097 /** 098 * <p>Any information that should be returned to the API caller.</p> 099 * @param extensionExtraInfo value to be set 100 */ 101 102 public void setExtensionExtraInfo(final Object extensionExtraInfo); 103 104 /** 105 * <p>Additional errors related to the API Extension.</p> 106 * @param extensionErrors values to be set 107 */ 108 109 @JsonIgnore 110 public void setExtensionErrors(final ExtensionError... extensionErrors); 111 112 /** 113 * <p>Additional errors related to the API Extension.</p> 114 * @param extensionErrors values to be set 115 */ 116 117 public void setExtensionErrors(final List<ExtensionError> extensionErrors); 118 119 /** 120 * factory method 121 * @return instance of ExtensionUpdateActionsFailedError 122 */ 123 public static ExtensionUpdateActionsFailedError of() { 124 return new ExtensionUpdateActionsFailedErrorImpl(); 125 } 126 127 /** 128 * factory method to create a shallow copy ExtensionUpdateActionsFailedError 129 * @param template instance to be copied 130 * @return copy instance 131 */ 132 public static ExtensionUpdateActionsFailedError of(final ExtensionUpdateActionsFailedError template) { 133 ExtensionUpdateActionsFailedErrorImpl instance = new ExtensionUpdateActionsFailedErrorImpl(); 134 instance.setMessage(template.getMessage()); 135 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 136 instance.setLocalizedMessage(template.getLocalizedMessage()); 137 instance.setExtensionExtraInfo(template.getExtensionExtraInfo()); 138 instance.setExtensionErrors(template.getExtensionErrors()); 139 return instance; 140 } 141 142 /** 143 * factory method to create a deep copy of ExtensionUpdateActionsFailedError 144 * @param template instance to be copied 145 * @return copy instance 146 */ 147 @Nullable 148 public static ExtensionUpdateActionsFailedError deepCopy( 149 @Nullable final ExtensionUpdateActionsFailedError template) { 150 if (template == null) { 151 return null; 152 } 153 ExtensionUpdateActionsFailedErrorImpl instance = new ExtensionUpdateActionsFailedErrorImpl(); 154 instance.setMessage(template.getMessage()); 155 Optional.ofNullable(template.values()).ifPresent(t -> t.forEach(instance::setValue)); 156 instance.setLocalizedMessage( 157 com.commercetools.api.models.common.LocalizedString.deepCopy(template.getLocalizedMessage())); 158 instance.setExtensionExtraInfo(template.getExtensionExtraInfo()); 159 instance.setExtensionErrors(Optional.ofNullable(template.getExtensionErrors()) 160 .map(t -> t.stream() 161 .map(com.commercetools.api.models.error.ExtensionError::deepCopy) 162 .collect(Collectors.toList())) 163 .orElse(null)); 164 return instance; 165 } 166 167 /** 168 * builder factory method for ExtensionUpdateActionsFailedError 169 * @return builder 170 */ 171 public static ExtensionUpdateActionsFailedErrorBuilder builder() { 172 return ExtensionUpdateActionsFailedErrorBuilder.of(); 173 } 174 175 /** 176 * create builder for ExtensionUpdateActionsFailedError instance 177 * @param template instance with prefilled values for the builder 178 * @return builder 179 */ 180 public static ExtensionUpdateActionsFailedErrorBuilder builder(final ExtensionUpdateActionsFailedError template) { 181 return ExtensionUpdateActionsFailedErrorBuilder.of(template); 182 } 183 184 /** 185 * accessor map function 186 * @param <T> mapped type 187 * @param helper function to map the object 188 * @return mapped value 189 */ 190 default <T> T withExtensionUpdateActionsFailedError(Function<ExtensionUpdateActionsFailedError, T> helper) { 191 return helper.apply(this); 192 } 193 194 /** 195 * gives a TypeReference for usage with Jackson DataBind 196 * @return TypeReference 197 */ 198 public static com.fasterxml.jackson.core.type.TypeReference<ExtensionUpdateActionsFailedError> typeReference() { 199 return new com.fasterxml.jackson.core.type.TypeReference<ExtensionUpdateActionsFailedError>() { 200 @Override 201 public String toString() { 202 return "TypeReference<ExtensionUpdateActionsFailedError>"; 203 } 204 }; 205 } 206}