Class WorkflowNetworkFactory

    • Constructor Detail

      • WorkflowNetworkFactory

        public WorkflowNetworkFactory()
    • Method Detail

      • not

        protected static <T> java.util.function.Predicate<T> not​(java.util.function.Predicate<T> predicate)
      • canHandle

        public boolean canHandle​(java.util.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​(java.util.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 java.util.Map<java.lang.String,​WorkflowItem> createNodesMap​(java.util.Collection<WorkflowItem> items)
      • collectEndActionsIds

        protected java.util.List<java.lang.String> collectEndActionsIds​(java.util.Collection<WorkflowItem> items)
      • isEndAction

        protected boolean isEndAction​(WorkflowItem item)
      • byMostNeighborsPointingTo

        protected java.util.Comparator<java.lang.String> byMostNeighborsPointingTo​(java.util.Map<java.lang.String,​WorkflowItem> nodes,
                                                                                   java.util.Collection<java.lang.String> targets)
      • balanceNodesLevels

        protected void balanceNodesLevels​(java.util.Map<java.lang.String,​WorkflowItem> nodesMap)
      • balanceMergingNodes

        protected void balanceMergingNodes​(java.util.Map<java.lang.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​(java.util.Map<java.lang.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 java.util.List<com.hybris.cockpitng.components.visjs.network.data.Edge> extractEdges​(java.util.Collection<WorkflowItem> items,
                                                                                                       java.util.Map<java.lang.String,​WorkflowItem> nodesMap)
        Deprecated, for removal: This API element is subject to removal in a future version.
      • extractEdges

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

        public void setWorkflowItemModelFactory​(WorkflowItemModelFactory workflowItemModelFactory)
      • setWorkflowVisualisationChecker

        public void setWorkflowVisualisationChecker​(WorkflowVisualisationChecker workflowVisualisationChecker)
      • getNetworkEntityRenderers

        public java.util.Collection<NetworkEntityRenderer> getNetworkEntityRenderers()
      • setNetworkEntityRenderers

        public void setNetworkEntityRenderers​(java.util.Collection<NetworkEntityRenderer> networkEntityRenderers)
      • 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)