Interface State

All Superinterfaces:
BaseResource, DomainResource<State>, Identifiable<State>, Referencable<State>, ResourceIdentifiable<State>, StateMixin, Versioned<State>, WithKey

State
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()
 
  • Method Details

    • getId

      @NotNull @NotNull String getId()

      Unique identifier of the State.

      Specified by:
      getId in interface BaseResource
      Specified by:
      getId in interface DomainResource<State>
      Specified by:
      getId in interface Identifiable<State>
      Specified by:
      getId in interface Versioned<State>
      Returns:
      id
    • getVersion

      @NotNull @NotNull Long getVersion()

      Current version of the State.

      Specified by:
      getVersion in interface BaseResource
      Specified by:
      getVersion in interface DomainResource<State>
      Specified by:
      getVersion in interface Versioned<State>
      Returns:
      version
    • getCreatedAt

      @NotNull @NotNull ZonedDateTime getCreatedAt()

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

      Specified by:
      getCreatedAt in interface BaseResource
      Returns:
      createdAt
    • getLastModifiedAt

      @NotNull @NotNull ZonedDateTime getLastModifiedAt()

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

      Specified by:
      getLastModifiedAt in interface BaseResource
      Returns:
      lastModifiedAt
    • getLastModifiedBy

      @Valid @Valid LastModifiedBy getLastModifiedBy()

      IDs and references that last modified the State.

      Returns:
      lastModifiedBy
    • getCreatedBy

      @Valid @Valid CreatedBy getCreatedBy()

      IDs and references that created the State.

      Returns:
      createdBy
    • getKey

      @NotNull @NotNull String getKey()

      User-defined unique identifier of the State.

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

      @NotNull @NotNull StateTypeEnum getType()

      Indicates to which resource or object types 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

      @NotNull @NotNull Boolean getInitial()

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

      Returns:
      initial
    • getBuiltIn

      @NotNull @NotNull 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

      List<StateRoleEnum> getRoles()

      Roles the State can fulfill for Reviews and Line Items.

      Returns:
      roles
    • getTransitions

      @Valid @Valid List<StateReference> 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
    • setId

      void setId(String id)

      Unique identifier of the State.

      Specified by:
      setId in interface BaseResource
      Parameters:
      id - value to be set
    • setVersion

      void setVersion(Long version)

      Current version of the State.

      Specified by:
      setVersion in interface BaseResource
      Parameters:
      version - value to be set
    • setCreatedAt

      void setCreatedAt(ZonedDateTime createdAt)

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

      Specified by:
      setCreatedAt in interface BaseResource
      Parameters:
      createdAt - value to be set
    • setLastModifiedAt

      void setLastModifiedAt(ZonedDateTime lastModifiedAt)

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

      Specified by:
      setLastModifiedAt in interface BaseResource
      Parameters:
      lastModifiedAt - value to be set
    • setLastModifiedBy

      void setLastModifiedBy(LastModifiedBy lastModifiedBy)

      IDs and references that last modified the State.

      Parameters:
      lastModifiedBy - value to be set
    • setCreatedBy

      void setCreatedBy(CreatedBy createdBy)

      IDs and references that created the State.

      Parameters:
      createdBy - value to be set
    • setKey

      void setKey(String key)

      User-defined unique identifier of the State.

      Parameters:
      key - value to be set
    • setType

      void setType(StateTypeEnum type)

      Indicates to which resource or object types 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)

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

      Parameters:
      initial - value to be set
    • setBuiltIn

      void setBuiltIn(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
    • setRoles

      void setRoles(StateRoleEnum... roles)

      Roles the State can fulfill for Reviews and Line Items.

      Parameters:
      roles - values to be set
    • setRoles

      void setRoles(List<StateRoleEnum> roles)

      Roles the State can fulfill for Reviews and Line Items.

      Parameters:
      roles - values to be set
    • setTransitions

      void setTransitions(StateReference... 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 - values to be set
    • setTransitions

      void setTransitions(List<StateReference> 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 - values to be set
    • of

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

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

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

      static StateBuilder builder()
      builder factory method for State
      Returns:
      builder
    • builder

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

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

      static ReferenceTypeId referenceTypeId()
    • typeReference

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