All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.orders.commands.updateactions.TransitionLineItemState Maven / Gradle / Ivy

There is a newer version: 1.0.0-M12
Show newest version
package io.sphere.sdk.orders.commands.updateactions;

import io.sphere.sdk.carts.LineItem;
import io.sphere.sdk.commands.UpdateAction;
import io.sphere.sdk.models.Reference;
import io.sphere.sdk.orders.Order;
import io.sphere.sdk.states.State;

import java.time.Instant;
import java.util.Optional;

public class TransitionLineItemState extends UpdateAction {

    private final String lineItemId;
    private final long quantity;
    private final Reference fromState;
    private final Reference toState;
    private final Optional actualTransitionDate;


    private TransitionLineItemState(final String lineItemId, final long quantity, final Reference fromState, final Reference toState,
                                    final Optional actualTransitionDate) {
        super("transitionLineItemState");
        this.lineItemId = lineItemId;
        this.quantity = quantity;
        this.fromState = fromState;
        this.toState = toState;
        this.actualTransitionDate = actualTransitionDate;
    }

    public String getLineItemId() {
        return lineItemId;
    }

    public long getQuantity() {
        return quantity;
    }

    public Reference getFromState() {
        return fromState;
    }

    public Reference getToState() {
        return toState;
    }

    public static TransitionLineItemState of(final String lineItemId, final long quantity,
                                             final Reference fromState, final Reference toState,
                                             final Optional actualTransitionDate) {
        return new TransitionLineItemState(lineItemId, quantity, fromState, toState, actualTransitionDate);
    }

    public static UpdateAction of(final LineItem lineItem, final long quantity,
                                         final Reference fromState, final Reference toState,
                                         final Optional actualTransitionDate) {
        return of(lineItem.getId(), quantity, fromState, toState, actualTransitionDate);
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy