Class ProductStateTransitionMessageBuilder

java.lang.Object
com.commercetools.api.models.message.ProductStateTransitionMessageBuilder
All Implemented Interfaces:
Builder<ProductStateTransitionMessage>

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

     ProductStateTransitionMessage productStateTransitionMessage = ProductStateTransitionMessage.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .sequenceNumber(0.3)
             .resource(resourceBuilder -> resourceBuilder)
             .resourceVersion(0.3)
             .state(stateBuilder -> stateBuilder)
             .force(true)
             .build()
 
  • Constructor Details

    • ProductStateTransitionMessageBuilder

      public ProductStateTransitionMessageBuilder()
  • Method Details

    • id

      Unique identifier of the Message. Can be used to track which Messages have been processed.

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

      public ProductStateTransitionMessageBuilder version(Long version)

      Version of a resource. In case of Messages, this is always 1.

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

      Date and time (UTC) the Message was generated.

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

      public ProductStateTransitionMessageBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Value of createdAt.

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

      Value of createdBy.

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

      Value of createdBy.

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

      public ProductStateTransitionMessageBuilder lastModifiedBy(@Nullable LastModifiedBy lastModifiedBy)

      Value of createdBy.

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

      Present on resources created after 1 February 2019 except for events not tracked.

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

      Present on resources created after 1 February 2019 except for events not tracked.

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

      Present on resources created after 1 February 2019 except for events not tracked.

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

      public ProductStateTransitionMessageBuilder sequenceNumber(Long sequenceNumber)

      Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

      Parameters:
      sequenceNumber - value to be set
      Returns:
      Builder
    • resource

      public ProductStateTransitionMessageBuilder resource(Reference resource)

      Reference to the resource on which the change or action was performed.

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

      Reference to the resource on which the change or action was performed.

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

      public ProductStateTransitionMessageBuilder resourceVersion(Long resourceVersion)

      Version of the resource on which the change or action was performed.

      Parameters:
      resourceVersion - value to be set
      Returns:
      Builder
    • resourceUserProvidedIdentifiers

      User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

      User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

      public ProductStateTransitionMessageBuilder resourceUserProvidedIdentifiers(@Nullable UserProvidedIdentifiers resourceUserProvidedIdentifiers)

      User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

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

      Product State after the Transition State update action.

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

      Product State after the Transition State update action.

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

      Product State after the Transition State update action.

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

      Whether State transition validations were turned off during the Transition State update action.

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

      public String getId()

      Unique identifier of the Message. Can be used to track which Messages have been processed.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Version of a resource. In case of Messages, this is always 1.

      Returns:
      version
    • getCreatedAt

      public ZonedDateTime getCreatedAt()

      Date and time (UTC) the Message was generated.

      Returns:
      createdAt
    • getLastModifiedAt

      public ZonedDateTime getLastModifiedAt()

      Value of createdAt.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Nullable public LastModifiedBy getLastModifiedBy()

      Value of createdBy.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Nullable public CreatedBy getCreatedBy()

      Present on resources created after 1 February 2019 except for events not tracked.

      Returns:
      createdBy
    • getSequenceNumber

      public Long getSequenceNumber()

      Message number in relation to other Messages for a given resource. The sequenceNumber of the next Message for the resource is the successor of the sequenceNumber of the current Message. Meaning, the sequenceNumber of the next Message equals the sequenceNumber of the current Message + 1. sequenceNumber can be used to ensure that Messages are processed in the correct order for a particular resource.

      Returns:
      sequenceNumber
    • getResource

      public Reference getResource()

      Reference to the resource on which the change or action was performed.

      Returns:
      resource
    • getResourceVersion

      public Long getResourceVersion()

      Version of the resource on which the change or action was performed.

      Returns:
      resourceVersion
    • getResourceUserProvidedIdentifiers

      @Nullable public UserProvidedIdentifiers getResourceUserProvidedIdentifiers()

      User-provided identifiers of the resource, such as key or externalId. Only present if the resource has such identifiers.

      Returns:
      resourceUserProvidedIdentifiers
    • getState

      public StateReference getState()

      Product State after the Transition State update action.

      Returns:
      state
    • getForce

      public Boolean getForce()

      Whether State transition validations were turned off during the Transition State update action.

      Returns:
      force
    • build

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

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

      factory method for an instance of ProductStateTransitionMessageBuilder
      Returns:
      builder
    • of

      create builder for ProductStateTransitionMessage instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder