package com.braintree.actions.consignment;

import de.hybris.platform.ordersplitting.model.ConsignmentProcessModel;
import de.hybris.platform.processengine.action.AbstractProceduralAction;
import de.hybris.platform.warehouse.Process2WarehouseAdapter;
import org.apache.log4j.Logger;


public class BrainTreeSendConsignmentToWarehouseAction extends AbstractProceduralAction<ConsignmentProcessModel> {

    private static final Logger LOG = Logger.getLogger(BrainTreeSendConsignmentToWarehouseAction.class);

    private Process2WarehouseAdapter process2WarehouseAdapter;

    @Override
    public void executeAction(final ConsignmentProcessModel process) {
        process2WarehouseAdapter.prepareConsignment(process.getConsignment());
        process.setWaitingForConsignment(true);
        getModelService().save(process);
        LOG.info("Setting waitForConsignment to true");
    }

    public void setProcess2WarehouseAdapter(final Process2WarehouseAdapter process2WarehouseAdapter) {
        this.process2WarehouseAdapter = process2WarehouseAdapter;
    }

}
