Interface BusinessUnit

All Superinterfaces:
BaseResource, WithKey
All Known Subinterfaces:
Company, Division

public interface BusinessUnit extends BaseResource, WithKey

Generic type to model the fields that all types of Business Units have in common.


Example to create a subtype instance using the builder pattern

     BusinessUnit businessUnit = BusinessUnit.companyBuilder()
             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)
             topLevelUnit(topLevelUnitBuilder -> topLevelUnitBuilder)
             .build()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the Business Unit.

      Specified by:
      getId in interface BaseResource
      Returns:
      id
    • getVersion

      @NotNull @NotNull Long getVersion()

      Current version of the Business Unit.

      Specified by:
      getVersion in interface BaseResource
      Returns:
      version
    • getCreatedAt

      @NotNull @NotNull ZonedDateTime getCreatedAt()

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

      Specified by:
      getCreatedAt in interface BaseResource
      Returns:
      createdAt
    • getLastModifiedAt

      @NotNull @NotNull ZonedDateTime getLastModifiedAt()

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

      Specified by:
      getLastModifiedAt in interface BaseResource
      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Valid @Valid LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the BusinessUnit.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Valid @Valid CreatedBy getCreatedBy()

      IDs and references that created the BusinessUnit.

      Returns:
      createdBy
    • getKey

      @NotNull @NotNull String getKey()

      User-defined unique identifier of the Business Unit.

      Specified by:
      getKey in interface WithKey
      Returns:
      key
    • getStatus

      @NotNull @NotNull BusinessUnitStatus getStatus()

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

      Returns:
      status
    • getStores

      @NotNull @Valid @NotNull @Valid 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

      @NotNull @NotNull BusinessUnitStoreMode getStoreMode()

      Defines whether the Stores of the Business Unit are set directly on the Business Unit or are inherited from a parent.

      Returns:
      storeMode
    • getUnitType

      @NotNull @NotNull BusinessUnitType getUnitType()

      Type of the Business Unit indicating its position in a hierarchy.

      Returns:
      unitType
    • getName

      @NotNull @NotNull String getName()

      Name of the Business Unit.

      Returns:
      name
    • getContactEmail

      String getContactEmail()

      Email address of the Business Unit.

      Returns:
      contactEmail
    • getCustom

      @Valid @Valid CustomFields getCustom()

      Custom Fields for the Business Unit.

      Returns:
      custom
    • getAddresses

      @NotNull @Valid @NotNull @Valid List<Address> getAddresses()

      Addresses used by the Business Unit.

      Returns:
      addresses
    • getShippingAddressIds

      List<String> getShippingAddressIds()

      Unique identifiers of addresses used as shipping addresses.

      Returns:
      shippingAddressIds
    • getDefaultShippingAddressId

      String getDefaultShippingAddressId()

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

      Returns:
      defaultShippingAddressId
    • getBillingAddressIds

      List<String> getBillingAddressIds()

      Unique identifiers of addresses used as billing addresses.

      Returns:
      billingAddressIds
    • getDefaultBillingAddressId

      String getDefaultBillingAddressId()

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

      Returns:
      defaultBillingAddressId
    • getAssociateMode

      @NotNull @NotNull BusinessUnitAssociateMode getAssociateMode()

      Set to Explicit to prevent the Business Unit inheriting Associates from a parent, set to ExplicitAndFromParent to enable inheritance.

      Returns:
      associateMode
    • getAssociates

      @NotNull @Valid @NotNull @Valid List<Associate> getAssociates()

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

      Returns:
      associates
    • getInheritedAssociates

      @Valid @Valid 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

      @Valid @Valid BusinessUnitKeyReference getParentUnit()

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

      Returns:
      parentUnit
    • getTopLevelUnit

      @NotNull @Valid @NotNull @Valid BusinessUnitKeyReference getTopLevelUnit()

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

      Returns:
      topLevelUnit
    • setId

      void setId(String id)

      Unique identifier of the Business Unit.

      Specified by:
      setId in interface BaseResource
      Parameters:
      id - value to be set
    • setVersion

      void setVersion(Long version)

      Current version of the Business Unit.

      Specified by:
      setVersion in interface BaseResource
      Parameters:
      version - value to be set
    • setCreatedAt

      void setCreatedAt(ZonedDateTime createdAt)

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

      Specified by:
      setCreatedAt in interface BaseResource
      Parameters:
      createdAt - value to be set
    • setLastModifiedAt

      void setLastModifiedAt(ZonedDateTime lastModifiedAt)

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

      Specified by:
      setLastModifiedAt in interface BaseResource
      Parameters:
      lastModifiedAt - value to be set
    • setLastModifiedBy

      void setLastModifiedBy(LastModifiedBy lastModifiedBy)

      IDs and references that last modified the BusinessUnit.

      Parameters:
      lastModifiedBy - value to be set
    • setCreatedBy

      void setCreatedBy(CreatedBy createdBy)

      IDs and references that created the BusinessUnit.

      Parameters:
      createdBy - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier of the Business Unit.

      Parameters:
      key - value to be set
    • setStatus

      void setStatus(BusinessUnitStatus status)

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

      Parameters:
      status - value to be set
    • setStores

      void setStores(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 - values to be set
    • setStores

      void setStores(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 - values to be set
    • setStoreMode

      void setStoreMode(BusinessUnitStoreMode storeMode)

      Defines whether the Stores of the Business Unit are set directly on the Business Unit or are inherited from a parent.

      Parameters:
      storeMode - value to be set
    • setName

      void setName(String name)

      Name of the Business Unit.

      Parameters:
      name - value to be set
    • setContactEmail

      void setContactEmail(String contactEmail)

      Email address of the Business Unit.

      Parameters:
      contactEmail - value to be set
    • setCustom

      void setCustom(CustomFields custom)

      Custom Fields for the Business Unit.

      Parameters:
      custom - value to be set
    • setAddresses

      void setAddresses(Address... addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - values to be set
    • setAddresses

      void setAddresses(List<Address> addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - values to be set
    • setShippingAddressIds

      void setShippingAddressIds(String... shippingAddressIds)

      Unique identifiers of addresses used as shipping addresses.

      Parameters:
      shippingAddressIds - values to be set
    • setShippingAddressIds

      void setShippingAddressIds(List<String> shippingAddressIds)

      Unique identifiers of addresses used as shipping addresses.

      Parameters:
      shippingAddressIds - values to be set
    • setDefaultShippingAddressId

      void setDefaultShippingAddressId(String defaultShippingAddressId)

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

      Parameters:
      defaultShippingAddressId - value to be set
    • setBillingAddressIds

      void setBillingAddressIds(String... billingAddressIds)

      Unique identifiers of addresses used as billing addresses.

      Parameters:
      billingAddressIds - values to be set
    • setBillingAddressIds

      void setBillingAddressIds(List<String> billingAddressIds)

      Unique identifiers of addresses used as billing addresses.

      Parameters:
      billingAddressIds - values to be set
    • setDefaultBillingAddressId

      void setDefaultBillingAddressId(String defaultBillingAddressId)

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

      Parameters:
      defaultBillingAddressId - value to be set
    • setAssociateMode

      void setAssociateMode(BusinessUnitAssociateMode associateMode)

      Set to Explicit to prevent the Business Unit inheriting Associates from a parent, set to ExplicitAndFromParent to enable inheritance.

      Parameters:
      associateMode - value to be set
    • setAssociates

      void setAssociates(Associate... associates)

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

      Parameters:
      associates - values to be set
    • setAssociates

      void setAssociates(List<Associate> associates)

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

      Parameters:
      associates - values to be set
    • setInheritedAssociates

      void setInheritedAssociates(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 - values to be set
    • setInheritedAssociates

      void setInheritedAssociates(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 - values to be set
    • setParentUnit

      void setParentUnit(BusinessUnitKeyReference parentUnit)

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

      Parameters:
      parentUnit - value to be set
    • setTopLevelUnit

      void setTopLevelUnit(BusinessUnitKeyReference topLevelUnit)

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

      Parameters:
      topLevelUnit - value to be set
    • deepCopy

      @Nullable static BusinessUnit deepCopy(@Nullable BusinessUnit template)
      factory method to create a deep copy of BusinessUnit
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • companyBuilder

      static CompanyBuilder companyBuilder()
      builder for company subtype
      Returns:
      builder
    • divisionBuilder

      static DivisionBuilder divisionBuilder()
      builder for division subtype
      Returns:
      builder
    • withBusinessUnit

      default <T> T withBusinessUnit(Function<BusinessUnit,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<BusinessUnit> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference