Class StateUpdateActionUtils
- java.lang.Object
 - 
- com.commercetools.sync.states.utils.StateUpdateActionUtils
 
 
- 
public final class StateUpdateActionUtils extends java.lang.Object 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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 theinitialvalues of aStateand aStateDraftand returns anOptionalof 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 thetypevalues of aStateand aStateDraftand returns anOptionalof 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 aStateand aStateDraftand returns a list ofUpdateAction<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 thedescriptionvalues of aStateand aStateDraftand returns anOptionalof 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 thenamevalues of aStateand aStateDraftand returns anOptionalof 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 thetransitionsvalues of aStateand aStateDraftand returns anOptionalof update action, which would contain the"setTransitions"UpdateAction. 
 - 
 
- 
- 
Method Detail
- 
buildChangeTypeAction
@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)Compares thetypevalues of aStateand aStateDraftand returns anOptionalof update action, which would contain the"changeType"UpdateAction. If bothStateandStateDrafthave the sametypevalues, then no update action is needed and empty optional will be returned.- Parameters:
 oldState- the state that should be updated.newState- the state draft which contains the new type.- Returns:
 - optional containing update action or empty optional if types are identical.
 
 
- 
buildSetNameAction
@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)Compares thenamevalues of aStateand aStateDraftand returns anOptionalof update action, which would contain the"setName"UpdateAction. If bothStateandStateDrafthave the samenamevalues, then no update action is needed and empty optional will be returned.- Parameters:
 oldState- the state that should be updated.newState- the state draft which contains the new name.- Returns:
 - optional containing update action or empty optional if names are identical.
 
 
- 
buildSetDescriptionAction
@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)Compares thedescriptionvalues of aStateand aStateDraftand returns anOptionalof update action, which would contain the"setDescription"UpdateAction. If bothStateandStateDrafthave the samedescriptionvalues, then no update action is needed and empty optional will be returned.- Parameters:
 oldState- the state that should be updated.newState- the state draft which contains the new description.- Returns:
 - optional containing update action or empty optional if descriptions are identical.
 
 
- 
buildChangeInitialAction
@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)Compares theinitialvalues of aStateand aStateDraftand returns anOptionalof update action, which would contain the"changeInitial"UpdateAction. If bothStateandStateDrafthave the sameinitialvalues, then no update action is needed and empty optional will be returned.- Parameters:
 oldState- the state that should be updated.newState- the state draft which contains the new initial.- Returns:
 - optional containing update action or empty optional if initial are identical.
 
 
- 
buildRolesUpdateActions
@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)Compares the roles of aStateand aStateDraftand returns a list ofUpdateAction<State> as a result. If both theStateand theStateDrafthave identical roles, then no update action is needed and hence an emptyListis returned.- Parameters:
 oldState- the state which should be updated.newState- the state draft where we get the key.- Returns:
 - A list with the update actions or an empty list if the roles are identical.
 
 
- 
buildSetTransitionsAction
@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)Compares thetransitionsvalues of aStateand aStateDraftand returns anOptionalof update action, which would contain the"setTransitions"UpdateAction. If bothStateandStateDrafthave the sametransitionsvalues, 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 statedraft- Parameters:
 oldState- theStatewhich should be updated.newState- theStateDraftwhere we get the new data.- Returns:
 - optional containing update action or empty optional if there are no changes detected or there was an error.
 
 
 - 
 
 -