use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class CaseRuntimeDataServiceImpl method collectCaseStages.
private Collection<CaseStage> collectCaseStages(String deploymentId, String processId, NodeContainer process) {
Collection<CaseStage> result = new ArrayList<CaseStage>();
for (Node node : process.getNodes()) {
if (node instanceof DynamicNode) {
DynamicNode dynamicNode = (DynamicNode) node;
Collection<AdHocFragment> adHocFragments = collectAdHocFragments(dynamicNode);
result.add(new CaseStageImpl((String) ((DynamicNode) node).getMetaData("UniqueId"), node.getName(), adHocFragments));
}
}
return result;
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class JbpmBpmn2TestCase method assertNumOfOutgoingConnections.
public void assertNumOfOutgoingConnections(ProcessInstance process, String nodeName, int num) {
assertNodeExists(process, nodeName);
WorkflowProcessInstanceImpl instance = (WorkflowProcessInstanceImpl) process;
for (Node node : instance.getNodeContainer().getNodes()) {
if (node.getName().equals(nodeName)) {
if (node.getOutgoingConnections().size() != num) {
fail("Expected outgoing connections: " + num + " - found " + node.getOutgoingConnections().size());
} else {
break;
}
}
}
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class XmlBPMNProcessDumper method visitConnections.
private void visitConnections(Node[] nodes, StringBuilder xmlDump, int metaDataType) {
xmlDump.append(" <!-- connections -->" + EOL);
List<Connection> connections = new ArrayList<Connection>();
for (Node node : nodes) {
for (List<Connection> connectionList : node.getIncomingConnections().values()) {
connections.addAll(connectionList);
}
}
for (Connection connection : connections) {
visitConnection(connection, xmlDump, metaDataType);
}
xmlDump.append(EOL);
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class XmlBPMNProcessDumper method visitConnectionsDi.
private void visitConnectionsDi(Node[] nodes, StringBuilder xmlDump) {
List<Connection> connections = new ArrayList<Connection>();
for (Node node : nodes) {
for (List<Connection> connectionList : node.getIncomingConnections().values()) {
connections.addAll(connectionList);
}
if (node instanceof CompositeNode) {
visitConnectionsDi(((CompositeNode) node).getNodes(), xmlDump);
}
}
for (Connection connection : connections) {
String bendpoints = (String) connection.getMetaData().get("bendpoints");
xmlDump.append(" <bpmndi:BPMNEdge bpmnElement=\"" + getUniqueNodeId(connection.getFrom()) + "-" + getUniqueNodeId(connection.getTo()) + "\" >" + EOL);
Integer x = (Integer) connection.getFrom().getMetaData().get("x");
if (x == null) {
x = 0;
}
Integer y = (Integer) connection.getFrom().getMetaData().get("y");
if (y == null) {
y = 0;
}
Integer width = (Integer) connection.getFrom().getMetaData().get("width");
if (width == null) {
width = 40;
}
Integer height = (Integer) connection.getFrom().getMetaData().get("height");
if (height == null) {
height = 40;
}
xmlDump.append(" <di:waypoint x=\"" + (x + width / 2) + "\" y=\"" + (y + height / 2) + "\" />" + EOL);
if (bendpoints != null) {
bendpoints = bendpoints.substring(1, bendpoints.length() - 1);
String[] points = bendpoints.split(";");
for (String point : points) {
String[] coords = point.split(",");
if (coords.length == 2) {
xmlDump.append(" <di:waypoint x=\"" + coords[0] + "\" y=\"" + coords[1] + "\" />" + EOL);
}
}
}
x = (Integer) connection.getTo().getMetaData().get("x");
if (x == null) {
x = 0;
}
y = (Integer) connection.getTo().getMetaData().get("y");
if (y == null) {
y = 0;
}
width = (Integer) connection.getTo().getMetaData().get("width");
if (width == null) {
width = 40;
}
height = (Integer) connection.getTo().getMetaData().get("height");
if (height == null) {
height = 40;
}
xmlDump.append(" <di:waypoint x=\"" + (x + width / 2) + "\" y=\"" + (y + height / 2) + "\" />" + EOL);
xmlDump.append(" </bpmndi:BPMNEdge>" + EOL);
}
}
use of org.kie.api.definition.process.Node in project jbpm by kiegroup.
the class BPMNPlaneHandler method processNodeInfo.
private boolean processNodeInfo(NodeInfo nodeInfo, Node[] nodes) {
if (nodeInfo == null || nodeInfo.getNodeRef() == null) {
return false;
}
for (Node node : nodes) {
String id = (String) node.getMetaData().get("UniqueId");
if (nodeInfo.getNodeRef().equals(id)) {
((org.jbpm.workflow.core.Node) node).setMetaData("x", nodeInfo.getX());
((org.jbpm.workflow.core.Node) node).setMetaData("y", nodeInfo.getY());
((org.jbpm.workflow.core.Node) node).setMetaData("width", nodeInfo.getWidth());
((org.jbpm.workflow.core.Node) node).setMetaData("height", nodeInfo.getHeight());
return true;
}
if (node instanceof NodeContainer) {
boolean found = processNodeInfo(nodeInfo, ((NodeContainer) node).getNodes());
if (found) {
return true;
}
}
}
return false;
}
Aggregations