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 the <code>name</code> of the AttributeDefinition conflicts with an existing Attribute.</p> 019 * <p>The error is returned as a failed response to the Create ProductType request or Change AttributeDefinition Name update action.</p> 020 */ 021@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 022public class AttributeDefinitionAlreadyExistsErrorImpl implements AttributeDefinitionAlreadyExistsError, ModelBase { 023 024 private String code; 025 026 private String message; 027 028 private Map<String, java.lang.Object> values; 029 030 private String conflictingProductTypeId; 031 032 private String conflictingProductTypeName; 033 034 private String conflictingAttributeName; 035 036 /** 037 * create instance with all properties 038 */ 039 @JsonCreator 040 AttributeDefinitionAlreadyExistsErrorImpl(@JsonProperty("message") final String message, 041 @JsonProperty("values") final Map<String, java.lang.Object> values, 042 @JsonProperty("conflictingProductTypeId") final String conflictingProductTypeId, 043 @JsonProperty("conflictingProductTypeName") final String conflictingProductTypeName, 044 @JsonProperty("conflictingAttributeName") final String conflictingAttributeName) { 045 this.message = message; 046 this.values = values; 047 this.conflictingProductTypeId = conflictingProductTypeId; 048 this.conflictingProductTypeName = conflictingProductTypeName; 049 this.conflictingAttributeName = conflictingAttributeName; 050 this.code = ATTRIBUTE_DEFINITION_ALREADY_EXISTS; 051 } 052 053 /** 054 * create empty instance 055 */ 056 public AttributeDefinitionAlreadyExistsErrorImpl() { 057 this.code = ATTRIBUTE_DEFINITION_ALREADY_EXISTS; 058 } 059 060 /** 061 * 062 */ 063 064 public String getCode() { 065 return this.code; 066 } 067 068 /** 069 * <p><code>"An attribute definition with name $attributeName already exists on product type $productTypeName."</code></p> 070 */ 071 072 public String getMessage() { 073 return this.message; 074 } 075 076 /** 077 * <p>Error-specific additional fields.</p> 078 */ 079 080 public Map<String, java.lang.Object> values() { 081 return values; 082 } 083 084 /** 085 * <p>Unique identifier of the Product Type containing the conflicting name.</p> 086 */ 087 088 public String getConflictingProductTypeId() { 089 return this.conflictingProductTypeId; 090 } 091 092 /** 093 * <p>Name of the Product Type containing the conflicting name.</p> 094 */ 095 096 public String getConflictingProductTypeName() { 097 return this.conflictingProductTypeName; 098 } 099 100 /** 101 * <p>Name of the conflicting Attribute.</p> 102 */ 103 104 public String getConflictingAttributeName() { 105 return this.conflictingAttributeName; 106 } 107 108 public void setMessage(final String message) { 109 this.message = message; 110 } 111 112 public void setValue(String key, java.lang.Object value) { 113 if (values == null) { 114 values = new HashMap<>(); 115 } 116 values.put(key, value); 117 } 118 119 public void setConflictingProductTypeId(final String conflictingProductTypeId) { 120 this.conflictingProductTypeId = conflictingProductTypeId; 121 } 122 123 public void setConflictingProductTypeName(final String conflictingProductTypeName) { 124 this.conflictingProductTypeName = conflictingProductTypeName; 125 } 126 127 public void setConflictingAttributeName(final String conflictingAttributeName) { 128 this.conflictingAttributeName = conflictingAttributeName; 129 } 130 131 @Override 132 public boolean equals(Object o) { 133 if (this == o) 134 return true; 135 136 if (o == null || getClass() != o.getClass()) 137 return false; 138 139 AttributeDefinitionAlreadyExistsErrorImpl that = (AttributeDefinitionAlreadyExistsErrorImpl) o; 140 141 return new EqualsBuilder().append(code, that.code) 142 .append(message, that.message) 143 .append(values, that.values) 144 .append(conflictingProductTypeId, that.conflictingProductTypeId) 145 .append(conflictingProductTypeName, that.conflictingProductTypeName) 146 .append(conflictingAttributeName, that.conflictingAttributeName) 147 .append(code, that.code) 148 .append(message, that.message) 149 .append(values, that.values) 150 .append(conflictingProductTypeId, that.conflictingProductTypeId) 151 .append(conflictingProductTypeName, that.conflictingProductTypeName) 152 .append(conflictingAttributeName, that.conflictingAttributeName) 153 .isEquals(); 154 } 155 156 @Override 157 public int hashCode() { 158 return new HashCodeBuilder(17, 37).append(code) 159 .append(message) 160 .append(values) 161 .append(conflictingProductTypeId) 162 .append(conflictingProductTypeName) 163 .append(conflictingAttributeName) 164 .toHashCode(); 165 } 166 167}