public final class StateUpdateActionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> |
buildChangeInitialAction(io.sphere.sdk.states.State oldState,
io.sphere.sdk.states.StateDraft newState)
Compares the
initial values of a State and a StateDraft and returns an
Optional of update action, which would contain the "changeInitial" UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> |
buildChangeTypeAction(io.sphere.sdk.states.State oldState,
io.sphere.sdk.states.StateDraft newState)
Compares the
type values of a State and a StateDraft and returns an
Optional of update action, which would contain the "changeType" UpdateAction . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> |
buildRolesUpdateActions(io.sphere.sdk.states.State oldState,
io.sphere.sdk.states.StateDraft newState)
Compares the roles of a
State and a StateDraft and returns a list of UpdateAction <State > as a result. |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> |
buildSetDescriptionAction(io.sphere.sdk.states.State oldState,
io.sphere.sdk.states.StateDraft newState)
Compares the
description values of a State and a StateDraft and returns
an Optional of update action, which would contain the "setDescription" UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> |
buildSetNameAction(io.sphere.sdk.states.State oldState,
io.sphere.sdk.states.StateDraft newState)
Compares the
name values of a State and a StateDraft and returns an
Optional of update action, which would contain the "setName" UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> |
buildSetTransitionsAction(io.sphere.sdk.states.State oldState,
io.sphere.sdk.states.StateDraft newState)
Compares the
transitions values of a State and a StateDraft and returns
an Optional of update action, which would contain the "setTransitions" UpdateAction . |
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> buildChangeTypeAction(@Nonnull io.sphere.sdk.states.State oldState, @Nonnull io.sphere.sdk.states.StateDraft newState)
type
values of a State
and a StateDraft
and returns an
Optional
of update action, which would contain the "changeType"
UpdateAction
. If both State
and StateDraft
have the same type
values,
then no update action is needed and empty optional will be returned.oldState
- the state that should be updated.newState
- the state draft which contains the new type.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> buildSetNameAction(@Nonnull io.sphere.sdk.states.State oldState, @Nonnull io.sphere.sdk.states.StateDraft newState)
name
values of a State
and a StateDraft
and returns an
Optional
of update action, which would contain the "setName"
UpdateAction
. If both State
and StateDraft
have the same name
values,
then no update action is needed and empty optional will be returned.oldState
- the state that should be updated.newState
- the state draft which contains the new name.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> buildSetDescriptionAction(@Nonnull io.sphere.sdk.states.State oldState, @Nonnull io.sphere.sdk.states.StateDraft newState)
description
values of a State
and a StateDraft
and returns
an Optional
of update action, which would contain the "setDescription"
UpdateAction
. If both State
and StateDraft
have the same description
values, then no update action is needed and empty optional will be returned.oldState
- the state that should be updated.newState
- the state draft which contains the new description.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> buildChangeInitialAction(@Nonnull io.sphere.sdk.states.State oldState, @Nonnull io.sphere.sdk.states.StateDraft newState)
initial
values of a State
and a StateDraft
and returns an
Optional
of update action, which would contain the "changeInitial"
UpdateAction
. If both State
and StateDraft
have the same initial
values, then no update action is needed and empty optional will be returned.oldState
- the state that should be updated.newState
- the state draft which contains the new initial.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> buildRolesUpdateActions(@Nonnull io.sphere.sdk.states.State oldState, @Nonnull io.sphere.sdk.states.StateDraft newState)
State
and a StateDraft
and returns a list of UpdateAction
<State
> as a result. If both the State
and the StateDraft
have identical roles, then no update action is needed and hence an empty List
is returned.oldState
- the state which should be updated.newState
- the state draft where we get the key.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.states.State>> buildSetTransitionsAction(@Nonnull io.sphere.sdk.states.State oldState, @Nonnull io.sphere.sdk.states.StateDraft newState)
transitions
values of a State
and a StateDraft
and returns
an Optional
of update action, which would contain the "setTransitions"
UpdateAction
. If both State
and StateDraft
have the same transitions
values, then no update action is needed and empty optional will be returned. if not, the
transition of the old State gets overwritten with the transitions of the statedraftoldState
- the State
which should be updated.newState
- the StateDraft
where we get the new data.