public final class SetTransitions extends UpdateActionImpl<State>
See also StateUpdateCommand.
withUpdateableState(client(), stateA -> { withUpdateableState(client(), stateB -> { final Set<Reference<State>> transitions = asSet(stateA.toReference()); final StateUpdateCommand command = StateUpdateCommand.of(stateB, SetTransitions.of(transitions)); final State updatedStateB = client().executeBlocking(command); assertThat(updatedStateB.getTransitions()).isEqualTo(transitions); //check reference expansion final StateByIdGet stateByIdGet = StateByIdGet.of(stateB).withExpansionPaths(m -> m.transitions()); final State loadedStateB = client().executeBlocking(stateByIdGet); final Reference<State> stateReference = new LinkedList<>(loadedStateB.getTransitions()).getFirst(); assertThat(stateReference.getObj()).isNotNull(); final State updatedStateBWithoutTransitions = client().executeBlocking(StateUpdateCommand.of(updatedStateB, SetTransitions.of(null))); assertThat(updatedStateBWithoutTransitions.getTransitions()).isNull(); return updatedStateBWithoutTransitions; }); return stateA; });
See the test code.
Modifier and Type | Method and Description |
---|---|
Set<Reference<State>> |
getTransitions() |
static SetTransitions |
of(Set<Reference<State>> transitions) |
getAction