"Could not find node " + nodeInfo.getNodeRef());
}
}
for (ConnectionInfo connectionInfo: processInfo.getConnectionInfos()) {
if (connectionInfo.getBendpoints() != null) {
NodeInfo sourceNodeInfo = processInfo.getNodeInfo(connectionInfo.getSourceRef());
if (sourceNodeInfo == null) {
throw new IllegalArgumentException(
"Could not find sourceRef for connection info: " + connectionInfo.getSourceRef());
}
NodeInfo targetNodeInfo = processInfo.getNodeInfo(connectionInfo.getTargetRef());
if (targetNodeInfo == null) {
throw new IllegalArgumentException(
"Could not find sourceRef for connection info: " + connectionInfo.getTargetRef());
}
Node sourceNode = null;
for (Node node: process.getNodes()) {
String id = (String) XmlBPMNProcessDumper.getUniqueNodeId(node);
if (sourceNodeInfo.getNodeRef().equals(id)) {
sourceNode = node;
break;
}
}
if (sourceNode == null) {
throw new IllegalArgumentException(
"Could not find node for nodeRef: " + sourceNodeInfo.getNodeRef());
}
boolean found = false;
for (List<Connection> outgoingConnections: sourceNode.getOutgoingConnections().values()) {
for (Connection connection: outgoingConnections) {
if (targetNodeInfo.getNodeRef().equals(XmlBPMNProcessDumper.getUniqueNodeId(connection.getTo()))) {
((ConnectionImpl) connection).setMetaData(
"bendpoints", connectionInfo.getBendpoints());
found = true;
break;
}
}
if (found) {
break;
}
}
if (!found) {
throw new IllegalArgumentException(
"Could not find connection from " + sourceNodeInfo.getNodeRef() +
" to " + targetNodeInfo.getNodeRef());
}
}
}
return processInfo;
}