use of org.jbpm.workflow.core.impl.NodeImpl in project jbpm by kiegroup.
the class CompositeNode method addOutgoingConnection.
public void addOutgoingConnection(String type, Connection connection) {
if (connection.getTo().getNodeContainer() == this) {
linkIncomingConnections(org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, connection.getTo().getId(), connection.getToType());
} else {
super.addOutgoingConnection(type, connection);
CompositeNode.NodeAndType outNode = internalGetLinkedOutgoingNode(type);
if (outNode != null) {
CompositeNodeEnd end = new CompositeNodeEnd(this, connection.getTo(), type);
internalAddNode(end);
NodeImpl node = (NodeImpl) outNode.getNode();
if (node != null) {
new ConnectionImpl(outNode.getNode(), outNode.getType(), end, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
}
}
}
}
use of org.jbpm.workflow.core.impl.NodeImpl in project jbpm by kiegroup.
the class CompositeNode method addIncomingConnection.
public void addIncomingConnection(String type, Connection connection) {
if (connection.getFrom().getNodeContainer() == this) {
linkOutgoingConnections(connection.getFrom().getId(), connection.getFromType(), org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE);
} else {
super.addIncomingConnection(type, connection);
CompositeNode.NodeAndType inNode = internalGetLinkedIncomingNode(type);
if (inNode != null) {
CompositeNodeStart start = new CompositeNodeStart(this, connection.getFrom(), type);
internalAddNode(start);
NodeImpl node = (NodeImpl) inNode.getNode();
if (node != null) {
new ConnectionImpl(start, org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE, inNode.getNode(), inNode.getType());
}
}
}
}
use of org.jbpm.workflow.core.impl.NodeImpl in project jbpm by kiegroup.
the class MigrateProcessInstanceCommand method updateNodeInstances.
private void updateNodeInstances(NodeInstanceContainer nodeInstanceContainer, Map<String, Long> nodeMapping) {
for (NodeInstance nodeInstance : nodeInstanceContainer.getNodeInstances()) {
String oldNodeId = ((NodeImpl) ((org.jbpm.workflow.instance.NodeInstance) nodeInstance).getNode()).getUniqueId();
Long newNodeId = nodeMapping.get(oldNodeId);
if (newNodeId == null) {
newNodeId = nodeInstance.getNodeId();
}
((NodeInstanceImpl) nodeInstance).setNodeId(newNodeId);
if (nodeInstance instanceof NodeInstanceContainer) {
updateNodeInstances((NodeInstanceContainer) nodeInstance, nodeMapping);
}
}
}
use of org.jbpm.workflow.core.impl.NodeImpl in project jbpm by kiegroup.
the class CompensationScopeInstance method handleException.
public void handleException(ExceptionHandler handler, String compensationActivityRef, Object dunno) {
WorkflowProcessInstanceImpl processInstance = (WorkflowProcessInstanceImpl) getProcessInstance();
NodeInstanceContainer nodeInstanceContainer = (NodeInstanceContainer) getContextInstanceContainer();
if (handler instanceof CompensationHandler) {
CompensationHandler compensationHandler = (CompensationHandler) handler;
try {
Node handlerNode = compensationHandler.getnode();
if (handlerNode instanceof BoundaryEventNode) {
NodeInstance compensationHandlerNodeInstance = nodeInstanceContainer.getNodeInstance(handlerNode);
compensationInstances.add(compensationHandlerNodeInstance);
// The BoundaryEventNodeInstance.signalEvent() contains the necessary logic
// to check whether or not compensation may proceed (? : (not-active + completed))
EventNodeInstance eventNodeInstance = (EventNodeInstance) compensationHandlerNodeInstance;
eventNodeInstance.signalEvent("Compensation", compensationActivityRef);
} else if (handlerNode instanceof EventSubProcessNode) {
// Check that subprocess parent has completed.
List<String> completedIds = processInstance.getCompletedNodeIds();
if (completedIds.contains(((NodeImpl) handlerNode.getNodeContainer()).getMetaData("UniqueId"))) {
NodeInstance subProcessNodeInstance = ((NodeInstanceContainer) nodeInstanceContainer).getNodeInstance((Node) handlerNode.getNodeContainer());
compensationInstances.add(subProcessNodeInstance);
NodeInstance compensationHandlerNodeInstance = ((NodeInstanceContainer) subProcessNodeInstance).getNodeInstance(handlerNode);
compensationInstances.add(compensationHandlerNodeInstance);
EventSubProcessNodeInstance eventNodeInstance = (EventSubProcessNodeInstance) compensationHandlerNodeInstance;
eventNodeInstance.signalEvent("Compensation", compensationActivityRef);
}
}
assert handlerNode instanceof BoundaryEventNode || handlerNode instanceof EventSubProcessNode : "Unexpected compensation handler node type : " + handlerNode.getClass().getSimpleName();
} catch (Exception e) {
throwWorkflowRuntimeException(nodeInstanceContainer, processInstance, "Unable to execute compensation.", e);
}
} else {
Exception e = new IllegalArgumentException("Unsupported compensation handler: " + handler);
throwWorkflowRuntimeException(nodeInstanceContainer, processInstance, e.getMessage(), e);
}
}
use of org.jbpm.workflow.core.impl.NodeImpl in project jbpm by kiegroup.
the class DocumentationHandler method end.
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
Element element = parser.endElementBuilder();
Object parent = parser.getParent();
if (parent instanceof NodeImpl) {
String text = ((Text) element.getChildNodes().item(0)).getWholeText();
if (text != null) {
text = text.trim();
if ("".equals(text)) {
text = null;
}
}
((NodeImpl) parent).getMetaData().put("Documentation", text);
}
return parser.getCurrent();
}
Aggregations