ActionNode actionNode = (ActionNode) node; node.setMetaData("NodeType", "ScriptTask"); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action == null) { action = new DroolsConsequenceAction();
public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) { ActionNode actionNode = (ActionNode) node; writeNode("actionNode", actionNode, xmlDump, includeMeta); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action != null || (includeMeta && containsMetaData(actionNode))) { xmlDump.append(">" + EOL); if (action != null) { writeAction(action, xmlDump); } if (includeMeta) { writeMetaData(actionNode, xmlDump); } endNode("actionNode", xmlDump); } else { endNode(xmlDump); } }
public void internalTrigger(final NodeInstance from, String type) { if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "An ActionNode only accepts default incoming connections!"); } Action action = (Action) getActionNode().getAction().getMetaData("Action"); try { ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime()); context.setNodeInstance(this); executeAction(action); } catch( WorkflowRuntimeException wre) { throw wre; } catch (Exception e) { // for the case that one of the following throws an exception // - the ProcessContext() constructor // - or context.setNodeInstance(this) throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e); } triggerCompleted(); }
ActionNode actionNode = (ActionNode) node; DroolsConsequenceAction action = null; if (actionNode.getAction() instanceof DroolsConsequenceAction) { action = (DroolsConsequenceAction) actionNode.getAction(); } else { logger.warn("Cannot serialize custom implementation of the Action interface to XML");
if (node.getAction() == null) { node.setAction(new DroolsConsequenceAction("mvel", "")); node.setMetaData("NodeType", "IntermediateThrowEvent-None");
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { super.build(process, processDescr, context, node); ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); Transformation transformation = (Transformation) node.getMetaData().get("Transformation"); if (transformation != null) { WorkflowProcess wfProcess = (WorkflowProcess) process; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("imports", wfProcess.getImports()); parameters.put("classloader", context.getConfiguration().getClassLoader()); DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage()); transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters)); } }
if (actionNode.getAction() == null) { addErrorMessage(process, node, errors, "Action has no action."); } else if (actionNode.getAction() instanceof DroolsConsequenceAction) { DroolsConsequenceAction droolsAction = (DroolsConsequenceAction) actionNode.getAction(); String actionString = droolsAction.getConsequence(); if (actionString == null) {
((Action) actionNode.getAction().getMetaData("Action")).execute( processContext );
((Action) actionNode.getAction().getMetaData("Action")).execute(processContext);
ActionNode actionNode = (ActionNode) node; node.setMetaData("NodeType", "ScriptTask"); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action == null) { action = new DroolsConsequenceAction();
public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) { ActionNode actionNode = (ActionNode) node; writeNode("actionNode", actionNode, xmlDump, includeMeta); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action != null || (includeMeta && containsMetaData(actionNode))) { xmlDump.append(">" + EOL); if (action != null) { writeAction(action, xmlDump); } if (includeMeta) { writeMetaData(actionNode, xmlDump); } endNode("actionNode", xmlDump); } else { endNode(xmlDump); } }
public void internalTrigger(final NodeInstance from, String type) { if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "An ActionNode only accepts default incoming connections!"); } Action action = (Action) getActionNode().getAction().getMetaData("Action"); try { ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime()); context.setNodeInstance(this); executeAction(action); } catch( WorkflowRuntimeException wre) { throw wre; } catch (Exception e) { // for the case that one of the following throws an exception // - the ProcessContext() constructor // - or context.setNodeInstance(this) throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e); } triggerCompleted(); }
if (node.getAction() == null) { node.setAction(new DroolsConsequenceAction("mvel", "")); node.setMetaData("NodeType", "IntermediateThrowEvent-None");
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { super.build(process, processDescr, context, node); ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); Transformation transformation = (Transformation) node.getMetaData().get("Transformation"); if (transformation != null) { WorkflowProcess wfProcess = (WorkflowProcess) process; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("imports", wfProcess.getImports()); parameters.put("classloader", context.getConfiguration().getClassLoader()); DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage()); transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters)); } }