[jboss-svn-commits] JBL Code SVN: r23862 - in labs/jbossrules/trunk: drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 13 09:54:01 EST 2008
Author: KrisVerlaenen
Date: 2008-11-13 09:54:00 -0500 (Thu, 13 Nov 2008)
New Revision: 23862
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/CompositeNode.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/CompositeContextNodeWrapper.java
Log:
JBRULES-1616: Composite Node
- fixed issue where already linked entry/exit points were not removed
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/CompositeNode.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/CompositeNode.java 2008-11-13 14:51:31 UTC (rev 23861)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/workflow/core/node/CompositeNode.java 2008-11-13 14:54:00 UTC (rev 23862)
@@ -98,7 +98,17 @@
if (oldNodeAndType.equals(inNode)) {
return;
} else {
- // TODO remove old composite start nodes and connections
+ // remove old start nodes + connections
+ List<Connection> oldInConnections =
+ oldNodeAndType.getNode().getIncomingConnections(oldNodeAndType.getType());
+ if (oldInConnections != null) {
+ for (Connection connection: new ArrayList<Connection>(oldInConnections)) {
+ if (connection.getFrom() instanceof CompositeNodeStart) {
+ removeNode(connection.getFrom());
+ ((ConnectionImpl) connection).terminate();
+ }
+ }
+ }
}
}
inConnectionMap.put(inType, inNode);
@@ -126,7 +136,15 @@
if (oldNodeAndType.equals(outNode)) {
return;
} else {
- // TODO remove old composite start nodes and connections
+ // remove old end nodes + connections
+ List<Connection> oldOutConnections =
+ oldNodeAndType.getNode().getOutgoingConnections(oldNodeAndType.getType());
+ for (Connection connection: new ArrayList<Connection>(oldOutConnections)) {
+ if (connection.getTo() instanceof CompositeNodeEnd) {
+ removeNode(connection.getTo());
+ ((ConnectionImpl) connection).terminate();
+ }
+ }
}
}
outConnectionMap.put(outType, outNode);
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/CompositeContextNodeWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/CompositeContextNodeWrapper.java 2008-11-13 14:51:31 UTC (rev 23861)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/CompositeContextNodeWrapper.java 2008-11-13 14:54:00 UTC (rev 23862)
@@ -135,9 +135,19 @@
((VariableScope) getCompositeContextNode().getDefaultContext(
VariableScope.VARIABLE_SCOPE)).setVariables((List<Variable>) value);
} else if (START_NODE.equals(id)) {
- getCompositeNode().linkIncomingConnections(Node.CONNECTION_DEFAULT_TYPE, new Long((String) value), Node.CONNECTION_DEFAULT_TYPE);
+ try {
+ getCompositeNode().linkIncomingConnections(
+ Node.CONNECTION_DEFAULT_TYPE, new Long((String) value), Node.CONNECTION_DEFAULT_TYPE);
+ } catch (IllegalArgumentException e) {
+ // could not link
+ }
} else if (END_NODE.equals(id)) {
- getCompositeNode().linkOutgoingConnections(new Long((String) value), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE);
+ try {
+ getCompositeNode().linkOutgoingConnections(
+ new Long((String) value), Node.CONNECTION_DEFAULT_TYPE, Node.CONNECTION_DEFAULT_TYPE);
+ } catch (IllegalArgumentException e) {
+ // could not link
+ }
} else if (EXCEPTION_HANDLERS.equals(id)) {
ExceptionScope exceptionScope = (ExceptionScope)
getCompositeContextNode().getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
More information about the jboss-svn-commits
mailing list