io.sphere.sdk.states.State Maven / Gradle / Ivy
package io.sphere.sdk.states;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.sphere.sdk.models.LocalizedString;
import io.sphere.sdk.models.Resource;
import io.sphere.sdk.models.Reference;
import javax.annotation.Nullable;
import java.util.Set;
/** A State represents a state of a particular entity (defines a finite state machine). States can be combined together
by defining transitions between each state, thus allowing to create work-flows.
Each project has by default an initial LineItemState (inherited also by custom Line Items)
Operations:
- Create a state with {@link io.sphere.sdk.states.commands.StateCreateCommand}.
- Query a state with {@link io.sphere.sdk.states.queries.StateQuery}.
- Delete a channel with {@link io.sphere.sdk.states.commands.StateDeleteCommand}.
*/
@JsonDeserialize(as = StateImpl.class)
public interface State extends Resource {
String getKey();
StateType getType();
@Nullable
LocalizedString getName();
@Nullable
LocalizedString getDescription();
Boolean isInitial();
Boolean isBuiltIn();
@Nullable
Set> getTransitions();
default Reference toReference() {
return Reference.of(referenceTypeId(), getId(), this);
}
static String referenceTypeId(){
return "state";
}
/**
*
* @deprecated use {@link #referenceTypeId()} instead
*/
@Deprecated
static String typeId(){
return "state";
}
static TypeReference typeReference(){
return new TypeReference() {
@Override
public String toString() {
return "TypeReference";
}
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy