new ConnectionImpl( start, Node.CONNECTION_DEFAULT_TYPE, timerNode, Node.CONNECTION_DEFAULT_TYPE ); ActionNode actionNode = new ActionNode(); actionNode.setId( 3 ); actionNode.setName( "Action" ); DroolsConsequenceAction action = new DroolsConsequenceAction(); action.setDialect( "java" ); action.setConsequence( "System.out.println(\"Executed action\");" ); actionNode.setAction( action ); process.addNode( actionNode ); new ConnectionImpl( timerNode, Node.CONNECTION_DEFAULT_TYPE, actionNode, Node.CONNECTION_DEFAULT_TYPE ); EndNode end = new EndNode(); end.setId( 6 ); end.setName( "End" ); process.addNode( end ); new ConnectionImpl( actionNode, Node.CONNECTION_DEFAULT_TYPE, end,
ActionNode actionNode = (ActionNode) node; node.setMetaData("NodeType", "ScriptTask"); DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); if (action == null) { action = new DroolsConsequenceAction(); actionNode.setAction(action); action.setDialect(JavaDialect.ID); } else if (XmlBPMNProcessDumper.JAVASCRIPT_LANGUAGE.equals(language)) { action.setDialect("JavaScript"); action.setConsequence(""); boolean isForCompensation = Boolean.parseBoolean(compensation); if( isForCompensation ) { actionNode.setMetaData("isForCompensation", isForCompensation );
} else if ("linkEventDefinition".equals(nodeName)) { ThrowLinkNode linkNode = new ThrowLinkNode(); linkNode.setId(node.getId()); handleLinkNode(element, linkNode, xmlNode, parser); NodeContainer nodeContainer = (NodeContainer) parser if (node.getAction() == null) { node.setAction(new DroolsConsequenceAction("mvel", "")); node.setMetaData("NodeType", "IntermediateThrowEvent-None");
protected Node createNode(Attributes attrs) { ActionNode result = new ActionNode(); result.setAction(new DroolsConsequenceAction()); return result; }
} else if ("signalEventDefinition".equals(nodeName)) { String signalName = ((Element) xmlNode).getAttribute("signalRef"); String variable = (String) actionNode.getMetaData("MappingVariable"); actionNode.setMetaData("EventType", "signal"); actionNode.setMetaData("Ref", signalName); actionNode.setMetaData("Variable", variable); .setAction(new DroolsConsequenceAction( "java", " Object tVariable = "+ (variable == null ? "null" : variable)+";"
process.setMetaData("routerLayout", 1); ActionNode actionNode = new ActionNode(); actionNode.setName("action"); actionNode.setMetaData("x", 1); actionNode.setMetaData("y", 2); actionNode.setMetaData("width", 3); actionNode.setMetaData("height", 4); action = new DroolsConsequenceAction("dialect", "consequence"); actionNode.setAction(action); forEachNode.setVariable("variableName", new ObjectDataType()); forEachNode.setWaitForCompletion(false); ActionNode subActionNode1 = new ActionNode(); forEachNode.getCompositeNode().addNode(subActionNode1); ActionNode subActionNode2 = new ActionNode(); forEachNode.getCompositeNode().linkIncomingConnections(Node.CONNECTION_DEFAULT_TYPE, subActionNode1.getId(), Node.CONNECTION_DEFAULT_TYPE); forEachNode.getCompositeNode().linkOutgoingConnections(subActionNode2.getId(), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE); exceptionHandler.setAction(action); exceptionScope.setExceptionHandler("MyFault2", exceptionHandler); subActionNode1 = new ActionNode(); compositeNode.addNode(subActionNode1); subActionNode2 = new ActionNode(); compositeNode.linkIncomingConnections(Node.CONNECTION_DEFAULT_TYPE, subActionNode1.getId(), Node.CONNECTION_DEFAULT_TYPE); compositeNode.linkOutgoingConnections(subActionNode2.getId(), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE);
private RuleFlowProcess createCompensationEventSubProcessProcess(String processId, String[] workItemNames, final List<String> eventList) throws Exception { RuleFlowProcess process = new RuleFlowProcess(); process.setAutoComplete(true); process.setId(processId); process.setName("CESP Process"); process.setMetaData("Compensation", true); actionNode.setName("Execute"); DroolsAction action = new DroolsConsequenceAction("java", null); action.setMetaData("Action", new Action() { public void execute(ProcessContext context) throws Exception { actionNode.setAction(action); connect( startNode, actionNode );
if (nodeParent instanceof EventSubProcessNode) { boolean compensationEventSubProcess = false; List<Trigger> startTriggers = ((EventSubProcessNode) nodeParent).findStartNode().getTriggers(); CESP_CHECK: for (Trigger trigger : startTriggers) { if (trigger instanceof EventTrigger) { parentId = ((RuleFlowProcess) nodeParent).getId(); } else { parentId = (String) ((NodeImpl) nodeParent).getMetaData("UniqueId"); DroolsConsequenceAction compensationAction = new DroolsConsequenceAction("java", PROCESS_INSTANCE_SIGNAL_EVENT + "Compensation\", \"" + compensationEvent + "\");"); ((ActionNode) throwEventNode).setAction(compensationAction); } else if (throwEventNode instanceof EndNode) { List<DroolsAction> actions = new ArrayList<DroolsAction>(); actions.add(compensationAction); ((EndNode) throwEventNode).setActions(EndNode.EVENT_NODE_ENTER, actions);
@Test public void testNestedEventSubProcess() throws Exception { RuleFlowProcess process = new RuleFlowProcess(); process.setAutoComplete(true); String processId = "org.jbpm.process.event.subprocess"; process.setId(processId); process.setName("Event SubProcess Process"); actionNode.setName("Print"); final List<String> eventList = new ArrayList<String>(); DroolsAction action = new DroolsConsequenceAction("java", null); action.setMetaData("Action", new Action() { public void execute(ProcessContext context) throws Exception { actionNode.setAction(action); connect( startNode, actionNode );
ActionNode actionNode = new ActionNode(); DroolsAction action = new DroolsConsequenceAction("mvel", null); actionNode.setAction(action); ((MVELAction) actionNode.getAction().getMetaData("Action")).compile( data ); ((Action) actionNode.getAction().getMetaData("Action")).execute( processContext );
"Start has no outgoing connection."); if (endNode.getFrom() == null) { addErrorMessage(process, node, if (actionNode.getFrom() == null && !acceptsNoIncomingConnections(node)) { addErrorMessage(process, node, "Action has no incoming connection."); if (actionNode.getTo() == null && !acceptsNoOutgoingConnections(node)) { Object compensationObj = actionNode.getMetaData(isForCompensation); if (compensationObj == null || !((Boolean) compensationObj)) { addErrorMessage(process, 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) { addErrorMessage(process,
actionNode.setMetaData("isForCompensation", true); actionNode.setName("Execute"); DroolsAction action = new DroolsConsequenceAction("java", null); action.setMetaData("Action", new Action() { public void execute(ProcessContext context) throws Exception { actionNode.setAction(action); connect( boundaryNode, actionNode );
public ActionNodeFactory action(String dialect, String action, boolean isDroolsAction) { if(isDroolsAction) { DroolsAction droolsAction = new DroolsAction(); droolsAction.setMetaData("Action", action); getActionNode().setAction(droolsAction); } else { getActionNode().setAction(new DroolsConsequenceAction(dialect, action)); } return this; }
String variable = (String) actionNode.getMetaData("MappingVariable"); actionNode .setAction(new DroolsConsequenceAction( "java", "org.jbpm.process.instance.context.exception.ExceptionScopeInstance scopeInstance = (org.jbpm.process.instance.context.exception.ExceptionScopeInstance) ((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).resolveContextInstance(org.jbpm.process.core.context.exception.ExceptionScope.EXCEPTION_SCOPE, \""
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser xmlPackageReader) throws SAXException { xmlPackageReader.startElementBuilder( localName, attrs ); WorkflowProcessImpl process = ( WorkflowProcessImpl ) xmlPackageReader.getParent(); ActionNode actionNode = new ActionNode(); final String name = attrs.getValue( "name" ); emptyAttributeCheck( localName, "name", name, xmlPackageReader ); actionNode.setName( name ); final String id = attrs.getValue( "id" ); emptyAttributeCheck( localName, "id", name, xmlPackageReader ); actionNode.setId( new Long(id) ); process.addNode( actionNode ); ((ProcessBuildData)xmlPackageReader.getData()).addNode( actionNode ); return actionNode; }
protected Node createNode() { return new ActionNode(); }
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 ); }
"Could not find message " + messageRef); String variable = (String) actionNode.getMetaData("MappingVariable"); Variable v = (Variable) ((ProcessBuildData) parser.getData()).getMetaData("Variable"); if (v != null) { variable = (String) v.getMetaData(variable); actionNode.setMetaData("MessageType", message.getType()); actionNode .setAction(new DroolsConsequenceAction( "java", " Object tVariable = "+ (variable == null ? "null" : variable)+";"
public void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); ActionNode actionNode = (ActionNode) node; org.w3c.dom.Node xmlNode = element.getFirstChild(); if (xmlNode instanceof Element) { Element actionXml = (Element) xmlNode; DroolsAction action = extractAction(actionXml); actionNode.setAction(action); } }