use of org.jbpm.workflow.core.impl.DroolsConsequenceAction in project jbpm by kiegroup.
the class HumanTaskNodeFactory method onExitAction.
public HumanTaskNodeFactory onExitAction(String dialect, String action) {
if (getHumanTaskNode().getActions(dialect) != null) {
getHumanTaskNode().getActions(dialect).add(new DroolsConsequenceAction(dialect, action));
} else {
List<DroolsAction> actions = new ArrayList<DroolsAction>();
actions.add(new DroolsConsequenceAction(dialect, action));
getHumanTaskNode().setActions(MilestoneNode.EVENT_NODE_EXIT, actions);
}
return this;
}
use of org.jbpm.workflow.core.impl.DroolsConsequenceAction in project jbpm by kiegroup.
the class MilestoneNodeFactory method onEntryAction.
public MilestoneNodeFactory onEntryAction(String dialect, String action) {
if (getMilestoneNode().getActions(dialect) != null) {
getMilestoneNode().getActions(dialect).add(new DroolsConsequenceAction(dialect, action));
} else {
List<DroolsAction> actions = new ArrayList<DroolsAction>();
actions.add(new DroolsConsequenceAction(dialect, action));
getMilestoneNode().setActions(MilestoneNode.EVENT_NODE_ENTER, actions);
}
return this;
}
use of org.jbpm.workflow.core.impl.DroolsConsequenceAction 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.workflow.core.impl.DroolsConsequenceAction in project jbpm by kiegroup.
the class XmlBPMNProcessDumper method visitEscalations.
protected void visitEscalations(Node[] nodes, StringBuilder xmlDump, List<String> escalations) {
for (Node node : nodes) {
if (node instanceof FaultNode) {
FaultNode faultNode = (FaultNode) node;
if (!faultNode.isTerminateParent()) {
String escalationCode = faultNode.getFaultName();
if (!escalations.contains(escalationCode)) {
escalations.add(escalationCode);
xmlDump.append(" <escalation id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(escalationCode) + "\" escalationCode=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(escalationCode) + "\" />" + EOL);
}
}
} else if (node instanceof ActionNode) {
ActionNode actionNode = (ActionNode) node;
if (actionNode.getAction() instanceof DroolsConsequenceAction) {
DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction();
if (action != null) {
String s = action.getConsequence();
if (s.startsWith("org.drools.core.process.instance.context.exception.ExceptionScopeInstance scopeInstance = (org.drools.core.process.instance.context.exception.ExceptionScopeInstance) ((org.drools.workflow.instance.NodeInstance) kcontext.getNodeInstance()).resolveContextInstance(org.drools.core.process.core.context.exception.ExceptionScope.EXCEPTION_SCOPE, \"")) {
s = s.substring(327);
String type = s.substring(0, s.indexOf("\""));
if (!escalations.contains(type)) {
escalations.add(type);
xmlDump.append(" <escalation id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(type) + "\" escalationCode=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(type) + "\" />" + EOL);
}
}
}
} else {
logger.warn("Cannot serialize custom implementation of the Action interface to XML");
}
} else if (node instanceof EventNode) {
EventNode eventNode = (EventNode) node;
String type = (String) eventNode.getMetaData("EscalationEvent");
if (type != null) {
if (!escalations.contains(type)) {
escalations.add(type);
xmlDump.append(" <escalation id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(type) + "\" escalationCode=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(type) + "\" />" + EOL);
}
}
}
if (node instanceof CompositeNode) {
visitEscalations(((CompositeNode) node).getNodes(), xmlDump, escalations);
}
}
}
use of org.jbpm.workflow.core.impl.DroolsConsequenceAction in project jbpm by kiegroup.
the class ProcessHandler method linkBoundarySignalEvent.
private static void linkBoundarySignalEvent(NodeContainer nodeContainer, Node node, String attachedTo, Node attachedNode) {
boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
if (cancelActivity) {
List<DroolsAction> actions = ((EventNode) node).getActions(EndNode.EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<DroolsAction>();
}
DroolsConsequenceAction action = new DroolsConsequenceAction("java", null);
action.setMetaData("Action", new CancelNodeInstanceAction(attachedTo));
actions.add(action);
((EventNode) node).setActions(EndNode.EVENT_NODE_EXIT, actions);
}
}
Aggregations