Class DivisionBuilder

java.lang.Object
com.commercetools.api.models.business_unit.DivisionBuilder
All Implemented Interfaces:
Builder<Division>

public class DivisionBuilder extends Object implements Builder<Division>
DivisionBuilder
Example to create an instance using the builder pattern

     Division division = Division.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .key("{key}")
             .status(BusinessUnitStatus.ACTIVE)
             .plusStores(storesBuilder -> storesBuilder)
             .storeMode(BusinessUnitStoreMode.EXPLICIT)
             .name("{name}")
             .plusAddresses(addressesBuilder -> addressesBuilder)
             .associateMode(BusinessUnitAssociateMode.EXPLICIT)
             .plusAssociates(associatesBuilder -> associatesBuilder)
             .parentUnit(parentUnitBuilder -> parentUnitBuilder)
             .topLevelUnit(topLevelUnitBuilder -> topLevelUnitBuilder)
             .build()
 
  • Constructor Details

    • DivisionBuilder

      public DivisionBuilder()
  • Method Details

    • id

      public DivisionBuilder id(String id)

      Unique identifier of the Business Unit.

      Parameters:
      id - value to be set
      Returns:
      Builder
    • version

      public DivisionBuilder version(Long version)

      Current version of the Business Unit.

      Parameters:
      version - value to be set
      Returns:
      Builder
    • createdAt

      public DivisionBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Business Unit was initially created.

      Parameters:
      createdAt - value to be set
      Returns:
      Builder
    • lastModifiedAt

      public DivisionBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the Business Unit was last updated.

      Parameters:
      lastModifiedAt - value to be set
      Returns:
      Builder
    • lastModifiedBy

      IDs and references that last modified the BusinessUnit.

      Parameters:
      builder - function to build the lastModifiedBy value
      Returns:
      Builder
    • withLastModifiedBy

      public DivisionBuilder withLastModifiedBy(Function<LastModifiedByBuilder,LastModifiedBy> builder)

      IDs and references that last modified the BusinessUnit.

      Parameters:
      builder - function to build the lastModifiedBy value
      Returns:
      Builder
    • lastModifiedBy

      public DivisionBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the BusinessUnit.

      Parameters:
      lastModifiedBy - value to be set
      Returns:
      Builder
    • createdBy

      IDs and references that created the BusinessUnit.

      Parameters:
      builder - function to build the createdBy value
      Returns:
      Builder
    • withCreatedBy

      public DivisionBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the BusinessUnit.

      Parameters:
      builder - function to build the createdBy value
      Returns:
      Builder
    • createdBy

      public DivisionBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the BusinessUnit.

      Parameters:
      createdBy - value to be set
      Returns:
      Builder
    • key

      public DivisionBuilder key(String key)

      User-defined unique identifier of the Business Unit.

      Parameters:
      key - value to be set
      Returns:
      Builder
    • status

      public DivisionBuilder status(BusinessUnitStatus status)

      Indicates whether the Business Unit can be edited and used in Orders.

      Parameters:
      status - value to be set
      Returns:
      Builder
    • stores

      public DivisionBuilder stores(StoreKeyReference... stores)

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • stores

      public DivisionBuilder stores(List<StoreKeyReference> stores)

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      public DivisionBuilder plusStores(StoreKeyReference... stores)

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • withStores

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • addStores

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • setStores

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Parameters:
      builder - function to build the stores value
      Returns:
      Builder
    • storeMode

      public DivisionBuilder storeMode(BusinessUnitStoreMode storeMode)

      Defines whether the Stores of the Division are set explicitly or inherited from a parent Business Unit.

      Parameters:
      storeMode - value to be set
      Returns:
      Builder
    • name

      public DivisionBuilder name(String name)

      Name of the Business Unit.

      Parameters:
      name - value to be set
      Returns:
      Builder
    • contactEmail

      public DivisionBuilder contactEmail(@Nullable String contactEmail)

      Email address of the Business Unit.

      Parameters:
      contactEmail - value to be set
      Returns:
      Builder
    • custom

      Custom Fields for the Business Unit.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • withCustom

      Custom Fields for the Business Unit.

      Parameters:
      builder - function to build the custom value
      Returns:
      Builder
    • custom

      public DivisionBuilder custom(@Nullable CustomFields custom)

      Custom Fields for the Business Unit.

      Parameters:
      custom - value to be set
      Returns:
      Builder
    • addresses

      public DivisionBuilder addresses(Address... addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - value to be set
      Returns:
      Builder
    • addresses

      public DivisionBuilder addresses(List<Address> addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - value to be set
      Returns:
      Builder
    • plusAddresses

      public DivisionBuilder plusAddresses(Address... addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - value to be set
      Returns:
      Builder
    • plusAddresses

      public DivisionBuilder plusAddresses(Function<AddressBuilder,AddressBuilder> builder)

      Addresses used by the Business Unit.

      Parameters:
      builder - function to build the addresses value
      Returns:
      Builder
    • withAddresses

      public DivisionBuilder withAddresses(Function<AddressBuilder,AddressBuilder> builder)

      Addresses used by the Business Unit.

      Parameters:
      builder - function to build the addresses value
      Returns:
      Builder
    • addAddresses

      public DivisionBuilder addAddresses(Function<AddressBuilder,Address> builder)

      Addresses used by the Business Unit.

      Parameters:
      builder - function to build the addresses value
      Returns:
      Builder
    • setAddresses

      public DivisionBuilder setAddresses(Function<AddressBuilder,Address> builder)

      Addresses used by the Business Unit.

      Parameters:
      builder - function to build the addresses value
      Returns:
      Builder
    • shippingAddressIds

      public DivisionBuilder shippingAddressIds(@Nullable String... shippingAddressIds)

      Unique identifiers of addresses used as shipping addresses.

      Parameters:
      shippingAddressIds - value to be set
      Returns:
      Builder
    • shippingAddressIds

      public DivisionBuilder shippingAddressIds(@Nullable List<String> shippingAddressIds)

      Unique identifiers of addresses used as shipping addresses.

      Parameters:
      shippingAddressIds - value to be set
      Returns:
      Builder
    • plusShippingAddressIds

      public DivisionBuilder plusShippingAddressIds(@Nullable String... shippingAddressIds)

      Unique identifiers of addresses used as shipping addresses.

      Parameters:
      shippingAddressIds - value to be set
      Returns:
      Builder
    • defaultShippingAddressId

      public DivisionBuilder defaultShippingAddressId(@Nullable String defaultShippingAddressId)

      Unique identifier of the address used as the default shipping address.

      Parameters:
      defaultShippingAddressId - value to be set
      Returns:
      Builder
    • billingAddressIds

      public DivisionBuilder billingAddressIds(@Nullable String... billingAddressIds)

      Unique identifiers of addresses used as billing addresses.

      Parameters:
      billingAddressIds - value to be set
      Returns:
      Builder
    • billingAddressIds

      public DivisionBuilder billingAddressIds(@Nullable List<String> billingAddressIds)

      Unique identifiers of addresses used as billing addresses.

      Parameters:
      billingAddressIds - value to be set
      Returns:
      Builder
    • plusBillingAddressIds

      public DivisionBuilder plusBillingAddressIds(@Nullable String... billingAddressIds)

      Unique identifiers of addresses used as billing addresses.

      Parameters:
      billingAddressIds - value to be set
      Returns:
      Builder
    • defaultBillingAddressId

      public DivisionBuilder defaultBillingAddressId(@Nullable String defaultBillingAddressId)

      Unique identifier of the address used as the default billing address.

      Parameters:
      defaultBillingAddressId - value to be set
      Returns:
      Builder
    • associateMode

      public DivisionBuilder associateMode(BusinessUnitAssociateMode associateMode)

      Determines whether the Division can inherit Associates from a parent.

      Parameters:
      associateMode - value to be set
      Returns:
      Builder
    • associates

      public DivisionBuilder associates(Associate... associates)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      associates - value to be set
      Returns:
      Builder
    • associates

      public DivisionBuilder associates(List<Associate> associates)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      associates - value to be set
      Returns:
      Builder
    • plusAssociates

      public DivisionBuilder plusAssociates(Associate... associates)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      associates - value to be set
      Returns:
      Builder
    • plusAssociates

      public DivisionBuilder plusAssociates(Function<AssociateBuilder,AssociateBuilder> builder)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      builder - function to build the associates value
      Returns:
      Builder
    • withAssociates

      public DivisionBuilder withAssociates(Function<AssociateBuilder,AssociateBuilder> builder)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      builder - function to build the associates value
      Returns:
      Builder
    • addAssociates

      public DivisionBuilder addAssociates(Function<AssociateBuilder,Associate> builder)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      builder - function to build the associates value
      Returns:
      Builder
    • setAssociates

      public DivisionBuilder setAssociates(Function<AssociateBuilder,Associate> builder)

      Associates that are part of the Business Unit in specific roles.

      Parameters:
      builder - function to build the associates value
      Returns:
      Builder
    • inheritedAssociates

      public DivisionBuilder inheritedAssociates(@Nullable InheritedAssociate... inheritedAssociates)

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      inheritedAssociates - value to be set
      Returns:
      Builder
    • inheritedAssociates

      public DivisionBuilder inheritedAssociates(@Nullable List<InheritedAssociate> inheritedAssociates)

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      inheritedAssociates - value to be set
      Returns:
      Builder
    • plusInheritedAssociates

      public DivisionBuilder plusInheritedAssociates(@Nullable InheritedAssociate... inheritedAssociates)

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      inheritedAssociates - value to be set
      Returns:
      Builder
    • plusInheritedAssociates

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      builder - function to build the inheritedAssociates value
      Returns:
      Builder
    • withInheritedAssociates

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      builder - function to build the inheritedAssociates value
      Returns:
      Builder
    • addInheritedAssociates

      public DivisionBuilder addInheritedAssociates(Function<InheritedAssociateBuilder,InheritedAssociate> builder)

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      builder - function to build the inheritedAssociates value
      Returns:
      Builder
    • setInheritedAssociates

      public DivisionBuilder setInheritedAssociates(Function<InheritedAssociateBuilder,InheritedAssociate> builder)

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Parameters:
      builder - function to build the inheritedAssociates value
      Returns:
      Builder
    • parentUnit

      Parent unit of the Division.

      Parameters:
      builder - function to build the parentUnit value
      Returns:
      Builder
    • withParentUnit

      Parent unit of the Division.

      Parameters:
      builder - function to build the parentUnit value
      Returns:
      Builder
    • parentUnit

      public DivisionBuilder parentUnit(BusinessUnitKeyReference parentUnit)

      Parent unit of the Division.

      Parameters:
      parentUnit - value to be set
      Returns:
      Builder
    • topLevelUnit

      Top-level unit of the Business Unit. The top-level unit is of unitType Company.

      Parameters:
      builder - function to build the topLevelUnit value
      Returns:
      Builder
    • withTopLevelUnit

      Top-level unit of the Business Unit. The top-level unit is of unitType Company.

      Parameters:
      builder - function to build the topLevelUnit value
      Returns:
      Builder
    • topLevelUnit

      public DivisionBuilder topLevelUnit(BusinessUnitKeyReference topLevelUnit)

      Top-level unit of the Business Unit. The top-level unit is of unitType Company.

      Parameters:
      topLevelUnit - value to be set
      Returns:
      Builder
    • getId

      public String getId()

      Unique identifier of the Business Unit.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Business Unit.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Business Unit was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the Business Unit was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the BusinessUnit.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the BusinessUnit.

      Returns:
      createdBy
    • getKey

      public String getKey()

      User-defined unique identifier of the Business Unit.

      Returns:
      key
    • getStatus

      public BusinessUnitStatus getStatus()

      Indicates whether the Business Unit can be edited and used in Orders.

      Returns:
      status
    • getStores

      public List<StoreKeyReference> getStores()

      References to Stores the Business Unit is associated with. Only present when storeMode is Explicit.

      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.

      If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, or Quote Requests must not belong to any Store.

      Returns:
      stores
    • getStoreMode

      public BusinessUnitStoreMode getStoreMode()

      Defines whether the Stores of the Division are set explicitly or inherited from a parent Business Unit.

      Returns:
      storeMode
    • getName

      public String getName()

      Name of the Business Unit.

      Returns:
      name
    • getContactEmail

      @Nullable public String getContactEmail()

      Email address of the Business Unit.

      Returns:
      contactEmail
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields for the Business Unit.

      Returns:
      custom
    • getAddresses

      public List<Address> getAddresses()

      Addresses used by the Business Unit.

      Returns:
      addresses
    • getShippingAddressIds

      @Nullable public List<String> getShippingAddressIds()

      Unique identifiers of addresses used as shipping addresses.

      Returns:
      shippingAddressIds
    • getDefaultShippingAddressId

      @Nullable public String getDefaultShippingAddressId()

      Unique identifier of the address used as the default shipping address.

      Returns:
      defaultShippingAddressId
    • getBillingAddressIds

      @Nullable public List<String> getBillingAddressIds()

      Unique identifiers of addresses used as billing addresses.

      Returns:
      billingAddressIds
    • getDefaultBillingAddressId

      @Nullable public String getDefaultBillingAddressId()

      Unique identifier of the address used as the default billing address.

      Returns:
      defaultBillingAddressId
    • getAssociateMode

      public BusinessUnitAssociateMode getAssociateMode()

      Determines whether the Division can inherit Associates from a parent.

      Returns:
      associateMode
    • getAssociates

      public List<Associate> getAssociates()

      Associates that are part of the Business Unit in specific roles.

      Returns:
      associates
    • getInheritedAssociates

      @Nullable public List<InheritedAssociate> getInheritedAssociates()

      Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent.

      Returns:
      inheritedAssociates
    • getParentUnit

      public BusinessUnitKeyReference getParentUnit()

      Parent unit of the Division.

      Returns:
      parentUnit
    • getTopLevelUnit

      public BusinessUnitKeyReference getTopLevelUnit()

      Top-level unit of the Business Unit. The top-level unit is of unitType Company.

      Returns:
      topLevelUnit
    • build

      public Division build()
      builds Division with checking for non-null required values
      Specified by:
      build in interface Builder<Division>
      Returns:
      Division
    • buildUnchecked

      public Division buildUnchecked()
      builds Division without checking for non-null required values
      Returns:
      Division
    • of

      public static DivisionBuilder of()
      factory method for an instance of DivisionBuilder
      Returns:
      builder
    • of

      public static DivisionBuilder of(Division template)
      create builder for Division instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder