T
- type to be updatedpublic abstract class TransitionStateBase<T> extends UpdateActionImpl<T>
Modifier | Constructor and Description |
---|---|
protected |
TransitionStateBase(ResourceIdentifiable<State> state) |
protected |
TransitionStateBase(ResourceIdentifiable<State> state,
Boolean force) |
Modifier and Type | Method and Description |
---|---|
ResourceIdentifier<State> |
getState() |
Boolean |
isForce()
Using true disables the state machine validation and allows a transition in any state.
|
getAction
protected TransitionStateBase(@Nullable ResourceIdentifiable<State> state, Boolean force)
protected TransitionStateBase(@Nullable ResourceIdentifiable<State> state)
@Nullable public ResourceIdentifier<State> getState()
@Nullable public Boolean isForce()
Set<Reference<State>> noTransitions = emptySet(); withStateByBuilder(client(), builder -> builder.type(PRODUCT_STATE).transitions(noTransitions), stateA -> { withStateByBuilder(client(), builder -> builder.type(PRODUCT_STATE), stateB -> { withUpdateableProduct(client(), product -> { assertThat(product.getState()).isNull(); final Product productInStateA = client().executeBlocking(ProductUpdateCommand.of(product, TransitionState.of(stateA))); //no force usage assertThatThrownBy(() -> client().executeBlocking(ProductUpdateCommand.of(productInStateA, TransitionState.of(stateB)))) .hasMessageContaining("InvalidOperation"); final ProductUpdateCommand cmd = ProductUpdateCommand.of(productInStateA, TransitionState.of(stateB, true)); final Product productInStateB = client().executeBlocking(cmd); assertThat(productInStateB.getState()).isEqualTo(stateB.toReference()); return productInStateA; }); }); });
See the test code.