public final class ImportLineItemState extends UpdateActionImpl<Order>
See also OrderUpdateCommand.
withStandardStates(client(), (State initialState, State nextState) -> withOrder(client(), order -> { final LineItem lineItem = order.getLineItems().get(0); assertThat(lineItem).has(state(initialState)).has(not(state(nextState))); final Set<ItemState> itemStates = asSet(ItemState.of(nextState, 1L), ItemState.of(initialState, lineItem.getQuantity() - 1)); final Order updatedOrder = client().executeBlocking(OrderUpdateCommand.of(order, ImportLineItemState.of(lineItem, itemStates))); assertThat(updatedOrder.getLineItems().get(0)).has(itemStates(itemStates)); //reference expansion final OrderByIdGet orderByIdGet = OrderByIdGet.of(order).withExpansionPaths(m -> m.lineItems().state().state()); final Order loadedOrder = client().executeBlocking(orderByIdGet); final Reference<State> state = new LinkedList<>(loadedOrder.getLineItems().get(0).getState()).getFirst().getState(); assertThat(state.getObj()).isNotNull(); return updatedOrder; }) );
See the test code.
Modifier and Type | Method and Description |
---|---|
String |
getLineItemId() |
Set<ItemState> |
getState() |
static ImportLineItemState |
of(LineItem lineItem,
Set<ItemState> itemState) |
static ImportLineItemState |
of(String lineItemId,
Set<ItemState> itemState) |
getAction