use of org.jbpm.process.core.timer.Timer in project jbpm by kiegroup.
the class SubProcessNodeFactory method timer.
public SubProcessNodeFactory timer(String delay, String period, String dialect, String action) {
Timer timer = new Timer();
timer.setDelay(delay);
timer.setPeriod(period);
getSubProcessNode().addTimer(timer, new DroolsConsequenceAction(dialect, action));
return this;
}
use of org.jbpm.process.core.timer.Timer in project jbpm by kiegroup.
the class TimerNodeFactory method period.
public TimerNodeFactory period(String period) {
Timer timer = getTimerNode().getTimer();
if (timer == null) {
timer = new Timer();
getTimerNode().setTimer(timer);
}
timer.setPeriod(period);
return this;
}
use of org.jbpm.process.core.timer.Timer in project jbpm by kiegroup.
the class TimerNodeFactory method delay.
public TimerNodeFactory delay(String delay) {
Timer timer = getTimerNode().getTimer();
if (timer == null) {
timer = new Timer();
getTimerNode().setTimer(timer);
}
timer.setDelay(delay);
return this;
}
use of org.jbpm.process.core.timer.Timer in project jbpm by kiegroup.
the class RuleSetNodeFactory method timer.
public RuleSetNodeFactory timer(String delay, String period, String dialect, String action) {
Timer timer = new Timer();
timer.setDelay(delay);
timer.setPeriod(period);
getRuleSetNode().addTimer(timer, new DroolsConsequenceAction(dialect, action));
return this;
}
use of org.jbpm.process.core.timer.Timer in project jbpm by kiegroup.
the class SingleSessionCommandServiceTest method getProcessTimer2.
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);
process.addNode(timerNode);
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("try { Thread.sleep(1000); } catch (Throwable t) {} 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, Node.CONNECTION_DEFAULT_TYPE);
KnowledgeBuilderImpl packageBuilder = new KnowledgeBuilderImpl();
ProcessBuilderImpl processBuilder = new ProcessBuilderImpl(packageBuilder);
processBuilder.buildProcess(process, null);
return Arrays.asList(packageBuilder.getPackages());
}
Aggregations