Class RecurringOrderBuilder

java.lang.Object
com.commercetools.api.models.recurring_order.RecurringOrderBuilder
All Implemented Interfaces:
Builder<RecurringOrder>

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

     RecurringOrder recurringOrder = RecurringOrder.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .cart(cartBuilder -> cartBuilder)
             .originOrder(originOrderBuilder -> originOrderBuilder)
             .startsAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .recurringOrderState(RecurringOrderState.ACTIVE)
             .schedule(scheduleBuilder -> scheduleBuilder)
             .build()
 
  • Constructor Details

    • RecurringOrderBuilder

      public RecurringOrderBuilder()
  • Method Details

    • id

      public RecurringOrderBuilder id(String id)

      Unique identifier of the RecurringOrder.

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

      public RecurringOrderBuilder version(Long version)

      Current version of the RecurringOrder.

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

      public RecurringOrderBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) when the RecurringOrder was created.

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

      public RecurringOrderBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) when the RecurringOrder was last updated.

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

      public RecurringOrderBuilder key(@Nullable String key)

      User-defined unique identifier of the RecurringOrder.

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

      Reference to the Cart for a RecurringOrder. The referenced Cart will have the RecurringOrder CartOrigin.

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

      Reference to the Cart for a RecurringOrder. The referenced Cart will have the RecurringOrder CartOrigin.

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

      Reference to the Cart for a RecurringOrder. The referenced Cart will have the RecurringOrder CartOrigin.

      Parameters:
      cart - value to be set
      Returns:
      Builder
    • originOrder

      Reference to the original Order that generated this RecurringOrder. This field is automatically populated when the RecurringOrder is created via the Create Order from Cart endpoint and the Cart contains Line Items with defined recurrenceInfo. When the RecurringOrder is created directly via the Create RecurringOrder endpoint, this field remains empty.

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

      Reference to the original Order that generated this RecurringOrder. This field is automatically populated when the RecurringOrder is created via the Create Order from Cart endpoint and the Cart contains Line Items with defined recurrenceInfo. When the RecurringOrder is created directly via the Create RecurringOrder endpoint, this field remains empty.

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

      public RecurringOrderBuilder originOrder(OrderReference originOrder)

      Reference to the original Order that generated this RecurringOrder. This field is automatically populated when the RecurringOrder is created via the Create Order from Cart endpoint and the Cart contains Line Items with defined recurrenceInfo. When the RecurringOrder is created directly via the Create RecurringOrder endpoint, this field remains empty.

      Parameters:
      originOrder - value to be set
      Returns:
      Builder
    • startsAt

      public RecurringOrderBuilder startsAt(ZonedDateTime startsAt)

      Date and time (UTC) when the RecurringOrder starts creating new Orders.

      Parameters:
      startsAt - value to be set
      Returns:
      Builder
    • resumesAt

      public RecurringOrderBuilder resumesAt(@Nullable ZonedDateTime resumesAt)

      Date and time (UTC) when the RecurringOrder resumes creating Orders after being unpaused.

      Parameters:
      resumesAt - value to be set
      Returns:
      Builder
    • expiresAt

      public RecurringOrderBuilder expiresAt(@Nullable ZonedDateTime expiresAt)

      Date and time (UTC) when the RecurringOrder expires.

      Parameters:
      expiresAt - value to be set
      Returns:
      Builder
    • lastOrderAt

      public RecurringOrderBuilder lastOrderAt(@Nullable ZonedDateTime lastOrderAt)

      Date and time (UTC) when the last Order was created from this RecurringOrder.

      Parameters:
      lastOrderAt - value to be set
      Returns:
      Builder
    • nextOrderAt

      public RecurringOrderBuilder nextOrderAt(@Nullable ZonedDateTime nextOrderAt)

      Date and time (UTC) when the next Order will be created from this RecurringOrder.

      Parameters:
      nextOrderAt - value to be set
      Returns:
      Builder
    • skipConfiguration

      public RecurringOrderBuilder skipConfiguration(@Nullable SkipConfiguration skipConfiguration)

      Information about current and future skips for this RecurringOrder.

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

      public RecurringOrderBuilder skipConfiguration(Function<SkipConfigurationBuilder,Builder<? extends SkipConfiguration>> builder)

      Information about current and future skips for this RecurringOrder.

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

      Reference to a Store.

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

      Reference to a Store.

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

      public RecurringOrderBuilder store(@Nullable StoreKeyReference store)

      Reference to a Store.

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

      Reference to the Business Unit that the RecurringOrder belongs to.

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

      Reference to the Business Unit that the RecurringOrder belongs to.

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

      public RecurringOrderBuilder businessUnit(@Nullable BusinessUnitKeyReference businessUnit)

      Reference to the Business Unit that the RecurringOrder belongs to.

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

      State of the RecurringOrder in a custom workflow.

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

      State of the RecurringOrder in a custom workflow.

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

      public RecurringOrderBuilder state(@Nullable StateReference state)

      State of the RecurringOrder in a custom workflow.

      Parameters:
      state - value to be set
      Returns:
      Builder
    • recurringOrderState

      public RecurringOrderBuilder recurringOrderState(RecurringOrderState recurringOrderState)

      Current state of the RecurringOrder.

      Parameters:
      recurringOrderState - value to be set
      Returns:
      Builder
    • schedule

      public RecurringOrderBuilder schedule(RecurrencePolicySchedule schedule)

      Schedule of the RecurringOrder.

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

      Schedule of the RecurringOrder.

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

      The Customer that the RecurringOrder belongs to.

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

      The Customer that the RecurringOrder belongs to.

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

      public RecurringOrderBuilder customer(@Nullable CustomerReference customer)

      The Customer that the RecurringOrder belongs to.

      Parameters:
      customer - value to be set
      Returns:
      Builder
    • customerEmail

      public RecurringOrderBuilder customerEmail(@Nullable String customerEmail)

      Email address of the Customer that the RecurringOrder belongs to.

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

      Custom Fields of the RecurringOrder.

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

      Custom Fields of the RecurringOrder.

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

      public RecurringOrderBuilder custom(@Nullable CustomFields custom)

      Custom Fields of the RecurringOrder.

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

      IDs and references that last modified the RecurringOrder.

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

      IDs and references that last modified the RecurringOrder.

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

      public RecurringOrderBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      IDs and references that last modified the RecurringOrder.

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

      IDs and references that created the RecurringOrder.

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

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

      IDs and references that created the RecurringOrder.

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

      public RecurringOrderBuilder createdBy(@Nullable CreatedBy createdBy)

      IDs and references that created the RecurringOrder.

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

      public String getId()

      Unique identifier of the RecurringOrder.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the RecurringOrder.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) when the RecurringOrder was created.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Date and time (UTC) when the RecurringOrder was last updated.

      Returns:
      lastModifiedAt
    • getKey

      @Nullable public String getKey()

      User-defined unique identifier of the RecurringOrder.

      Returns:
      key
    • getCart

      public CartReference getCart()

      Reference to the Cart for a RecurringOrder. The referenced Cart will have the RecurringOrder CartOrigin.

      Returns:
      cart
    • getOriginOrder

      public OrderReference getOriginOrder()

      Reference to the original Order that generated this RecurringOrder. This field is automatically populated when the RecurringOrder is created via the Create Order from Cart endpoint and the Cart contains Line Items with defined recurrenceInfo. When the RecurringOrder is created directly via the Create RecurringOrder endpoint, this field remains empty.

      Returns:
      originOrder
    • getStartsAt

      public ZonedDateTime getStartsAt()

      Date and time (UTC) when the RecurringOrder starts creating new Orders.

      Returns:
      startsAt
    • getResumesAt

      @Nullable public ZonedDateTime getResumesAt()

      Date and time (UTC) when the RecurringOrder resumes creating Orders after being unpaused.

      Returns:
      resumesAt
    • getExpiresAt

      @Nullable public ZonedDateTime getExpiresAt()

      Date and time (UTC) when the RecurringOrder expires.

      Returns:
      expiresAt
    • getLastOrderAt

      @Nullable public ZonedDateTime getLastOrderAt()

      Date and time (UTC) when the last Order was created from this RecurringOrder.

      Returns:
      lastOrderAt
    • getNextOrderAt

      @Nullable public ZonedDateTime getNextOrderAt()

      Date and time (UTC) when the next Order will be created from this RecurringOrder.

      Returns:
      nextOrderAt
    • getSkipConfiguration

      @Nullable public SkipConfiguration getSkipConfiguration()

      Information about current and future skips for this RecurringOrder.

      Returns:
      skipConfiguration
    • getStore

      @Nullable public StoreKeyReference getStore()

      Reference to a Store.

      Returns:
      store
    • getBusinessUnit

      @Nullable public BusinessUnitKeyReference getBusinessUnit()

      Reference to the Business Unit that the RecurringOrder belongs to.

      Returns:
      businessUnit
    • getState

      @Nullable public StateReference getState()

      State of the RecurringOrder in a custom workflow.

      Returns:
      state
    • getRecurringOrderState

      public RecurringOrderState getRecurringOrderState()

      Current state of the RecurringOrder.

      Returns:
      recurringOrderState
    • getSchedule

      public RecurrencePolicySchedule getSchedule()

      Schedule of the RecurringOrder.

      Returns:
      schedule
    • getCustomer

      @Nullable public CustomerReference getCustomer()

      The Customer that the RecurringOrder belongs to.

      Returns:
      customer
    • getCustomerEmail

      @Nullable public String getCustomerEmail()

      Email address of the Customer that the RecurringOrder belongs to.

      Returns:
      customerEmail
    • getCustom

      @Nullable public CustomFields getCustom()

      Custom Fields of the RecurringOrder.

      Returns:
      custom
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the RecurringOrder.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      IDs and references that created the RecurringOrder.

      Returns:
      createdBy
    • build

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

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

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

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