001 002package com.commercetools.api.models.error; 003 004import java.time.*; 005import java.util.*; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonProperty; 009import com.fasterxml.jackson.databind.annotation.*; 010 011import io.vrap.rmf.base.client.ModelBase; 012import io.vrap.rmf.base.client.utils.Generated; 013 014import org.apache.commons.lang3.builder.EqualsBuilder; 015import org.apache.commons.lang3.builder.HashCodeBuilder; 016 017/** 018 * <p>Returned when an enum value cannot be removed from an Attribute as it is being used by a Product.</p> 019 * <p>The error is returned as a failed response to the Remove EnumValues from AttributeDefinition update action.</p> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class EnumValueIsUsedErrorImpl implements EnumValueIsUsedError, ModelBase { 023 024 private String code; 025 026 private String message; 027 028 private Map<String, java.lang.Object> values; 029 030 /** 031 * create instance with all properties 032 */ 033 @JsonCreator 034 EnumValueIsUsedErrorImpl(@JsonProperty("message") final String message, 035 @JsonProperty("values") final Map<String, java.lang.Object> values) { 036 this.message = message; 037 this.values = values; 038 this.code = ENUM_VALUE_IS_USED; 039 } 040 041 /** 042 * create empty instance 043 */ 044 public EnumValueIsUsedErrorImpl() { 045 this.code = ENUM_VALUE_IS_USED; 046 } 047 048 /** 049 * 050 */ 051 052 public String getCode() { 053 return this.code; 054 } 055 056 /** 057 * <p><code>"$enumKeysTranscript is used by some products and cannot be deleted because the $attributeName attribute is required."</code></p> 058 */ 059 060 public String getMessage() { 061 return this.message; 062 } 063 064 /** 065 * <p>Error-specific additional fields.</p> 066 */ 067 068 public Map<String, java.lang.Object> values() { 069 return values; 070 } 071 072 public void setMessage(final String message) { 073 this.message = message; 074 } 075 076 public void setValue(String key, java.lang.Object value) { 077 if (values == null) { 078 values = new HashMap<>(); 079 } 080 values.put(key, value); 081 } 082 083 @Override 084 public boolean equals(Object o) { 085 if (this == o) 086 return true; 087 088 if (o == null || getClass() != o.getClass()) 089 return false; 090 091 EnumValueIsUsedErrorImpl that = (EnumValueIsUsedErrorImpl) o; 092 093 return new EqualsBuilder().append(code, that.code) 094 .append(message, that.message) 095 .append(values, that.values) 096 .append(code, that.code) 097 .append(message, that.message) 098 .append(values, that.values) 099 .isEquals(); 100 } 101 102 @Override 103 public int hashCode() { 104 return new HashCodeBuilder(17, 37).append(code).append(message).append(values).toHashCode(); 105 } 106 107}