Package com.hybris.backoffice.workflow
Class WorkflowNetworkFactory
java.lang.Object
com.hybris.backoffice.workflow.WorkflowNetworkFactory
- All Implemented Interfaces:
WorkflowFlowNetworkFactory,org.springframework.core.Ordered
Creates the
Network graph to be drawn based on WorkflowActionModel-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbalanceCallbacks(Map<String, WorkflowItem> nodesMap) Sets the level of each node to one level above its average neighbors' levels.protected voidbalanceMergingNodes(Map<String, WorkflowItem> nodesMap) Sets the level of merging nodes (e.g.protected voidbalanceNodesLevels(Map<String, WorkflowItem> nodesMap) protected Comparator<String>byMostNeighborsPointingTo(Map<String, WorkflowItem> nodes, Collection<String> targets) booleancanHandle(Collection<WorkflowItem> items, com.hybris.backoffice.widgets.networkchart.context.NetworkChartContext context) Checks if it is possible to create aNetworkfor given inputcom.hybris.cockpitng.components.visjs.network.data.Networkcreate(Collection<WorkflowItem> items, com.hybris.backoffice.widgets.networkchart.context.NetworkChartContext context) Returns theNetworkwith edges and nodes for later presentation.protected Map<String,WorkflowItem> createNodesMap(Collection<WorkflowItem> items) 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.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) intgetOrder()protected booleanisEndAction(WorkflowItem item) protected booleanisMergingNode(WorkflowItem node) protected static <T> Predicate<T>voidsetNetworkEntityRenderers(Collection<NetworkEntityRenderer> networkEntityRenderers) voidsetNetworkNodeDecorator(NetworkNodeDecorator networkNodeDecorator) voidsetOrder(int order) voidsetWorkflowItemModelFactory(WorkflowItemModelFactory workflowItemModelFactory) voidsetWorkflowVisualisationChecker(WorkflowVisualisationChecker workflowVisualisationChecker) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hybris.backoffice.workflow.flow.WorkflowFlowNetworkFactory
create
-
Constructor Details
-
WorkflowNetworkFactory
public WorkflowNetworkFactory()
-
-
Method Details
-
not
-
canHandle
public boolean canHandle(Collection<WorkflowItem> items, com.hybris.backoffice.widgets.networkchart.context.NetworkChartContext context) Description copied from interface:WorkflowFlowNetworkFactoryChecks if it is possible to create aNetworkfor given input- Specified by:
canHandlein interfaceWorkflowFlowNetworkFactory- Parameters:
items- the collection ofWorkflowItemwhich can be used to build theNetworkcontext- context with data about theNetwork- Returns:
- whether
Networkcan 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 theNetworkwith edges and nodes for later presentation. TheWorkflowItems 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:
createin interfaceWorkflowFlowNetworkFactory- Parameters:
items- from which theNetworkshould be builtcontext- context with data about theNetwork- Returns:
- Network with edges and nodes sorted by their neighborhood for nicer presentation
-
createNodesMap
-
collectEndActionsIds
-
isEndAction
-
byMostNeighborsPointingTo
protected Comparator<String> byMostNeighborsPointingTo(Map<String, WorkflowItem> nodes, Collection<String> targets) -
balanceNodesLevels
-
balanceMergingNodes
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
-
balanceCallbacks
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.useextractEdges(Map, Collection)instead -
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
-
setWorkflowItemModelFactory
-
getWorkflowVisualisationChecker
-
setWorkflowVisualisationChecker
public void setWorkflowVisualisationChecker(WorkflowVisualisationChecker workflowVisualisationChecker) -
getNetworkEntityRenderers
-
setNetworkEntityRenderers
-
getNetworkNodeDecorator
-
setNetworkNodeDecorator
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
setOrder
public void setOrder(int order)
-
extractEdges(Map, Collection)instead