Interface State
- All Superinterfaces:
BaseResource,DomainResource<State>,Identifiable<State>,Referencable<State>,ResourceIdentifiable<State>,StateMixin,Versioned<State>,WithKey
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 Summary
Modifier and TypeMethodDescriptionstatic StateBuilderbuilder()builder factory method for Statestatic StateBuildercreate builder for State instancecopyDeep()static Statefactory method to create a deep copy of State@NotNull Booleantruefor States that are an integral part of the Project.@NotNull ZonedDateTimeDate and time (UTC) the State was initially created.@Valid CreatedByIDs and references that created the State.@Valid LocalizedStringDescription of the State.@NotNull StringgetId()Unique identifier of the State.@NotNull Booleantruefor an initial State, the first State in a workflow.@NotNull StringgetKey()User-defined unique identifier of the State.@NotNull ZonedDateTimeDate and time (UTC) the State was last updated.@Valid LastModifiedByIDs and references that last modified the State.@Valid LocalizedStringgetName()Name of the State.getRoles()Roles the State can fulfill for Reviews and Line Items.@Valid List<StateReference>list of States of the sametypethat the current State can be transitioned to.@NotNull StateTypeEnumgetType()Indicates to which resource or object types the State is assigned to.@NotNull LongCurrent version of the State.static Stateof()factory methodstatic Statefactory method to create a shallow copy Statestatic ReferenceTypeIdvoidsetBuiltIn(Boolean builtIn) truefor States that are an integral part of the Project.voidsetCreatedAt(ZonedDateTime createdAt) Date and time (UTC) the State was initially created.voidsetCreatedBy(CreatedBy createdBy) IDs and references that created the State.voidsetDescription(LocalizedString description) Description of the State.voidUnique identifier of the State.voidsetInitial(Boolean initial) truefor an initial State, the first State in a workflow.voidUser-defined unique identifier of the State.voidsetLastModifiedAt(ZonedDateTime lastModifiedAt) Date and time (UTC) the State was last updated.voidsetLastModifiedBy(LastModifiedBy lastModifiedBy) IDs and references that last modified the State.voidsetName(LocalizedString name) Name of the State.voidsetRoles(StateRoleEnum... roles) Roles the State can fulfill for Reviews and Line Items.voidsetRoles(List<StateRoleEnum> roles) Roles the State can fulfill for Reviews and Line Items.voidsetTransitions(StateReference... transitions) list of States of the sametypethat the current State can be transitioned to.voidsetTransitions(List<StateReference> transitions) list of States of the sametypethat the current State can be transitioned to.voidsetType(StateTypeEnum type) Indicates to which resource or object types the State is assigned to.voidsetVersion(Long version) Current version of the State.static com.fasterxml.jackson.core.type.TypeReference<State>gives a TypeReference for usage with Jackson DataBinddefault <T> Taccessor map functionMethods inherited from interface com.commercetools.api.models.common.BaseResource
withBaseResourceMethods inherited from interface com.commercetools.api.models.DomainResource
getMethods inherited from interface com.commercetools.api.models.state.StateMixin
toReference, toResourceIdentifier
-
Method Details
-
getId
Unique identifier of the State.
- Specified by:
getIdin interfaceBaseResource- Specified by:
getIdin interfaceDomainResource<State>- Specified by:
getIdin interfaceIdentifiable<State>- Specified by:
getIdin interfaceVersioned<State>- Returns:
- id
-
getVersion
Current version of the State.
- Specified by:
getVersionin interfaceBaseResource- Specified by:
getVersionin interfaceDomainResource<State>- Specified by:
getVersionin interfaceVersioned<State>- Returns:
- version
-
getCreatedAt
Date and time (UTC) the State was initially created.
- Specified by:
getCreatedAtin interfaceBaseResource- Returns:
- createdAt
-
getLastModifiedAt
Date and time (UTC) the State was last updated.
- Specified by:
getLastModifiedAtin interfaceBaseResource- Returns:
- lastModifiedAt
-
getLastModifiedBy
IDs and references that last modified the State.
- Returns:
- lastModifiedBy
-
getCreatedBy
IDs and references that created the State.
- Returns:
- createdBy
-
getKey
User-defined unique identifier of the State.
-
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
truefor an initial State, the first State in a workflow.- Returns:
- initial
-
getBuiltIn
truefor States that are an integral part of the Project. Those States cannot be deleted and theirkeycannot be changed.- Returns:
- builtIn
-
getRoles
List<StateRoleEnum> getRoles()Roles the State can fulfill for Reviews and Line Items.
- Returns:
- roles
-
getTransitions
- list of States of the same
typethat the current State can be transitioned to. For example, when the current State is the Initial State of StateTypeOrderStateand this list contains the reference to the ShippedOrderState, 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
typeas the current State.
- Returns:
- transitions
- list of States of the same
-
setId
Unique identifier of the State.
- Specified by:
setIdin interfaceBaseResource- Parameters:
id- value to be set
-
setVersion
Current version of the State.
- Specified by:
setVersionin interfaceBaseResource- Parameters:
version- value to be set
-
setCreatedAt
Date and time (UTC) the State was initially created.
- Specified by:
setCreatedAtin interfaceBaseResource- Parameters:
createdAt- value to be set
-
setLastModifiedAt
Date and time (UTC) the State was last updated.
- Specified by:
setLastModifiedAtin interfaceBaseResource- Parameters:
lastModifiedAt- value to be set
-
setLastModifiedBy
IDs and references that last modified the State.
- Parameters:
lastModifiedBy- value to be set
-
setCreatedBy
IDs and references that created the State.
- Parameters:
createdBy- value to be set
-
setKey
User-defined unique identifier of the State.
- Parameters:
key- value to be set
-
setType
Indicates to which resource or object types the State is assigned to.
- Parameters:
type- value to be set
-
setName
Name of the State.
- Parameters:
name- value to be set
-
setDescription
Description of the State.
- Parameters:
description- value to be set
-
setInitial
truefor an initial State, the first State in a workflow.- Parameters:
initial- value to be set
-
setBuiltIn
truefor States that are an integral part of the Project. Those States cannot be deleted and theirkeycannot be changed.- Parameters:
builtIn- value to be set
-
setRoles
Roles the State can fulfill for Reviews and Line Items.
- Parameters:
roles- values to be set
-
setRoles
Roles the State can fulfill for Reviews and Line Items.
- Parameters:
roles- values to be set
-
setTransitions
- list of States of the same
typethat the current State can be transitioned to. For example, when the current State is the Initial State of StateTypeOrderStateand this list contains the reference to the ShippedOrderState, 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
typeas the current State.
- Parameters:
transitions- values to be set
- list of States of the same
-
setTransitions
- list of States of the same
typethat the current State can be transitioned to. For example, when the current State is the Initial State of StateTypeOrderStateand this list contains the reference to the ShippedOrderState, 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
typeas the current State.
- Parameters:
transitions- values to be set
- list of States of the same
-
of
factory method- Returns:
- instance of State
-
of
factory method to create a shallow copy State- Parameters:
template- instance to be copied- Returns:
- copy instance
-
copyDeep
State copyDeep()- Specified by:
copyDeepin interfaceBaseResource
-
deepCopy
factory method to create a deep copy of State- Parameters:
template- instance to be copied- Returns:
- copy instance
-
builder
builder factory method for State- Returns:
- builder
-
builder
create builder for State instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-
withState
accessor map function- Type Parameters:
T- mapped type- Parameters:
helper- function to map the object- Returns:
- mapped value
-
referenceTypeId
-
typeReference
gives a TypeReference for usage with Jackson DataBind- Returns:
- TypeReference
-