Warehousing Consignment Workflow Service

Warehousing Consignment Workflow Service is part of the warehousing extension. It offers functionality to perform tasks related to a task assignment workflow attached to a consignment.

The Warehousing Consignment Workflow Service has an updated API in order to provide more operations related to a Task Assignment Workflow attached to a given consignment.

Warehousing Consignment Workflow Service API

The service will take a ConsignmentModel which contains a collection of consignment entries and will perform operations related to the Task Assignment Workflow attached to the consignment.

WarehousingConsignmentWorkflowService.java:

public interface WarehousingConsignmentWorkflowService
{
  /**
   * Starts a workflow for the given consignment {@link ConsignmentModel}.
   *
   * @param consignment
   *     {@link ConsignmentModel} for which a workflow needs to be started
   */
  void startConsignmentWorkflow(ConsignmentModel consignment);
 
  /**
   * Terminates a workflow assigned for the given consignment {@link ConsignmentModel}
   *
   * @param consignment
   *     {@link ConsignmentModel} which we want to terminate the workflow for
   */
  void terminateConsignmentWorkflow(ConsignmentModel consignment);
 
  /**
   * Decides which {@link WorkflowActionModel} to trigger from a given {@link ConsignmentModel}
   *
   * @param consignment
   *     the {@link ConsignmentModel} on which your action happened
   * @param templateCode
   *     the string code of the template
   * @param choice
   *     the string code of the choice to be processed
   */
  void decideWorkflowAction(ConsignmentModel consignment, String templateCode, String choice);
 
  /**
   * Returns the {@link WorkflowActionModel} of the given {@link ConsignmentModel} for the given {@link de.hybris.platform.workflow.model.WorkflowTemplateModel#CODE}
   *
   * @param templateCode
   *     the {@link de.hybris.platform.workflow.model.WorkflowTemplateModel#CODE} to retrieve
   * @param consignment
   *     the {@link ConsignmentModel} for which the {@link WorkflowActionModel} is required
   * @return shipping {@link WorkflowActionModel}
   */
  WorkflowActionModel getConsignmentTaskForTemplateCode(String templateCode, ConsignmentModel consignment);
}

Items

The following item definitions are associated with the shipping service:

warehousing-items.xml:
<itemtypes>
    <itemtype code="Consignment" autocreate="false" generate="false">
 
        <description>Extending Consignment type with additional attributes.</description>
        <attributes>
            <attribute  type="java.lang.String" qualifier="taskAssignmentWorkflow">
                <description>The task assignment workflow code assigned to the consignment</description>
                <modifiers read="true" write="true" unique="false" optional="true" />
                <persistence type="property" />
            </attribute>
        </attributes>
    </itemtype>
</itemtypes>

Spring Configuration

You can change the default implementation in the Spring configuration.

warehousing-spring.xml:
<alias name="defaultWarehousingConsignmentWorkflowService" alias="warehousingConsignmentWorkflowService" />
<bean id="defaultWarehousingConsignmentWorkflowService" class="de.hybris.platform.warehousing.taskassignment.services.impl.DefaultWarehousingConsignmentWorkflowService">
    <property name="modelService" ref="modelService"/>
    <property name="workflowService" ref="newestWorkflowService"/>
    <property name="workflowTemplateService" ref="workflowTemplateService"/>
    <property name="workflowProcessingService" ref="workflowProcessingService"/>
    <property name="userService" ref="userService"/>
    <property name="userSelectionStrategy" ref="userSelectionStrategy"/>
    <property name="configurationService" ref="configurationService"/>
    <property name="consignmentBusinessProcessService" ref="consignmentBusinessProcessService"/>
</bean>