use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.
the class OutPortHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
CompositeNode compositeNode = (CompositeNode) parser.getParent();
final String type = attrs.getValue("type");
emptyAttributeCheck(localName, "type", type, parser);
final String nodeId = attrs.getValue("nodeId");
emptyAttributeCheck(localName, "nodeId", nodeId, parser);
final String nodeOutType = attrs.getValue("nodeOutType");
emptyAttributeCheck(localName, "nodeOutType", nodeOutType, parser);
compositeNode.linkOutgoingConnections(new Long(nodeId), nodeOutType, type);
return null;
}
use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.
the class InPortHandler method start.
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
CompositeNode compositeNode = (CompositeNode) parser.getParent();
final String type = attrs.getValue("type");
emptyAttributeCheck(localName, "type", type, parser);
final String nodeId = attrs.getValue("nodeId");
emptyAttributeCheck(localName, "nodeId", nodeId, parser);
final String nodeInType = attrs.getValue("nodeInType");
emptyAttributeCheck(localName, "nodeInType", nodeInType, parser);
compositeNode.linkIncomingConnections(type, new Long(nodeId), nodeInType);
return null;
}
use of org.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.
the class XmlBPMNProcessDumper method getUniqueNodeId.
public static String getUniqueNodeId(Node node) {
String result = (String) node.getMetaData().get("UniqueId");
if (result != null) {
return result;
}
result = node.getId() + "";
NodeContainer nodeContainer = node.getNodeContainer();
while (nodeContainer instanceof CompositeNode) {
CompositeNode composite = (CompositeNode) nodeContainer;
result = composite.getId() + "-" + result;
nodeContainer = composite.getNodeContainer();
}
return "_" + result;
}
use of org.jbpm.workflow.core.node.CompositeNode 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.jbpm.workflow.core.node.CompositeNode in project jbpm by kiegroup.
the class SequenceFlowHandler method start.
@SuppressWarnings("unchecked")
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
final String id = attrs.getValue("id");
final String sourceRef = attrs.getValue("sourceRef");
final String targetRef = attrs.getValue("targetRef");
final String bendpoints = attrs.getValue("g:bendpoints");
final String name = attrs.getValue("name");
final String priority = attrs.getValue("http://www.jboss.org/drools", "priority");
NodeContainer nodeContainer = (NodeContainer) parser.getParent();
List<SequenceFlow> connections = null;
if (nodeContainer instanceof RuleFlowProcess) {
RuleFlowProcess process = (RuleFlowProcess) nodeContainer;
connections = (List<SequenceFlow>) process.getMetaData(ProcessHandler.CONNECTIONS);
if (connections == null) {
connections = new ArrayList<SequenceFlow>();
process.setMetaData(ProcessHandler.CONNECTIONS, connections);
}
} else if (nodeContainer instanceof CompositeNode) {
CompositeNode compositeNode = (CompositeNode) nodeContainer;
connections = (List<SequenceFlow>) compositeNode.getMetaData(ProcessHandler.CONNECTIONS);
if (connections == null) {
connections = new ArrayList<SequenceFlow>();
compositeNode.setMetaData(ProcessHandler.CONNECTIONS, connections);
}
}
SequenceFlow connection = new SequenceFlow(id, sourceRef, targetRef);
connection.setBendpoints(bendpoints);
connection.setName(name);
if (priority != null) {
connection.setPriority(Integer.parseInt(priority));
}
connections.add(connection);
return connection;
}
Aggregations