Class WorkflowNetworkFactory

java.lang.Object
com.hybris.backoffice.workflow.WorkflowNetworkFactory
All Implemented Interfaces:
WorkflowFlowNetworkFactory, org.springframework.core.Ordered

public class WorkflowNetworkFactory extends Object implements WorkflowFlowNetworkFactory
Creates the Network graph to be drawn based on WorkflowActionModel
  • Constructor Details

    • WorkflowNetworkFactory

      public WorkflowNetworkFactory()
  • Method Details

    • not

      protected static <T> Predicate<T> not(Predicate<T> predicate)
    • canHandle

      public boolean canHandle(Collection<WorkflowItem> items, com.hybris.backoffice.widgets.networkchart.context.NetworkChartContext context)
      Description copied from interface: WorkflowFlowNetworkFactory
      Checks if it is possible to create a Network for given input
      Specified by:
      canHandle in interface WorkflowFlowNetworkFactory
      Parameters:
      items - the collection of WorkflowItem which can be used to build the Network
      context - context with data about the Network
      Returns:
      whether Network can be created or not
    • create

      public com.hybris.cockpitng.components.visjs.network.data.Network create(Collection<WorkflowItem> items, com.hybris.backoffice.widgets.networkchart.context.NetworkChartContext context)
      Returns the Network with edges and nodes for later presentation. The WorkflowItems are being walked through starting from the ones with isEnd() set to true. Following their neighbors the algorithm favors visiting nodes pointing to already visited ones. That results in nodes being sorted by their neighborhood. Initially with each child of a node the level decreases. Later on the network is balanced vertically so each node is close to its neighbors and the "and" nodes are half level below the merging decisions.
      Specified by:
      create in interface WorkflowFlowNetworkFactory
      Parameters:
      items - from which the Network should be built
      context - context with data about the Network
      Returns:
      Network with edges and nodes sorted by their neighborhood for nicer presentation
    • createNodesMap

      protected Map<String,WorkflowItem> createNodesMap(Collection<WorkflowItem> items)
    • collectEndActionsIds

      protected List<String> collectEndActionsIds(Collection<WorkflowItem> items)
    • isEndAction

      protected boolean isEndAction(WorkflowItem item)
    • byMostNeighborsPointingTo

      protected Comparator<String> byMostNeighborsPointingTo(Map<String,WorkflowItem> nodes, Collection<String> targets)
    • balanceNodesLevels

      protected void balanceNodesLevels(Map<String,WorkflowItem> nodesMap)
    • balanceMergingNodes

      protected void balanceMergingNodes(Map<String,WorkflowItem> nodesMap)
      Sets the level of merging nodes (e.g. "AND") to half below of its neighbors. The neighbors of the merging nodes are typically decisions. We want to make sure merging nodes and decisions are kept closer than the actions and the decisions.
      Parameters:
      nodesMap - a map containing nodes to balance
    • isMergingNode

      protected boolean isMergingNode(WorkflowItem node)
    • balanceCallbacks

      protected void balanceCallbacks(Map<String,WorkflowItem> nodesMap)
      Sets the level of each node to one level above its average neighbors' levels. Neighbors are initially placed one level below its parent which is not desired for the callbacks (decisions that repeat the action that was once completed).
      Parameters:
      nodesMap - a map containing nodes to balance
    • extractEdges

      @Deprecated(since="2005", forRemoval=true) protected List<com.hybris.cockpitng.components.visjs.network.data.Edge> extractEdges(Collection<WorkflowItem> items, Map<String,WorkflowItem> nodesMap)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • extractEdges

      protected List<com.hybris.cockpitng.components.visjs.network.data.Edge> extractEdges(Map<String,com.hybris.cockpitng.components.visjs.network.data.Node> nodesMap, Collection<WorkflowItem> items)
    • getWorkflowItemModelFactory

      public WorkflowItemModelFactory getWorkflowItemModelFactory()
    • setWorkflowItemModelFactory

      public void setWorkflowItemModelFactory(WorkflowItemModelFactory workflowItemModelFactory)
    • getWorkflowVisualisationChecker

      public WorkflowVisualisationChecker getWorkflowVisualisationChecker()
    • setWorkflowVisualisationChecker

      public void setWorkflowVisualisationChecker(WorkflowVisualisationChecker workflowVisualisationChecker)
    • getNetworkEntityRenderers

      public Collection<NetworkEntityRenderer> getNetworkEntityRenderers()
    • setNetworkEntityRenderers

      public void setNetworkEntityRenderers(Collection<NetworkEntityRenderer> networkEntityRenderers)
    • getNetworkNodeDecorator

      public NetworkNodeDecorator getNetworkNodeDecorator()
    • setNetworkNodeDecorator

      public void setNetworkNodeDecorator(NetworkNodeDecorator networkNodeDecorator)
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • setOrder

      public void setOrder(int order)