001 002package com.commercetools.api.models.business_unit; 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>Business Unit type to represent the top level of a business. Contains specific fields and values that differentiate a Company from the generic BusinessUnit.</p> 019 */ 020@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 021public class CompanyImpl implements Company, ModelBase { 022 023 private String id; 024 025 private Long version; 026 027 private java.time.ZonedDateTime createdAt; 028 029 private java.time.ZonedDateTime lastModifiedAt; 030 031 private com.commercetools.api.models.common.LastModifiedBy lastModifiedBy; 032 033 private com.commercetools.api.models.common.CreatedBy createdBy; 034 035 private String key; 036 037 private com.commercetools.api.models.business_unit.BusinessUnitStatus status; 038 039 private java.util.List<com.commercetools.api.models.store.StoreKeyReference> stores; 040 041 private com.commercetools.api.models.business_unit.BusinessUnitStoreMode storeMode; 042 043 private com.commercetools.api.models.business_unit.BusinessUnitType unitType; 044 045 private String name; 046 047 private String contactEmail; 048 049 private com.commercetools.api.models.type.CustomFields custom; 050 051 private java.util.List<com.commercetools.api.models.common.Address> addresses; 052 053 private java.util.List<String> shippingAddressIds; 054 055 private String defaultShippingAddressId; 056 057 private java.util.List<String> billingAddressIds; 058 059 private String defaultBillingAddressId; 060 061 private com.commercetools.api.models.business_unit.BusinessUnitAssociateMode associateMode; 062 063 private java.util.List<com.commercetools.api.models.business_unit.Associate> associates; 064 065 private java.util.List<com.commercetools.api.models.business_unit.InheritedAssociate> inheritedAssociates; 066 067 private com.commercetools.api.models.business_unit.BusinessUnitKeyReference parentUnit; 068 069 private com.commercetools.api.models.business_unit.BusinessUnitKeyReference topLevelUnit; 070 071 /** 072 * create instance with all properties 073 */ 074 @JsonCreator 075 CompanyImpl(@JsonProperty("id") final String id, @JsonProperty("version") final Long version, 076 @JsonProperty("createdAt") final java.time.ZonedDateTime createdAt, 077 @JsonProperty("lastModifiedAt") final java.time.ZonedDateTime lastModifiedAt, 078 @JsonProperty("lastModifiedBy") final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy, 079 @JsonProperty("createdBy") final com.commercetools.api.models.common.CreatedBy createdBy, 080 @JsonProperty("key") final String key, 081 @JsonProperty("status") final com.commercetools.api.models.business_unit.BusinessUnitStatus status, 082 @JsonProperty("stores") final java.util.List<com.commercetools.api.models.store.StoreKeyReference> stores, 083 @JsonProperty("storeMode") final com.commercetools.api.models.business_unit.BusinessUnitStoreMode storeMode, 084 @JsonProperty("name") final String name, @JsonProperty("contactEmail") final String contactEmail, 085 @JsonProperty("custom") final com.commercetools.api.models.type.CustomFields custom, 086 @JsonProperty("addresses") final java.util.List<com.commercetools.api.models.common.Address> addresses, 087 @JsonProperty("shippingAddressIds") final java.util.List<String> shippingAddressIds, 088 @JsonProperty("defaultShippingAddressId") final String defaultShippingAddressId, 089 @JsonProperty("billingAddressIds") final java.util.List<String> billingAddressIds, 090 @JsonProperty("defaultBillingAddressId") final String defaultBillingAddressId, 091 @JsonProperty("associateMode") final com.commercetools.api.models.business_unit.BusinessUnitAssociateMode associateMode, 092 @JsonProperty("associates") final java.util.List<com.commercetools.api.models.business_unit.Associate> associates, 093 @JsonProperty("inheritedAssociates") final java.util.List<com.commercetools.api.models.business_unit.InheritedAssociate> inheritedAssociates, 094 @JsonProperty("parentUnit") final com.commercetools.api.models.business_unit.BusinessUnitKeyReference parentUnit, 095 @JsonProperty("topLevelUnit") final com.commercetools.api.models.business_unit.BusinessUnitKeyReference topLevelUnit) { 096 this.id = id; 097 this.version = version; 098 this.createdAt = createdAt; 099 this.lastModifiedAt = lastModifiedAt; 100 this.lastModifiedBy = lastModifiedBy; 101 this.createdBy = createdBy; 102 this.key = key; 103 this.status = status; 104 this.stores = stores; 105 this.storeMode = storeMode; 106 this.name = name; 107 this.contactEmail = contactEmail; 108 this.custom = custom; 109 this.addresses = addresses; 110 this.shippingAddressIds = shippingAddressIds; 111 this.defaultShippingAddressId = defaultShippingAddressId; 112 this.billingAddressIds = billingAddressIds; 113 this.defaultBillingAddressId = defaultBillingAddressId; 114 this.associateMode = associateMode; 115 this.associates = associates; 116 this.inheritedAssociates = inheritedAssociates; 117 this.parentUnit = parentUnit; 118 this.topLevelUnit = topLevelUnit; 119 this.unitType = BusinessUnitType.findEnum("Company"); 120 } 121 122 /** 123 * create empty instance 124 */ 125 public CompanyImpl() { 126 this.unitType = BusinessUnitType.findEnum("Company"); 127 } 128 129 /** 130 * <p>Unique identifier of the Business Unit.</p> 131 */ 132 133 public String getId() { 134 return this.id; 135 } 136 137 /** 138 * <p>Current version of the Business Unit.</p> 139 */ 140 141 public Long getVersion() { 142 return this.version; 143 } 144 145 /** 146 * <p>Date and time (UTC) the Business Unit was initially created.</p> 147 */ 148 149 public java.time.ZonedDateTime getCreatedAt() { 150 return this.createdAt; 151 } 152 153 /** 154 * <p>Date and time (UTC) the Business Unit was last updated.</p> 155 */ 156 157 public java.time.ZonedDateTime getLastModifiedAt() { 158 return this.lastModifiedAt; 159 } 160 161 /** 162 * <p>Present on resources updated after 1 February 2019 except for events not tracked.</p> 163 */ 164 165 public com.commercetools.api.models.common.LastModifiedBy getLastModifiedBy() { 166 return this.lastModifiedBy; 167 } 168 169 /** 170 * <p>Present on resources created after 1 February 2019 except for events not tracked.</p> 171 */ 172 173 public com.commercetools.api.models.common.CreatedBy getCreatedBy() { 174 return this.createdBy; 175 } 176 177 /** 178 * <p>User-defined unique identifier of the Business Unit.</p> 179 */ 180 181 public String getKey() { 182 return this.key; 183 } 184 185 /** 186 * <p>Indicates whether the Business Unit can be edited and used in Orders.</p> 187 */ 188 189 public com.commercetools.api.models.business_unit.BusinessUnitStatus getStatus() { 190 return this.status; 191 } 192 193 /** 194 * <p>References to Stores the Business Unit is associated with. Only present when <code>storeMode</code> is <code>Explicit</code>.</p> 195 * <p>If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, or Quote Requests must belong to one of the Business Unit's Stores.</p> 196 * <p>If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.</p> 197 */ 198 199 public java.util.List<com.commercetools.api.models.store.StoreKeyReference> getStores() { 200 return this.stores; 201 } 202 203 /** 204 * <p>Is always <code>Explicit</code> since a Company cannot have a parent Business Unit that Stores can be inherited from.</p> 205 */ 206 207 public com.commercetools.api.models.business_unit.BusinessUnitStoreMode getStoreMode() { 208 return this.storeMode; 209 } 210 211 /** 212 * <p>Type of the Business Unit indicating its position in a hierarchy.</p> 213 */ 214 215 public com.commercetools.api.models.business_unit.BusinessUnitType getUnitType() { 216 return this.unitType; 217 } 218 219 /** 220 * <p>Name of the Business Unit.</p> 221 */ 222 223 public String getName() { 224 return this.name; 225 } 226 227 /** 228 * <p>Email address of the Business Unit.</p> 229 */ 230 231 public String getContactEmail() { 232 return this.contactEmail; 233 } 234 235 /** 236 * <p>Custom Fields for the Business Unit.</p> 237 */ 238 239 public com.commercetools.api.models.type.CustomFields getCustom() { 240 return this.custom; 241 } 242 243 /** 244 * <p>Addresses used by the Business Unit.</p> 245 */ 246 247 public java.util.List<com.commercetools.api.models.common.Address> getAddresses() { 248 return this.addresses; 249 } 250 251 /** 252 * <p>Unique identifiers of addresses used as shipping addresses.</p> 253 */ 254 255 public java.util.List<String> getShippingAddressIds() { 256 return this.shippingAddressIds; 257 } 258 259 /** 260 * <p>Unique identifier of the address used as the default shipping address.</p> 261 */ 262 263 public String getDefaultShippingAddressId() { 264 return this.defaultShippingAddressId; 265 } 266 267 /** 268 * <p>Unique identifiers of addresses used as billing addresses.</p> 269 */ 270 271 public java.util.List<String> getBillingAddressIds() { 272 return this.billingAddressIds; 273 } 274 275 /** 276 * <p>Unique identifier of the address used as the default billing address.</p> 277 */ 278 279 public String getDefaultBillingAddressId() { 280 return this.defaultBillingAddressId; 281 } 282 283 /** 284 * <p>Is always <code>Explicit</code> since a Company cannot have a parent Business Unit that Associates can be inherited from.</p> 285 */ 286 287 public com.commercetools.api.models.business_unit.BusinessUnitAssociateMode getAssociateMode() { 288 return this.associateMode; 289 } 290 291 /** 292 * <p>Associates that are part of the Business Unit in specific roles.</p> 293 */ 294 295 public java.util.List<com.commercetools.api.models.business_unit.Associate> getAssociates() { 296 return this.associates; 297 } 298 299 /** 300 * <p>Associates that are inherited from a parent Business Unit. This value of this field is eventually consistent and is only present when the <code>associateMode</code> is set to <code>ExplicitAndFromParent</code>.</p> 301 */ 302 303 public java.util.List<com.commercetools.api.models.business_unit.InheritedAssociate> getInheritedAssociates() { 304 return this.inheritedAssociates; 305 } 306 307 /** 308 * <p>Parent unit of the Business Unit. Only present when the <code>unitType</code> is <code>Division</code>.</p> 309 */ 310 311 public com.commercetools.api.models.business_unit.BusinessUnitKeyReference getParentUnit() { 312 return this.parentUnit; 313 } 314 315 /** 316 * <p>Top-level unit of the Business Unit. The top-level unit is of <code>unitType</code> <code>Company</code>.</p> 317 */ 318 319 public com.commercetools.api.models.business_unit.BusinessUnitKeyReference getTopLevelUnit() { 320 return this.topLevelUnit; 321 } 322 323 public void setId(final String id) { 324 this.id = id; 325 } 326 327 public void setVersion(final Long version) { 328 this.version = version; 329 } 330 331 public void setCreatedAt(final java.time.ZonedDateTime createdAt) { 332 this.createdAt = createdAt; 333 } 334 335 public void setLastModifiedAt(final java.time.ZonedDateTime lastModifiedAt) { 336 this.lastModifiedAt = lastModifiedAt; 337 } 338 339 public void setLastModifiedBy(final com.commercetools.api.models.common.LastModifiedBy lastModifiedBy) { 340 this.lastModifiedBy = lastModifiedBy; 341 } 342 343 public void setCreatedBy(final com.commercetools.api.models.common.CreatedBy createdBy) { 344 this.createdBy = createdBy; 345 } 346 347 public void setKey(final String key) { 348 this.key = key; 349 } 350 351 public void setStatus(final com.commercetools.api.models.business_unit.BusinessUnitStatus status) { 352 this.status = status; 353 } 354 355 public void setStores(final com.commercetools.api.models.store.StoreKeyReference... stores) { 356 this.stores = new ArrayList<>(Arrays.asList(stores)); 357 } 358 359 public void setStores(final java.util.List<com.commercetools.api.models.store.StoreKeyReference> stores) { 360 this.stores = stores; 361 } 362 363 public void setStoreMode(final com.commercetools.api.models.business_unit.BusinessUnitStoreMode storeMode) { 364 this.storeMode = storeMode; 365 } 366 367 public void setName(final String name) { 368 this.name = name; 369 } 370 371 public void setContactEmail(final String contactEmail) { 372 this.contactEmail = contactEmail; 373 } 374 375 public void setCustom(final com.commercetools.api.models.type.CustomFields custom) { 376 this.custom = custom; 377 } 378 379 public void setAddresses(final com.commercetools.api.models.common.Address... addresses) { 380 this.addresses = new ArrayList<>(Arrays.asList(addresses)); 381 } 382 383 public void setAddresses(final java.util.List<com.commercetools.api.models.common.Address> addresses) { 384 this.addresses = addresses; 385 } 386 387 public void setShippingAddressIds(final String... shippingAddressIds) { 388 this.shippingAddressIds = new ArrayList<>(Arrays.asList(shippingAddressIds)); 389 } 390 391 public void setShippingAddressIds(final java.util.List<String> shippingAddressIds) { 392 this.shippingAddressIds = shippingAddressIds; 393 } 394 395 public void setDefaultShippingAddressId(final String defaultShippingAddressId) { 396 this.defaultShippingAddressId = defaultShippingAddressId; 397 } 398 399 public void setBillingAddressIds(final String... billingAddressIds) { 400 this.billingAddressIds = new ArrayList<>(Arrays.asList(billingAddressIds)); 401 } 402 403 public void setBillingAddressIds(final java.util.List<String> billingAddressIds) { 404 this.billingAddressIds = billingAddressIds; 405 } 406 407 public void setDefaultBillingAddressId(final String defaultBillingAddressId) { 408 this.defaultBillingAddressId = defaultBillingAddressId; 409 } 410 411 public void setAssociateMode( 412 final com.commercetools.api.models.business_unit.BusinessUnitAssociateMode associateMode) { 413 this.associateMode = associateMode; 414 } 415 416 public void setAssociates(final com.commercetools.api.models.business_unit.Associate... associates) { 417 this.associates = new ArrayList<>(Arrays.asList(associates)); 418 } 419 420 public void setAssociates(final java.util.List<com.commercetools.api.models.business_unit.Associate> associates) { 421 this.associates = associates; 422 } 423 424 public void setInheritedAssociates( 425 final com.commercetools.api.models.business_unit.InheritedAssociate... inheritedAssociates) { 426 this.inheritedAssociates = new ArrayList<>(Arrays.asList(inheritedAssociates)); 427 } 428 429 public void setInheritedAssociates( 430 final java.util.List<com.commercetools.api.models.business_unit.InheritedAssociate> inheritedAssociates) { 431 this.inheritedAssociates = inheritedAssociates; 432 } 433 434 public void setParentUnit(final com.commercetools.api.models.business_unit.BusinessUnitKeyReference parentUnit) { 435 this.parentUnit = parentUnit; 436 } 437 438 public void setTopLevelUnit( 439 final com.commercetools.api.models.business_unit.BusinessUnitKeyReference topLevelUnit) { 440 this.topLevelUnit = topLevelUnit; 441 } 442 443 @Override 444 public boolean equals(Object o) { 445 if (this == o) 446 return true; 447 448 if (o == null || getClass() != o.getClass()) 449 return false; 450 451 CompanyImpl that = (CompanyImpl) o; 452 453 return new EqualsBuilder().append(id, that.id) 454 .append(version, that.version) 455 .append(createdAt, that.createdAt) 456 .append(lastModifiedAt, that.lastModifiedAt) 457 .append(lastModifiedBy, that.lastModifiedBy) 458 .append(createdBy, that.createdBy) 459 .append(key, that.key) 460 .append(status, that.status) 461 .append(stores, that.stores) 462 .append(storeMode, that.storeMode) 463 .append(unitType, that.unitType) 464 .append(name, that.name) 465 .append(contactEmail, that.contactEmail) 466 .append(custom, that.custom) 467 .append(addresses, that.addresses) 468 .append(shippingAddressIds, that.shippingAddressIds) 469 .append(defaultShippingAddressId, that.defaultShippingAddressId) 470 .append(billingAddressIds, that.billingAddressIds) 471 .append(defaultBillingAddressId, that.defaultBillingAddressId) 472 .append(associateMode, that.associateMode) 473 .append(associates, that.associates) 474 .append(inheritedAssociates, that.inheritedAssociates) 475 .append(parentUnit, that.parentUnit) 476 .append(topLevelUnit, that.topLevelUnit) 477 .append(id, that.id) 478 .append(version, that.version) 479 .append(createdAt, that.createdAt) 480 .append(lastModifiedAt, that.lastModifiedAt) 481 .append(lastModifiedBy, that.lastModifiedBy) 482 .append(createdBy, that.createdBy) 483 .append(key, that.key) 484 .append(status, that.status) 485 .append(stores, that.stores) 486 .append(storeMode, that.storeMode) 487 .append(unitType, that.unitType) 488 .append(name, that.name) 489 .append(contactEmail, that.contactEmail) 490 .append(custom, that.custom) 491 .append(addresses, that.addresses) 492 .append(shippingAddressIds, that.shippingAddressIds) 493 .append(defaultShippingAddressId, that.defaultShippingAddressId) 494 .append(billingAddressIds, that.billingAddressIds) 495 .append(defaultBillingAddressId, that.defaultBillingAddressId) 496 .append(associateMode, that.associateMode) 497 .append(associates, that.associates) 498 .append(inheritedAssociates, that.inheritedAssociates) 499 .append(parentUnit, that.parentUnit) 500 .append(topLevelUnit, that.topLevelUnit) 501 .isEquals(); 502 } 503 504 @Override 505 public int hashCode() { 506 return new HashCodeBuilder(17, 37).append(id) 507 .append(version) 508 .append(createdAt) 509 .append(lastModifiedAt) 510 .append(lastModifiedBy) 511 .append(createdBy) 512 .append(key) 513 .append(status) 514 .append(stores) 515 .append(storeMode) 516 .append(unitType) 517 .append(name) 518 .append(contactEmail) 519 .append(custom) 520 .append(addresses) 521 .append(shippingAddressIds) 522 .append(defaultShippingAddressId) 523 .append(billingAddressIds) 524 .append(defaultBillingAddressId) 525 .append(associateMode) 526 .append(associates) 527 .append(inheritedAssociates) 528 .append(parentUnit) 529 .append(topLevelUnit) 530 .toHashCode(); 531 } 532 533}