private List<KiePackage> getProcessTimer() { RuleFlowProcess process = new RuleFlowProcess(); process.setId( "org.drools.test.TestProcess" ); process.setName( "TestProcess" ); process.setPackageName( "org.drools.test" ); StartNode start = new StartNode(); start.setId( 1 ); start.setName( "Start" ); process.addNode( start ); TimerNode timerNode = new TimerNode(); timerNode.setId( 2 ); timerNode.setName( "Timer" ); Timer timer = new Timer(); timer.setDelay( "2000" ); timerNode.setTimer( timer ); actionNode, Node.CONNECTION_DEFAULT_TYPE ); EndNode end = new EndNode(); end.setId( 6 ); end.setName( "End" );
} else if ("timerEventDefinition".equals(nodeName)) { TimerNode timerNode = new TimerNode(); timerNode.setId(node.getId()); timerNode.setName(node.getName()); timerNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node = timerNode;
process.setMetaData("routerLayout", 1); imports.add("org.kie.api.runtime.process.CaseAssignment"); imports.add("org.kie.api.runtime.process.CaseData"); process.setImports(imports); process.setGlobals(globals); DroolsConsequenceAction action = new DroolsConsequenceAction("dialect", "consequence"); exceptionHandler.setFaultVariable("faultVariable2"); action = new DroolsConsequenceAction("dialect2", "consequence2"); action = new DroolsConsequenceAction("dialect", "consequence"); connection = new ConnectionImpl(workItemNode, Node.CONNECTION_DEFAULT_TYPE, humanTaskNode, Node.CONNECTION_DEFAULT_TYPE); TimerNode timerNode = new TimerNode(); timerNode.setName("timer"); timerNode.setMetaData("x", 1); timerNode.setMetaData("y", 2); timerNode.setMetaData("width", 3); timerNode.setMetaData("height", 4); timerNode.setTimer(timer); new ConnectionImpl(forEachNode, Node.CONNECTION_DEFAULT_TYPE, compositeNode, Node.CONNECTION_DEFAULT_TYPE);
process.addNode(new StartNode()); process.addNode(new EndNode()); process.addNode(new ActionNode()); process.addNode(new Split()); process.addNode(new Join()); process.addNode(new SubProcessNode()); process.addNode(new WorkItemNode()); process.addNode(new TimerNode()); process.addNode(new HumanTaskNode()); process.addNode(new ForEachNode());
String nodeName = xmlNode.getNodeName(); if ("timerEventDefinition".equals(nodeName)) { Timer timer = new Timer(); org.w3c.dom.Node subNode = xmlNode.getFirstChild(); while (subNode instanceof Element) { String period = delay.substring(index + 3); delay = delay.substring(0, index); timer.setPeriod(period); timer.setTimeType(Timer.TIME_CYCLE); timer.setDelay(delay); break; timerNode.setTimer(timer);
"Start has no outgoing connection."); "Action has no incoming connection."); if (timerNode.getFrom() == null && !acceptsNoIncomingConnections(node)) { addErrorMessage(process, node, "Timer has no incoming connection."); if (timerNode.getTo() == null && !acceptsNoOutgoingConnections(node)) { addErrorMessage(process, node, "Timer has no outgoing connection."); if (timerNode.getTimer() == null) { addErrorMessage(process, node, "Timer has no timer specified."); } else { validateTimer(timerNode.getTimer(), node, process,
public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) { TimerNode timerNode = (TimerNode) node; writeNode("intermediateCatchEvent", timerNode, xmlDump, metaDataType); xmlDump.append(">" + EOL); writeExtensionElements(node, xmlDump); xmlDump.append(" <timerEventDefinition>" + EOL); Timer timer = timerNode.getTimer(); if (timer != null && (timer.getDelay() != null || timer.getDate() != null)) { if (timer.getTimeType() == Timer.TIME_DURATION) { xmlDump.append(" <timeDuration xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "</timeDuration>" + EOL); } else if (timer.getTimeType() == Timer.TIME_CYCLE) { if (timer.getPeriod() != null) { xmlDump.append(" <timeCycle xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "###" + XmlDumper.replaceIllegalChars(timer.getPeriod()) + "</timeCycle>" + EOL); } else { xmlDump.append(" <timeCycle xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "</timeCycle>" + EOL); } } else if (timer.getTimeType() == Timer.TIME_DATE) { xmlDump.append(" <timeDate xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "</timeDate>" + EOL); } } xmlDump.append(" </timerEventDefinition>" + EOL); endNode("intermediateCatchEvent", xmlDump); }
protected TimerInstance createTimerInstance(InternalKnowledgeRuntime kruntime) { Timer timer = getTimerNode().getTimer(); TimerInstance timerInstance = new TimerInstance(); if (kruntime != null && kruntime.getEnvironment().get("jbpm.business.calendar") != null){ BusinessCalendar businessCalendar = (BusinessCalendar) kruntime.getEnvironment().get("jbpm.business.calendar"); String delay = resolveVariable(timer.getDelay()); timerInstance.setDelay(businessCalendar.calculateBusinessTimeAsDuration(delay)); if (timer.getPeriod() == null) { timerInstance.setPeriod(0); } else { String period = resolveVariable(timer.getPeriod()); timerInstance.setPeriod(businessCalendar.calculateBusinessTimeAsDuration(period)); } } else { configureTimerInstance(timer, timerInstance); } timerInstance.setTimerId(timer.getId()); return timerInstance; }
public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) { TimerNode timerNode = (TimerNode) node; writeNode("timerNode", timerNode, xmlDump, includeMeta); Timer timer = timerNode.getTimer(); if (timer != null) { xmlDump.append("delay=\"" + timer.getDelay() + "\" "); if (timer.getPeriod() != null) { xmlDump.append(" period=\"" + timer.getPeriod() + "\" "); } } if (includeMeta && containsMetaData(timerNode)) { xmlDump.append(">" + EOL); writeMetaData(timerNode, xmlDump); endNode("timerNode", xmlDump); } else { endNode(xmlDump); } }
protected Node createNode() { return new TimerNode(); }
String nodeName = xmlNode.getNodeName(); if ("timerEventDefinition".equals(nodeName)) { Timer timer = new Timer(); org.w3c.dom.Node subNode = xmlNode.getFirstChild(); while (subNode instanceof Element) { String period = delay.substring(index + 3); delay = delay.substring(0, index); timer.setPeriod(period); timer.setTimeType(Timer.TIME_CYCLE); timer.setDelay(delay); break; timerNode.setTimer(timer);
"Start has no outgoing connection."); "Action has no incoming connection."); if (timerNode.getFrom() == null && !acceptsNoIncomingConnections(node)) { addErrorMessage(process, node, "Timer has no incoming connection."); if (timerNode.getTo() == null && !acceptsNoOutgoingConnections(node)) { addErrorMessage(process, node, "Timer has no outgoing connection."); if (timerNode.getTimer() == null) { addErrorMessage(process, node, "Timer has no timer specified."); } else { validateTimer(timerNode.getTimer(), node, process,
public void writeNode(Node node, StringBuilder xmlDump, int metaDataType) { TimerNode timerNode = (TimerNode) node; writeNode("intermediateCatchEvent", timerNode, xmlDump, metaDataType); xmlDump.append(">" + EOL); writeExtensionElements(node, xmlDump); xmlDump.append(" <timerEventDefinition>" + EOL); Timer timer = timerNode.getTimer(); if (timer != null && (timer.getDelay() != null || timer.getDate() != null)) { if (timer.getTimeType() == Timer.TIME_DURATION) { xmlDump.append(" <timeDuration xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "</timeDuration>" + EOL); } else if (timer.getTimeType() == Timer.TIME_CYCLE) { if (timer.getPeriod() != null) { xmlDump.append(" <timeCycle xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "###" + XmlDumper.replaceIllegalChars(timer.getPeriod()) + "</timeCycle>" + EOL); } else { xmlDump.append(" <timeCycle xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "</timeCycle>" + EOL); } } else if (timer.getTimeType() == Timer.TIME_DATE) { xmlDump.append(" <timeDate xsi:type=\"tFormalExpression\">" + XmlDumper.replaceIllegalChars(timer.getDelay()) + "</timeDate>" + EOL); } } xmlDump.append(" </timerEventDefinition>" + EOL); endNode("intermediateCatchEvent", xmlDump); }
protected TimerInstance createTimerInstance(InternalKnowledgeRuntime kruntime) { Timer timer = getTimerNode().getTimer(); TimerInstance timerInstance = new TimerInstance(); if (kruntime != null && kruntime.getEnvironment().get("jbpm.business.calendar") != null){ BusinessCalendar businessCalendar = (BusinessCalendar) kruntime.getEnvironment().get("jbpm.business.calendar"); String delay = resolveVariable(timer.getDelay()); timerInstance.setDelay(businessCalendar.calculateBusinessTimeAsDuration(delay)); if (timer.getPeriod() == null) { timerInstance.setPeriod(0); } else { String period = resolveVariable(timer.getPeriod()); timerInstance.setPeriod(businessCalendar.calculateBusinessTimeAsDuration(period)); } } else { configureTimerInstance(timer, timerInstance); } timerInstance.setTimerId(timer.getId()); return timerInstance; }
public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) { TimerNode timerNode = (TimerNode) node; writeNode("timerNode", timerNode, xmlDump, includeMeta); Timer timer = timerNode.getTimer(); if (timer != null) { xmlDump.append("delay=\"" + timer.getDelay() + "\" "); if (timer.getPeriod() != null) { xmlDump.append(" period=\"" + timer.getPeriod() + "\" "); } } if (includeMeta && containsMetaData(timerNode)) { xmlDump.append(">" + EOL); writeMetaData(timerNode, xmlDump); endNode("timerNode", xmlDump); } else { endNode(xmlDump); } }
protected Node createNode() { return new TimerNode(); }
private List<KiePackage> getProcessTimer2() { RuleFlowProcess process = new RuleFlowProcess(); process.setId( "org.drools.test.TestProcess" ); process.setName( "TestProcess" ); process.setPackageName( "org.drools.test" ); StartNode start = new StartNode(); start.setId( 1 ); start.setName( "Start" ); process.addNode( start ); TimerNode timerNode = new TimerNode(); timerNode.setId( 2 ); timerNode.setName( "Timer" ); Timer timer = new Timer(); timer.setDelay( "0" ); timerNode.setTimer( timer ); actionNode, Node.CONNECTION_DEFAULT_TYPE ); EndNode end = new EndNode(); end.setId( 6 ); end.setName( "End" );
} else if ("timerEventDefinition".equals(nodeName)) { TimerNode timerNode = new TimerNode(); timerNode.setId(node.getId()); timerNode.setName(node.getName()); timerNode.setMetaData("UniqueId", node.getMetaData().get("UniqueId")); node = timerNode;