Class ApprovalFlowBuilder

java.lang.Object
com.commercetools.api.models.approval_flow.ApprovalFlowBuilder
All Implemented Interfaces:
Builder<ApprovalFlow>

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

     ApprovalFlow approvalFlow = ApprovalFlow.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .order(orderBuilder -> orderBuilder)
             .businessUnit(businessUnitBuilder -> businessUnitBuilder)
             .plusRules(rulesBuilder -> rulesBuilder)
             .status(ApprovalFlowStatus.PENDING)
             .plusApprovals(approvalsBuilder -> approvalsBuilder)
             .plusEligibleApprovers(eligibleApproversBuilder -> eligibleApproversBuilder)
             .plusPendingApprovers(pendingApproversBuilder -> pendingApproversBuilder)
             .plusCurrentTierPendingApprovers(currentTierPendingApproversBuilder -> currentTierPendingApproversBuilder)
             .build()
 
  • Constructor Details

    • ApprovalFlowBuilder

      public ApprovalFlowBuilder()
  • Method Details

    • id

      public ApprovalFlowBuilder id(String id)

      Unique identifier of the Approval Flow.

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

      public ApprovalFlowBuilder version(Long version)

      Current version of the Approval Flow.

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

      public ApprovalFlowBuilder createdAt(ZonedDateTime createdAt)

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

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

      public ApprovalFlowBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

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

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

      IDs and references that created the ApprovalFlow.

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

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

      IDs and references that created the ApprovalFlow.

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

      public ApprovalFlowBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the ApprovalFlow.

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

      IDs and references that last modified the ApprovalFlow.

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

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

      IDs and references that last modified the ApprovalFlow.

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

      public ApprovalFlowBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the ApprovalFlow.

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

      Order that needs to be approved.

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

      Order that needs to be approved.

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

      public ApprovalFlowBuilder order(OrderReference order)

      Order that needs to be approved.

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

      Business Unit the Approval Flow belongs to.

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

      Business Unit the Approval Flow belongs to.

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

      public ApprovalFlowBuilder businessUnit(BusinessUnitKeyReference businessUnit)

      Business Unit the Approval Flow belongs to.

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

      public ApprovalFlowBuilder rules(ApprovalRule... rules)

      Approval Rules that matched the Order.

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

      public ApprovalFlowBuilder rules(List<ApprovalRule> rules)

      Approval Rules that matched the Order.

      Parameters:
      rules - value to be set
      Returns:
      Builder
    • plusRules

      public ApprovalFlowBuilder plusRules(ApprovalRule... rules)

      Approval Rules that matched the Order.

      Parameters:
      rules - value to be set
      Returns:
      Builder
    • plusRules

      Approval Rules that matched the Order.

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

      Approval Rules that matched the Order.

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

      Approval Rules that matched the Order.

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

      Approval Rules that matched the Order.

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

      public ApprovalFlowBuilder status(ApprovalFlowStatus status)

      Indicates whether the Approval Flow is under review, approved, or rejected.

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

      Present when the status of the Approval Flow is Rejected.

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

      Present when the status of the Approval Flow is Rejected.

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

      public ApprovalFlowBuilder rejection(@Nullable ApprovalFlowRejection rejection)

      Present when the status of the Approval Flow is Rejected.

      Parameters:
      rejection - value to be set
      Returns:
      Builder
    • approvals

      public ApprovalFlowBuilder approvals(ApprovalFlowApproval... approvals)

      Existing approvals in the Approval Flow.

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

      public ApprovalFlowBuilder approvals(List<ApprovalFlowApproval> approvals)

      Existing approvals in the Approval Flow.

      Parameters:
      approvals - value to be set
      Returns:
      Builder
    • plusApprovals

      public ApprovalFlowBuilder plusApprovals(ApprovalFlowApproval... approvals)

      Existing approvals in the Approval Flow.

      Parameters:
      approvals - value to be set
      Returns:
      Builder
    • plusApprovals

      Existing approvals in the Approval Flow.

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

      Existing approvals in the Approval Flow.

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

      Existing approvals in the Approval Flow.

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

      Existing approvals in the Approval Flow.

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

      public ApprovalFlowBuilder eligibleApprovers(RuleApprover... eligibleApprovers)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

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

      public ApprovalFlowBuilder eligibleApprovers(List<RuleApprover> eligibleApprovers)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

      Parameters:
      eligibleApprovers - value to be set
      Returns:
      Builder
    • plusEligibleApprovers

      public ApprovalFlowBuilder plusEligibleApprovers(RuleApprover... eligibleApprovers)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

      Parameters:
      eligibleApprovers - value to be set
      Returns:
      Builder
    • plusEligibleApprovers

      public ApprovalFlowBuilder plusEligibleApprovers(Function<RuleApproverBuilder,RuleApproverBuilder> builder)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

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

      public ApprovalFlowBuilder withEligibleApprovers(Function<RuleApproverBuilder,RuleApproverBuilder> builder)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

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

      public ApprovalFlowBuilder addEligibleApprovers(Function<RuleApproverBuilder,RuleApprover> builder)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

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

      public ApprovalFlowBuilder setEligibleApprovers(Function<RuleApproverBuilder,RuleApprover> builder)

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

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

      public ApprovalFlowBuilder pendingApprovers(RuleApprover... pendingApprovers)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

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

      public ApprovalFlowBuilder pendingApprovers(List<RuleApprover> pendingApprovers)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

      Parameters:
      pendingApprovers - value to be set
      Returns:
      Builder
    • plusPendingApprovers

      public ApprovalFlowBuilder plusPendingApprovers(RuleApprover... pendingApprovers)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

      Parameters:
      pendingApprovers - value to be set
      Returns:
      Builder
    • plusPendingApprovers

      public ApprovalFlowBuilder plusPendingApprovers(Function<RuleApproverBuilder,RuleApproverBuilder> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

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

      public ApprovalFlowBuilder withPendingApprovers(Function<RuleApproverBuilder,RuleApproverBuilder> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

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

      public ApprovalFlowBuilder addPendingApprovers(Function<RuleApproverBuilder,RuleApprover> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

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

      public ApprovalFlowBuilder setPendingApprovers(Function<RuleApproverBuilder,RuleApprover> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

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

      public ApprovalFlowBuilder currentTierPendingApprovers(RuleApprover... currentTierPendingApprovers)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

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

      public ApprovalFlowBuilder currentTierPendingApprovers(List<RuleApprover> currentTierPendingApprovers)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

      Parameters:
      currentTierPendingApprovers - value to be set
      Returns:
      Builder
    • plusCurrentTierPendingApprovers

      public ApprovalFlowBuilder plusCurrentTierPendingApprovers(RuleApprover... currentTierPendingApprovers)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

      Parameters:
      currentTierPendingApprovers - value to be set
      Returns:
      Builder
    • plusCurrentTierPendingApprovers

      public ApprovalFlowBuilder plusCurrentTierPendingApprovers(Function<RuleApproverBuilder,RuleApproverBuilder> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

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

      public ApprovalFlowBuilder withCurrentTierPendingApprovers(Function<RuleApproverBuilder,RuleApproverBuilder> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

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

      public ApprovalFlowBuilder addCurrentTierPendingApprovers(Function<RuleApproverBuilder,RuleApprover> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

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

      public ApprovalFlowBuilder setCurrentTierPendingApprovers(Function<RuleApproverBuilder,RuleApprover> builder)

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

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

      Custom Fields on the Approval Flow.

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

      Custom Fields on the Approval Flow.

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

      public ApprovalFlowBuilder custom(@Nullable CustomFields custom)

      Custom Fields on the Approval Flow.

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

      public String getId()

      Unique identifier of the Approval Flow.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the Approval Flow.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

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

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

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

      Returns:
      lastModifiedAt
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the ApprovalFlow.

      Returns:
      createdBy
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the ApprovalFlow.

      Returns:
      lastModifiedBy
    • getOrder

      public OrderReference getOrder()

      Order that needs to be approved.

      Returns:
      order
    • getBusinessUnit

      public BusinessUnitKeyReference getBusinessUnit()

      Business Unit the Approval Flow belongs to.

      Returns:
      businessUnit
    • getRules

      public List<ApprovalRule> getRules()

      Approval Rules that matched the Order.

      Returns:
      rules
    • getStatus

      public ApprovalFlowStatus getStatus()

      Indicates whether the Approval Flow is under review, approved, or rejected.

      Returns:
      status
    • getRejection

      @Nullable public ApprovalFlowRejection getRejection()

      Present when the status of the Approval Flow is Rejected.

      Returns:
      rejection
    • getApprovals

      public List<ApprovalFlowApproval> getApprovals()

      Existing approvals in the Approval Flow.

      Returns:
      approvals
    • getEligibleApprovers

      public List<RuleApprover> getEligibleApprovers()

      Associate Roles that can approve according to the approver hierarchy tiers defined in rules. Associates are allowed to reject even after they have given approval, as long as the current approver hierarchy tier still contains their role.

      Returns:
      eligibleApprovers
    • getPendingApprovers

      public List<RuleApprover> getPendingApprovers()

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules across all remaining tiers.

      Returns:
      pendingApprovers
    • getCurrentTierPendingApprovers

      public List<RuleApprover> getCurrentTierPendingApprovers()

      Associate Roles required for approval based on the approver hierarchy tiers defined in rules only for the currently active tier(s).

      Returns:
      currentTierPendingApprovers
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields on the Approval Flow.

      Returns:
      custom
    • build

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

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

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

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