Class ApprovalRuleBuilder

java.lang.Object
com.commercetools.api.models.approval_rule.ApprovalRuleBuilder
All Implemented Interfaces:
Builder<ApprovalRule>

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

     ApprovalRule approvalRule = ApprovalRule.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .name("{name}")
             .status(ApprovalRuleStatus.ACTIVE)
             .predicate("{predicate}")
             .approvers(approversBuilder -> approversBuilder)
             .plusRequesters(requestersBuilder -> requestersBuilder)
             .businessUnit(businessUnitBuilder -> businessUnitBuilder)
             .build()
 
  • Constructor Details

    • ApprovalRuleBuilder

      public ApprovalRuleBuilder()
  • Method Details

    • id

      public ApprovalRuleBuilder id(String id)

      Unique identifier of the Approval Rule.

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

      public ApprovalRuleBuilder version(Long version)

      Current version of the Approval Rule.

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

      public ApprovalRuleBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the Approval Rule was initially created.

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

      public ApprovalRuleBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the Approval Rule was last updated.

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

      IDs and references that created the ApprovalRule.

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

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

      IDs and references that created the ApprovalRule.

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

      public ApprovalRuleBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the ApprovalRule.

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

      IDs and references that last modified the ApprovalRule.

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

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

      IDs and references that last modified the ApprovalRule.

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

      public ApprovalRuleBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the ApprovalRule.

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

      User-defined unique identifier of the Approval Rule. Must be unique within a Business Unit.

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

      public ApprovalRuleBuilder name(String name)

      Name of the Approval Rule.

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

      public ApprovalRuleBuilder description(@Nullable String description)

      Description of the Approval Rule.

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

      public ApprovalRuleBuilder status(ApprovalRuleStatus status)

      Indicates whether the Approval Rule should be matched against Orders or not.

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

      public ApprovalRuleBuilder predicate(String predicate)

      The Order Predicate describing the Orders the Approval Rule should match against.

      Parameters:
      predicate - value to be set
      Returns:
      Builder
    • approvers

      The hierarchy of approvers within the Approval Rule.

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

      The hierarchy of approvers within the Approval Rule.

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

      public ApprovalRuleBuilder approvers(ApproverHierarchy approvers)

      The hierarchy of approvers within the Approval Rule.

      Parameters:
      approvers - value to be set
      Returns:
      Builder
    • requesters

      public ApprovalRuleBuilder requesters(RuleRequester... requesters)

      The Associate Roles customers must hold for their Order to require approval.

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

      public ApprovalRuleBuilder requesters(List<RuleRequester> requesters)

      The Associate Roles customers must hold for their Order to require approval.

      Parameters:
      requesters - value to be set
      Returns:
      Builder
    • plusRequesters

      public ApprovalRuleBuilder plusRequesters(RuleRequester... requesters)

      The Associate Roles customers must hold for their Order to require approval.

      Parameters:
      requesters - value to be set
      Returns:
      Builder
    • plusRequesters

      The Associate Roles customers must hold for their Order to require approval.

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

      The Associate Roles customers must hold for their Order to require approval.

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

      The Associate Roles customers must hold for their Order to require approval.

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

      The Associate Roles customers must hold for their Order to require approval.

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

      The Business Unit the Approval Rule belongs to.

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

      The Business Unit the Approval Rule belongs to.

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

      public ApprovalRuleBuilder businessUnit(BusinessUnitKeyReference businessUnit)

      The Business Unit the Approval Rule belongs to.

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

      Custom Fields on the Approval Rule.

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

      Custom Fields on the Approval Rule.

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

      public ApprovalRuleBuilder custom(@Nullable CustomFields custom)

      Custom Fields on the Approval Rule.

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

      public String getId()

      Unique identifier of the Approval Rule.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Approval Rule.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Approval Rule was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) the Approval Rule was last updated.

      Returns:
      lastModifiedAt
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the ApprovalRule.

      Returns:
      createdBy
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the ApprovalRule.

      Returns:
      lastModifiedBy
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the Approval Rule. Must be unique within a Business Unit.

      Returns:
      key
    • getName

      public String getName()

      Name of the Approval Rule.

      Returns:
      name
    • getDescription

      @Nullable public String getDescription()

      Description of the Approval Rule.

      Returns:
      description
    • getStatus

      public ApprovalRuleStatus getStatus()

      Indicates whether the Approval Rule should be matched against Orders or not.

      Returns:
      status
    • getPredicate

      public String getPredicate()

      The Order Predicate describing the Orders the Approval Rule should match against.

      Returns:
      predicate
    • getApprovers

      public ApproverHierarchy getApprovers()

      The hierarchy of approvers within the Approval Rule.

      Returns:
      approvers
    • getRequesters

      public List<RuleRequester> getRequesters()

      The Associate Roles customers must hold for their Order to require approval.

      Returns:
      requesters
    • getBusinessUnit

      public BusinessUnitKeyReference getBusinessUnit()

      The Business Unit the Approval Rule belongs to.

      Returns:
      businessUnit
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields on the Approval Rule.

      Returns:
      custom
    • build

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

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

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

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