@Override public void run(CoreSession session, DocumentRouteElement element, Map<String, Serializable> map) { GraphRoute graph = (GraphRoute) element; element.setRunning(session); if (map != null) { graph.setVariables(map); } runGraph(session, element, graph.getStartNode()); }
@SuppressWarnings("unchecked") @OperationMethod public void run() { // first fill context if (ctx.get(Constants.VAR_WORKFLOW) != null) { ((Map<String, Serializable>) ctx.get(Constants.VAR_WORKFLOW)).put(name, (Serializable) value); } // get workflow instance id from context if not in automation parameters if (workflowInstanceId == null) { workflowInstanceId = (String) ctx.get("workflowInstanceId"); } if (workflowInstanceId == null) { return; } // finally save graph variables DocumentModel workflowInstance = session.getDocument(new IdRef(workflowInstanceId)); GraphRoute graph = workflowInstance.getAdapter(GraphRoute.class); Map<String, Serializable> vars = graph.getVariables(); vars.put(name, (Serializable) value); graph.setVariables(vars); } }