Class StateBuilder

java.lang.Object
com.commercetools.api.models.state.StateBuilder
All Implemented Interfaces:
io.vrap.rmf.base.client.Builder<State>

public class StateBuilder extends Object implements io.vrap.rmf.base.client.Builder<State>
StateBuilder
Example to create an instance using the builder pattern

     State state = State.builder()
             .id("{id}")
             .version(0.3)
             .createdAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .lastModifiedAt(ZonedDateTime.parse("2022-01-01T12:00:00.301Z"))
             .key("{key}")
             .type(StateTypeEnum.ORDER_STATE)
             .initial(true)
             .builtIn(true)
             .build()
 
  • Constructor Details

  • Method Details

    • id

      public StateBuilder id(String id)

      Unique identifier of the State.

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

      public StateBuilder version(Long version)

      Current version of the State.

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

      public StateBuilder createdAt(ZonedDateTime createdAt)

      Date and time (UTC) the State was initially created.

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

      public StateBuilder lastModifiedAt(ZonedDateTime lastModifiedAt)

      Date and time (UTC) the State was last updated.

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

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

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

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

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

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

      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
    • key

      public StateBuilder key(String key)

      User-defined unique identifier of the State.

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

      Indicates to which resource or object types the State is assigned to.

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

      Name of the State.

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

      Name of the State.

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

      Name of the State.

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

      Description of the State.

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

      Description of the State.

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

      Description of the State.

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

      public StateBuilder initial(Boolean initial)

      true for an initial State, the first State in a workflow.

      Parameters:
      initial - value to be set
      Returns:
      Builder
    • builtIn

      public StateBuilder builtIn(Boolean builtIn)

      true for States that are an integral part of the Project. Those States cannot be deleted and their key cannot be changed.

      Parameters:
      builtIn - value to be set
      Returns:
      Builder
    • roles

      Roles the State can fulfill for Reviews and Line Items.

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

      Roles the State can fulfill for Reviews and Line Items.

      Parameters:
      roles - value to be set
      Returns:
      Builder
    • plusRoles

      Roles the State can fulfill for Reviews and Line Items.

      Parameters:
      roles - value to be set
      Returns:
      Builder
    • transitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      transitions - value to be set
      Returns:
      Builder
    • transitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      transitions - value to be set
      Returns:
      Builder
    • plusTransitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      transitions - value to be set
      Returns:
      Builder
    • plusTransitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      builder - function to build the transitions value
      Returns:
      Builder
    • withTransitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      builder - function to build the transitions value
      Returns:
      Builder
    • addTransitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      builder - function to build the transitions value
      Returns:
      Builder
    • setTransitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Parameters:
      builder - function to build the transitions value
      Returns:
      Builder
    • getId

      public String getId()

      Unique identifier of the State.

      Returns:
      id
    • getVersion

      public Long getVersion()

      Current version of the State.

      Returns:
      version
    • getCreatedAt

      Date and time (UTC) the State was initially created.

      Returns:
      createdAt
    • getLastModifiedAt

      Date and time (UTC) the State was last updated.

      Returns:
      lastModifiedAt
    • getLastModifiedBy

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

      Returns:
      lastModifiedBy
    • getCreatedBy

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

      Returns:
      createdBy
    • getKey

      public String getKey()

      User-defined unique identifier of the State.

      Returns:
      key
    • getType

      Indicates to which resource or object types the State is assigned to.

      Returns:
      type
    • getName

      Name of the State.

      Returns:
      name
    • getDescription

      Description of the State.

      Returns:
      description
    • getInitial

      public Boolean getInitial()

      true for an initial State, the first State in a workflow.

      Returns:
      initial
    • getBuiltIn

      public Boolean getBuiltIn()

      true for States that are an integral part of the Project. Those States cannot be deleted and their key cannot be changed.

      Returns:
      builtIn
    • getRoles

      Roles the State can fulfill for Reviews and Line Items.

      Returns:
      roles
    • getTransitions

      • list of States of the same type that the current State can be transitioned to. For example, when the current State is the Initial State of StateType OrderState and this list contains the reference to the Shipped OrderState, the transition Initial -> Shipped is allowed.
      • if empty, no transitions are allowed from the current State, defining the current State as final for this workflow.
      • if not set, the validation is turned off and the current State can be transitioned to any other State of the same type as the current State.
      Returns:
      transitions
    • build

      public State build()
      builds State with checking for non-null required values
      Specified by:
      build in interface io.vrap.rmf.base.client.Builder<State>
      Returns:
      State
    • buildUnchecked

      builds State without checking for non-null required values
      Returns:
      State
    • of

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

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