public void testFirstTermSwimlane() { expressionAssignmentHandler.expression = "swimlane(boss)"; SwimlaneInstance swimlaneInstance = new SwimlaneInstance(new Swimlane("boss")); swimlaneInstance.setActorId("john"); processInstance.getTaskMgmtInstance().addSwimlaneInstance(swimlaneInstance); expressionAssignmentHandler.assign(assignable, executionContext); assertEquals("john", assignable.getActorId()); }
public Object resolveVariable(String name) throws ELException { ExecutionContext executionContext = ExecutionContext.currentExecutionContext(); Object value = null; if ("taskInstance".equals(name)) { value = executionContext.getTaskInstance(); } else if ("processInstance".equals(name)) { value = executionContext.getProcessInstance(); } else if ("processDefinition".equals(name)) { value = executionContext.getProcessDefinition(); } else if ("token".equals(name)) { value = executionContext.getToken(); } else if ("taskMgmtInstance".equals(name)) { value = executionContext.getTaskMgmtInstance(); } else if ("contextInstance".equals(name)) { value = executionContext.getContextInstance(); } else if ((executionContext.getTaskInstance() != null) && (executionContext.getTaskInstance().hasVariableLocally(name))) { value = executionContext.getTaskInstance().getVariable(name); } else { ContextInstance contextInstance = executionContext.getContextInstance(); TaskMgmtInstance taskMgmtInstance = executionContext.getTaskMgmtInstance(); Token token = executionContext.getToken(); if ((contextInstance != null) && (contextInstance.hasVariable(name))) { value = contextInstance.getVariable(name, token); } else if ((contextInstance != null) && (contextInstance.hasTransientVariable(name))) { value = contextInstance.getTransientVariable(name); } else if ((taskMgmtInstance != null) && (taskMgmtInstance.getSwimlaneInstances() != null) && (taskMgmtInstance.getSwimlaneInstances().containsKey(name))) { SwimlaneInstance swimlaneInstance = taskMgmtInstance.getSwimlaneInstance(name); value = (swimlaneInstance != null ? swimlaneInstance.getActorId() : null); } else if ((contextInstance != null) && (contextInstance.hasTransientVariable(name))) { value = contextInstance.getTransientVariable(name); } else if (JbpmConfiguration.Configs.hasObject(name)) { value = JbpmConfiguration.Configs.getObject(name); } } return value; }