List of usage examples for org.dom4j.tree FlyweightAttribute FlyweightAttribute
public FlyweightAttribute(String name, String value)
Attribute
with the specified local name and value. From source file:org.danann.cernunnos.xml.AttributeNodePhrase.java
License:Apache License
public Object evaluate(TaskRequest req, TaskResponse res) { String s = (String) tuple.evaluate(req, res); int index = s.indexOf("="); switch (index) { case -1://from ww w . j av a 2 s . co m String msg = "The TUPLE expression must contain an equals ('=') " + "character. The specified expression is invalid: " + s; throw new IllegalArgumentException(msg); default: // All is well... String name = s.substring(0, index); String value = s.substring(index + 1); return new FlyweightAttribute(name, value); } }
From source file:org.jbpm.graph.node.ProcessState.java
License:Open Source License
public void execute(ExecutionContext executionContext) { Token superProcessToken = executionContext.getToken(); ProcessDefinition usedSubProcessDefinition = subProcessDefinition; // if this process has late binding if ((subProcessDefinition == null) && (subProcessName != null)) { SubProcessResolver subProcessResolver = getSubProcessResolver(); List attributes = new ArrayList(); String subProcessNameResolved = (String) JbpmExpressionEvaluator.evaluate(subProcessName, executionContext);//w w w.ja v a2 s. c o m if (log.isDebugEnabled()) { log.debug("SubProcessName after eval: " + subProcessNameResolved); } attributes.add(new FlyweightAttribute("name", subProcessNameResolved)); Element subProcessElement = new DefaultElement("sub-process"); subProcessElement.setAttributes(attributes); usedSubProcessDefinition = subProcessResolver.findSubProcess(subProcessElement); } // create the subprocess ProcessInstance subProcessInstance = superProcessToken.createSubProcessInstance(usedSubProcessDefinition); // fire the subprocess created event fireEvent(Event.EVENTTYPE_SUBPROCESS_CREATED, executionContext); // feed the readable variableInstances if ((variableAccesses != null) && (!variableAccesses.isEmpty())) { ContextInstance superContextInstance = executionContext.getContextInstance(); ContextInstance subContextInstance = subProcessInstance.getContextInstance(); subContextInstance.setTransientVariables(superContextInstance.getTransientVariables()); // loop over all the variable accesses Iterator iter = variableAccesses.iterator(); while (iter.hasNext()) { VariableAccess variableAccess = (VariableAccess) iter.next(); // if this variable access is readable if (variableAccess.isReadable()) { // the variable is copied from the super process variable name // to the sub process mapped name String variableName = variableAccess.getVariableName(); Object value = superContextInstance.getVariable(variableName, superProcessToken); String mappedName = variableAccess.getMappedName(); log.debug("copying super process var '" + variableName + "' to sub process var '" + mappedName + "': " + value); if (value != null) { subContextInstance.setVariable(mappedName, value); } } } } // send the signal to start the subprocess subProcessInstance.signal(); }