use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class CompositeNode method removeOutgoingConnection.
public void removeOutgoingConnection(String type, Connection connection) {
super.removeOutgoingConnection(type, connection);
CompositeNode.NodeAndType nodeAndType = internalGetLinkedOutgoingNode(type);
if (nodeAndType != null) {
for (Connection outConnection : nodeAndType.getNode().getOutgoingConnections(nodeAndType.getType())) {
if (((CompositeNodeEnd) outConnection.getTo()).getOutNodeId() == connection.getTo().getId()) {
Node compositeNodeEnd = outConnection.getTo();
((ConnectionImpl) outConnection).terminate();
internalRemoveNode(compositeNodeEnd);
return;
}
}
throw new IllegalArgumentException("Could not find internal outgoing connection for node");
}
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class XmlWorkflowProcessDumper method visitNodes.
private void visitNodes(WorkflowProcess process, StringBuilder xmlDump, boolean includeMeta) {
xmlDump.append(" <nodes>" + EOL);
for (Node node : process.getNodes()) {
visitNode(node, xmlDump, includeMeta);
}
xmlDump.append(" </nodes>" + EOL + EOL);
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class ConnectionHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
String fromId = attrs.getValue("from");
emptyAttributeCheck(localName, "from", fromId, parser);
String toId = attrs.getValue("to");
emptyAttributeCheck(localName, "to", toId, parser);
String bendpoints = attrs.getValue("bendpoints");
String fromType = attrs.getValue("fromType");
if (fromType == null || fromType.trim().length() == 0) {
fromType = NodeImpl.CONNECTION_DEFAULT_TYPE;
}
String toType = attrs.getValue("toType");
if (toType == null || toType.trim().length() == 0) {
toType = NodeImpl.CONNECTION_DEFAULT_TYPE;
}
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
Node fromNode = nodeContainer.getNode(new Long(fromId));
Node toNode = nodeContainer.getNode(new Long(toId));
if (fromNode == null) {
throw new SAXParseException("Node '" + fromId + "'cannot be found", parser.getLocator());
}
if (toNode == null) {
throw new SAXParseException("Node '" + toId + "' cannot be found", parser.getLocator());
}
ConnectionImpl connection = new ConnectionImpl(fromNode, fromType, toNode, toType);
connection.setMetaData("bendpoints", bendpoints);
return connection;
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class ChecklistItemFactory method getPendingChecklistItems.
private static void getPendingChecklistItems(NodeContainer container, List<ChecklistItem> result, String processId) {
for (Node node : container.getNodes()) {
if (node instanceof HumanTaskNode) {
Work workItem = ((HumanTaskNode) node).getWork();
int priority = 0;
String priorityString = (String) workItem.getParameter("Priority");
if (priorityString != null) {
try {
priority = new Integer(priorityString);
} catch (NumberFormatException e) {
// Do nothing
}
}
String actorId = (String) workItem.getParameter("ActorId");
if (actorId != null && actorId.trim().length() == 0) {
actorId = null;
}
String groupId = (String) workItem.getParameter("GroupId");
if (groupId != null && groupId.trim().length() == 0) {
groupId = null;
}
String actors = null;
if (actorId == null) {
if (groupId == null) {
actors = "";
} else {
actors = groupId;
}
} else {
if (groupId == null) {
actors = actorId;
} else {
actors = actorId + "," + groupId;
}
}
Status status = Status.Pending;
if (((HumanTaskNode) node).getDefaultIncomingConnections().size() == 0) {
status = Status.Optional;
}
result.add(createChecklistItem((String) workItem.getParameter("TaskName"), "HumanTaskNode", actors, (String) workItem.getParameter("Comment"), priority, processId, status));
} else if (node instanceof NodeContainer) {
getPendingChecklistItems((NodeContainer) node, result, processId);
} else {
String docs = (String) node.getMetaData().get("Documentation");
if (docs != null) {
int position = docs.indexOf("OrderingNb=");
if (position >= 0) {
int end = docs.indexOf(";", position + 1);
String orderingNumber = docs.substring(position + 11, end);
Status status = Status.Pending;
if (((NodeImpl) node).getDefaultIncomingConnections().size() == 0 && !(node instanceof StartNode)) {
status = Status.Optional;
}
result.add(createChecklistItem(node.getName(), node.getClass().getSimpleName(), "", orderingNumber, 0, processId, status));
}
}
}
}
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class ProcessRuntimeImpl method initProcessEventListener.
private void initProcessEventListener(Process process) {
if (process instanceof RuleFlowProcess) {
for (Node node : ((RuleFlowProcess) process).getNodes()) {
if (node instanceof StartNode) {
StartNode startNode = (StartNode) node;
if (startNode != null) {
List<Trigger> triggers = startNode.getTriggers();
if (triggers != null) {
for (Trigger trigger : triggers) {
if (trigger instanceof EventTrigger) {
final List<EventFilter> filters = ((EventTrigger) trigger).getEventFilters();
String type = null;
for (EventFilter filter : filters) {
if (filter instanceof EventTypeFilter) {
type = ((EventTypeFilter) filter).getType();
}
}
StartProcessEventListener listener = new StartProcessEventListener(process.getId(), filters, trigger.getInMappings(), startNode.getEventTransformer());
signalManager.addEventListener(type, listener);
((RuleFlowProcess) process).getRuntimeMetaData().put("StartProcessEventType", type);
((RuleFlowProcess) process).getRuntimeMetaData().put("StartProcessEventListener", listener);
}
}
}
}
}
}
}
}
Aggregations