Interface StateDraft

All Superinterfaces:
Draft<StateDraft>, WithKey

public interface StateDraft extends WithKey, Draft<StateDraft>
StateDraft
Example to create an instance using the builder pattern

     StateDraft stateDraft = StateDraft.builder()
             .key("{key}")
             .type(StateTypeEnum.ORDER_STATE)
             .build()
 
  • Method Details

    • getKey

      @NotNull @NotNull String getKey()

      User-defined unique identifier for the State.

      Specified by:
      getKey in interface WithKey
      Returns:
      key
    • getType

      @NotNull @NotNull StateTypeEnum getType()

      Specify to which resource or object type the State is assigned to.

      Returns:
      type
    • getName

      @Valid @Valid LocalizedString getName()

      Name of the State.

      Returns:
      name
    • getDescription

      @Valid @Valid LocalizedString getDescription()

      Description of the State.

      Returns:
      description
    • getInitial

      Boolean getInitial()

      Set to false if the State is not the first step in a workflow.

      Returns:
      initial
    • getRoles

      List<StateRoleEnum> getRoles()

      If suitable, assign predifined roles the State can fulfill in case the State's type is LineItemState or ReviewState.

      Returns:
      roles
    • getTransitions

      @Valid @Valid List<StateResourceIdentifier> getTransitions()

      Define the list of States of the same type to which the current State can be transitioned to.

      • If, for example, the current State is the Initial State of StateType OrderState and you want to allow the transition Initial -> Shipped, then add the StateResourceIdentifier to the Shipped OrderState to this list.
      • Set to empty list for not allowing any transition from the current State and defining it as final State for a workflow.
      • Do not set this field at all to turn off validation and allowing transitions to any other State of the same type as the current State.
      Returns:
      transitions
    • setKey

      void setKey(String key)

      User-defined unique identifier for the State.

      Parameters:
      key - value to be set
    • setType

      void setType(StateTypeEnum type)

      Specify to which resource or object type the State is assigned to.

      Parameters:
      type - value to be set
    • setName

      void setName(LocalizedString name)

      Name of the State.

      Parameters:
      name - value to be set
    • setDescription

      void setDescription(LocalizedString description)

      Description of the State.

      Parameters:
      description - value to be set
    • setInitial

      void setInitial(Boolean initial)

      Set to false if the State is not the first step in a workflow.

      Parameters:
      initial - value to be set
    • setRoles

      void setRoles(StateRoleEnum... roles)

      If suitable, assign predifined roles the State can fulfill in case the State's type is LineItemState or ReviewState.

      Parameters:
      roles - values to be set
    • setRoles

      void setRoles(List<StateRoleEnum> roles)

      If suitable, assign predifined roles the State can fulfill in case the State's type is LineItemState or ReviewState.

      Parameters:
      roles - values to be set
    • setTransitions

      void setTransitions(StateResourceIdentifier... transitions)

      Define the list of States of the same type to which the current State can be transitioned to.

      • If, for example, the current State is the Initial State of StateType OrderState and you want to allow the transition Initial -> Shipped, then add the StateResourceIdentifier to the Shipped OrderState to this list.
      • Set to empty list for not allowing any transition from the current State and defining it as final State for a workflow.
      • Do not set this field at all to turn off validation and allowing transitions to any other State of the same type as the current State.
      Parameters:
      transitions - values to be set
    • setTransitions

      void setTransitions(List<StateResourceIdentifier> transitions)

      Define the list of States of the same type to which the current State can be transitioned to.

      • If, for example, the current State is the Initial State of StateType OrderState and you want to allow the transition Initial -> Shipped, then add the StateResourceIdentifier to the Shipped OrderState to this list.
      • Set to empty list for not allowing any transition from the current State and defining it as final State for a workflow.
      • Do not set this field at all to turn off validation and allowing transitions to any other State of the same type as the current State.
      Parameters:
      transitions - values to be set
    • of

      static StateDraft of()
      factory method
      Returns:
      instance of StateDraft
    • of

      static StateDraft of(StateDraft template)
      factory method to create a shallow copy StateDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static StateDraft deepCopy(@Nullable StateDraft template)
      factory method to create a deep copy of StateDraft
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static StateDraftBuilder builder()
      builder factory method for StateDraft
      Returns:
      builder
    • builder

      static StateDraftBuilder builder(StateDraft template)
      create builder for StateDraft instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withStateDraft

      default <T> T withStateDraft(Function<StateDraft,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<StateDraft> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference