Class CompanyBuilder

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

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

     Company company = Company.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)
             .storeMode(BusinessUnitStoreMode.EXPLICIT)
             .name("{name}")
             .plusAddresses(addressesBuilder -> addressesBuilder)
             .associateMode(BusinessUnitAssociateMode.EXPLICIT)
             .plusAssociates(associatesBuilder -> associatesBuilder)
             .topLevelUnit(topLevelUnitBuilder -> topLevelUnitBuilder)
             .approvalRuleMode(BusinessUnitApprovalRuleMode.EXPLICIT)
             .build()
 
  • Constructor Details

    • CompanyBuilder

      public CompanyBuilder()
  • Method Details

    • id

      public CompanyBuilder id(String id)

      Unique identifier of the Business Unit.

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

      public CompanyBuilder version(Long version)

      Current version of the Business Unit.

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

      public CompanyBuilder createdAt(ZonedDateTime createdAt)

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

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

      public CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder withCreatedBy(Function<CreatedByBuilder,CreatedBy> builder)

      IDs and references that created the BusinessUnit.

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

      public CompanyBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the BusinessUnit.

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

      public CompanyBuilder key(String key)

      User-defined unique and immutable identifier of the Business Unit.

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

      public CompanyBuilder 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 CompanyBuilder stores(@Nullable 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

      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 CompanyBuilder plusStores(@Nullable 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 CompanyBuilder storeMode(BusinessUnitStoreMode storeMode)

      The value of this field is always Explicit because a Company cannot have a parent Business Unit that Stores can be inherited from.

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

      public CompanyBuilder name(String name)

      Name of the Business Unit.

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

      public CompanyBuilder 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 CompanyBuilder custom(@Nullable CustomFields custom)

      Custom Fields for the Business Unit.

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

      public CompanyBuilder addresses(Address... addresses)

      Addresses used by the Business Unit.

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

      public CompanyBuilder addresses(List<Address> addresses)

      Addresses used by the Business Unit.

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

      public CompanyBuilder plusAddresses(Address... addresses)

      Addresses used by the Business Unit.

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

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

      Addresses used by the Business Unit.

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

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

      Addresses used by the Business Unit.

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

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

      Addresses used by the Business Unit.

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

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

      Addresses used by the Business Unit.

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

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

      Unique identifiers of addresses used as shipping addresses.

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

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

      Unique identifiers of addresses used as shipping addresses.

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

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

      Unique identifiers of addresses used as shipping addresses.

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

      public CompanyBuilder 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 CompanyBuilder billingAddressIds(@Nullable String... billingAddressIds)

      Unique identifiers of addresses used as billing addresses.

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

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

      Unique identifiers of addresses used as billing addresses.

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

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

      Unique identifiers of addresses used as billing addresses.

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

      public CompanyBuilder 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 CompanyBuilder associateMode(BusinessUnitAssociateMode associateMode)

      The value of this field is always Explicit because a Company cannot have a parent Business Unit that Associates can be inherited from.

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

      public CompanyBuilder associates(Associate... associates)

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

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

      public CompanyBuilder 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 CompanyBuilder plusAssociates(Associate... associates)

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

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

      public CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 CompanyBuilder 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 Business Unit. Only present when the unitType is Division.

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

      Parent unit of the Business Unit. Only present when the unitType is Division.

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

      public CompanyBuilder parentUnit(@Nullable BusinessUnitKeyReference parentUnit)

      Parent unit of the Business Unit. Only present when the unitType is 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 CompanyBuilder 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
    • approvalRuleMode

      public CompanyBuilder approvalRuleMode(BusinessUnitApprovalRuleMode approvalRuleMode)

      The value of this field is always Explicit because a Company cannot have a parent Business Unit that Approval Rules can be inherited from.

      Parameters:
      approvalRuleMode - 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 and immutable 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

      @Nullable 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()

      The value of this field is always Explicit because a Company cannot have a parent Business Unit that Stores can be inherited from.

      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()

      The value of this field is always Explicit because a Company cannot have a parent Business Unit that Associates can be inherited from.

      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

      @Nullable public BusinessUnitKeyReference getParentUnit()

      Parent unit of the Business Unit. Only present when the unitType is Division.

      Returns:
      parentUnit
    • getTopLevelUnit

      public BusinessUnitKeyReference getTopLevelUnit()

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

      Returns:
      topLevelUnit
    • getApprovalRuleMode

      public BusinessUnitApprovalRuleMode getApprovalRuleMode()

      The value of this field is always Explicit because a Company cannot have a parent Business Unit that Approval Rules can be inherited from.

      Returns:
      approvalRuleMode
    • build

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

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

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

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