Interface BusinessUnitDraft

All Superinterfaces:
WithKey
All Known Subinterfaces:
CompanyDraft, DivisionDraft

public interface BusinessUnitDraft extends WithKey

Generic draft type to model those fields all Business Units have in common. The additional fields required for creating a Company or Division are represented on CompanyDraft and DivisionDraft.


Example to create a subtype instance using the builder pattern

     BusinessUnitDraft businessUnitDraft = BusinessUnitDraft.companyBuilder()
             key("{key}")
             name("{name}")
             .build()
 
  • Method Details

    • getKey

      @NotNull @NotNull String getKey()

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

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

      BusinessUnitStatus getStatus()

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

      Returns:
      status
    • getStores

      @Valid @Valid List<StoreResourceIdentifier> getStores()

      Sets the Stores the Business Unit is associated with. Can only be set when storeMode is Explicit. Defaults to empty for Companies and not set for Divisions.

      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

      BusinessUnitStoreMode getStoreMode()

      Defines whether the Stores of the Business Unit are set directly on the Business Unit or are inherited from a parent. storeMode is always Explicit for Companies and defaults to FromParent for Divisions.

      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
    • getAssociateMode

      BusinessUnitAssociateMode getAssociateMode()

      Determines whether the Business Unit can inherit Associates from a parent. Always Explicit for Companies and defaults to ExplicitAndFromParent for Divisions.

      Returns:
      associateMode
    • getAssociates

      @Valid @Valid List<AssociateDraft> getAssociates()

      List of members that are part of the Business Unit in specific roles.

      Returns:
      associates
    • getApprovalRuleMode

      BusinessUnitApprovalRuleMode getApprovalRuleMode()

      Determines whether the Business Unit can inherit Approval Rules from a parent. For Companies, the value of this field is always Explicit. For Divisions, the default value is ExplicitAndFromParent.

      Returns:
      approvalRuleMode
    • getAddresses

      @Valid @Valid List<BaseAddress> getAddresses()

      Addresses used by the Business Unit.

      Returns:
      addresses
    • getShippingAddresses

      List<Integer> getShippingAddresses()

      Indexes of entries in addresses to set as shipping addresses. The shippingAddressIds of the Customer will be replaced by these addresses.

      Returns:
      shippingAddresses
    • getDefaultShippingAddress

      Integer getDefaultShippingAddress()

      Index of the entry in addresses to set as the default shipping address.

      Returns:
      defaultShippingAddress
    • getBillingAddresses

      List<Integer> getBillingAddresses()

      Indexes of entries in addresses to set as billing addresses. The billingAddressIds of the Customer will be replaced by these addresses.

      Returns:
      billingAddresses
    • getDefaultBillingAddress

      Integer getDefaultBillingAddress()

      Index of the entry in addresses to set as the default billing address.

      Returns:
      defaultBillingAddress
    • getCustom

      @Valid @Valid CustomFieldsDraft getCustom()

      Custom Fields for the Business Unit.

      Returns:
      custom
    • setKey

      void setKey(String key)

      User-defined unique and immutable identifier for 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(StoreResourceIdentifier... stores)

      Sets the Stores the Business Unit is associated with. Can only be set when storeMode is Explicit. Defaults to empty for Companies and not set for Divisions.

      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<StoreResourceIdentifier> stores)

      Sets the Stores the Business Unit is associated with. Can only be set when storeMode is Explicit. Defaults to empty for Companies and not set for Divisions.

      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. storeMode is always Explicit for Companies and defaults to FromParent for Divisions.

      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
    • setAssociateMode

      void setAssociateMode(BusinessUnitAssociateMode associateMode)

      Determines whether the Business Unit can inherit Associates from a parent. Always Explicit for Companies and defaults to ExplicitAndFromParent for Divisions.

      Parameters:
      associateMode - value to be set
    • setAssociates

      void setAssociates(AssociateDraft... associates)

      List of members that are part of the Business Unit in specific roles.

      Parameters:
      associates - values to be set
    • setAssociates

      void setAssociates(List<AssociateDraft> associates)

      List of members that are part of the Business Unit in specific roles.

      Parameters:
      associates - values to be set
    • setApprovalRuleMode

      void setApprovalRuleMode(BusinessUnitApprovalRuleMode approvalRuleMode)

      Determines whether the Business Unit can inherit Approval Rules from a parent. For Companies, the value of this field is always Explicit. For Divisions, the default value is ExplicitAndFromParent.

      Parameters:
      approvalRuleMode - value to be set
    • setAddresses

      void setAddresses(BaseAddress... addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - values to be set
    • setAddresses

      void setAddresses(List<BaseAddress> addresses)

      Addresses used by the Business Unit.

      Parameters:
      addresses - values to be set
    • setShippingAddresses

      void setShippingAddresses(Integer... shippingAddresses)

      Indexes of entries in addresses to set as shipping addresses. The shippingAddressIds of the Customer will be replaced by these addresses.

      Parameters:
      shippingAddresses - values to be set
    • setShippingAddresses

      void setShippingAddresses(List<Integer> shippingAddresses)

      Indexes of entries in addresses to set as shipping addresses. The shippingAddressIds of the Customer will be replaced by these addresses.

      Parameters:
      shippingAddresses - values to be set
    • setDefaultShippingAddress

      void setDefaultShippingAddress(Integer defaultShippingAddress)

      Index of the entry in addresses to set as the default shipping address.

      Parameters:
      defaultShippingAddress - value to be set
    • setBillingAddresses

      void setBillingAddresses(Integer... billingAddresses)

      Indexes of entries in addresses to set as billing addresses. The billingAddressIds of the Customer will be replaced by these addresses.

      Parameters:
      billingAddresses - values to be set
    • setBillingAddresses

      void setBillingAddresses(List<Integer> billingAddresses)

      Indexes of entries in addresses to set as billing addresses. The billingAddressIds of the Customer will be replaced by these addresses.

      Parameters:
      billingAddresses - values to be set
    • setDefaultBillingAddress

      void setDefaultBillingAddress(Integer defaultBillingAddress)

      Index of the entry in addresses to set as the default billing address.

      Parameters:
      defaultBillingAddress - value to be set
    • setCustom

      void setCustom(CustomFieldsDraft custom)

      Custom Fields for the Business Unit.

      Parameters:
      custom - value to be set
    • deepCopy

      factory method to create a deep copy of BusinessUnitDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • companyBuilder

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

      static DivisionDraftBuilder divisionBuilder()
      builder for division subtype
      Returns:
      builder
    • withBusinessUnitDraft

      default <T> T withBusinessUnitDraft(Function<BusinessUnitDraft,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<BusinessUnitDraft> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference