java.lang.Object
com.commercetools.history.models.change_history.RecordBuilder
All Implemented Interfaces:
Builder<Record>

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

     Record record = Record.builder()
             .version(1)
             .previousVersion(1)
             .type("{type}")
             .modifiedBy(modifiedByBuilder -> modifiedByBuilder)
             .modifiedAt("{modifiedAt}")
             .label(labelBuilder -> labelBuilder)
             .previousLabel(previousLabelBuilder -> previousLabelBuilder)
             .plusChanges(changesBuilder -> changesBuilder)
             .resource(resourceBuilder -> resourceBuilder)
             .plusStores(storesBuilder -> storesBuilder)
             .withoutChanges(true)
             .build()
 
  • Constructor Details

    • RecordBuilder

      public RecordBuilder()
  • Method Details

    • version

      public RecordBuilder version(Integer version)

      Version of the resource after the change.

      For more information on how the version is incremented, see Optimistic Concurrency Control.

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

      public RecordBuilder previousVersion(Integer previousVersion)

      Version of the resource before the change.

      Parameters:
      previousVersion - value to be set
      Returns:
      Builder
    • type

      public RecordBuilder type(String type)

      Indicates the type of change. For creation, update, or deletion, the value is "ResourceCreated", "ResourceUpdated", or "ResourceDeleted" respectively.

      Parameters:
      type - value to be set
      Returns:
      Builder
    • modifiedBy

      Information about the user or API Client who performed the change.

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

      public RecordBuilder withModifiedBy(Function<ModifiedByBuilder,ModifiedBy> builder)

      Information about the user or API Client who performed the change.

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

      public RecordBuilder modifiedBy(ModifiedBy modifiedBy)

      Information about the user or API Client who performed the change.

      Parameters:
      modifiedBy - value to be set
      Returns:
      Builder
    • modifiedAt

      public RecordBuilder modifiedAt(String modifiedAt)

      Date and time (UTC) the change was made.

      Parameters:
      modifiedAt - value to be set
      Returns:
      Builder
    • label

      public RecordBuilder label(Label label)

      Information that describes the resource after the change.

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

      public RecordBuilder label(Function<LabelBuilder,Builder<? extends Label>> builder)

      Information that describes the resource after the change.

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

      public RecordBuilder previousLabel(Label previousLabel)

      Information that describes the resource before the change.

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

      public RecordBuilder previousLabel(Function<LabelBuilder,Builder<? extends Label>> builder)

      Information that describes the resource before the change.

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

      public RecordBuilder changes(Change... changes)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

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

      public RecordBuilder changes(List<Change> changes)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Parameters:
      changes - value to be set
      Returns:
      Builder
    • plusChanges

      public RecordBuilder plusChanges(Change... changes)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Parameters:
      changes - value to be set
      Returns:
      Builder
    • plusChanges

      public RecordBuilder plusChanges(Function<ChangeBuilder,Builder<? extends Change>> builder)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

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

      public RecordBuilder withChanges(Function<ChangeBuilder,Builder<? extends Change>> builder)

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

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

      ResourceIdentifier of the changed resource.

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

      ResourceIdentifier of the changed resource.

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

      public RecordBuilder resource(ResourceIdentifier resource)

      ResourceIdentifier of the changed resource.

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

      public RecordBuilder stores(KeyReference... stores)

      References to the Stores associated with the Change.

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

      public RecordBuilder stores(List<KeyReference> stores)

      References to the Stores associated with the Change.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      public RecordBuilder plusStores(KeyReference... stores)

      References to the Stores associated with the Change.

      Parameters:
      stores - value to be set
      Returns:
      Builder
    • plusStores

      References to the Stores associated with the Change.

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

      References to the Stores associated with the Change.

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

      References to the Stores associated with the Change.

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

      References to the Stores associated with the Change.

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

      Reference to the Business Unit associated with the Change.

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

      public RecordBuilder withBusinessUnit(Function<KeyReferenceBuilder,KeyReference> builder)

      Reference to the Business Unit associated with the Change.

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

      public RecordBuilder businessUnit(@Nullable KeyReference businessUnit)

      Reference to the Business Unit associated with the Change.

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

      public RecordBuilder withoutChanges(Boolean withoutChanges)

      true if no change was detected.

      The version number of the resource can be increased even without any change in the resource.

      Parameters:
      withoutChanges - value to be set
      Returns:
      Builder
    • getVersion

      public Integer getVersion()

      Version of the resource after the change.

      For more information on how the version is incremented, see Optimistic Concurrency Control.

      Returns:
      version
    • getPreviousVersion

      public Integer getPreviousVersion()

      Version of the resource before the change.

      Returns:
      previousVersion
    • getType

      public String getType()

      Indicates the type of change. For creation, update, or deletion, the value is "ResourceCreated", "ResourceUpdated", or "ResourceDeleted" respectively.

      Returns:
      type
    • getModifiedBy

      public ModifiedBy getModifiedBy()

      Information about the user or API Client who performed the change.

      Returns:
      modifiedBy
    • getModifiedAt

      public String getModifiedAt()

      Date and time (UTC) the change was made.

      Returns:
      modifiedAt
    • getLabel

      public Label getLabel()

      Information that describes the resource after the change.

      Returns:
      label
    • getPreviousLabel

      public Label getPreviousLabel()

      Information that describes the resource before the change.

      Returns:
      previousLabel
    • getChanges

      public List<Change> getChanges()

      Shows the differences in the resource between previousVersion and version.

      The value is not identical to the actual array of update actions sent and is not limited to update actions (see, for example, Optimistic Concurrency Control).

      Returns:
      changes
    • getResource

      public ResourceIdentifier getResource()

      ResourceIdentifier of the changed resource.

      Returns:
      resource
    • getStores

      public List<KeyReference> getStores()

      References to the Stores associated with the Change.

      Returns:
      stores
    • getBusinessUnit

      @Nullable public KeyReference getBusinessUnit()

      Reference to the Business Unit associated with the Change.

      Returns:
      businessUnit
    • getWithoutChanges

      public Boolean getWithoutChanges()

      true if no change was detected.

      The version number of the resource can be increased even without any change in the resource.

      Returns:
      withoutChanges
    • build

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

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

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

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