[jbpm-commits] JBoss JBPM SVN: r6703 - in jbpm3/branches/jbpm-3.2-soa/core/src: test/resources/org/jbpm/jbpm2489 and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Sep 30 00:32:10 EDT 2010
Author: alex.guizar at jboss.com
Date: 2010-09-30 00:32:10 -0400 (Thu, 30 Sep 2010)
New Revision: 6703
Modified:
jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/exe/Token.java
jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml
Log:
set join's async attribute to "exclusive" in JBPM-2489 process to prevent the test from timing out;
eliminate recursion in Token.getFullName
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/exe/Token.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/exe/Token.java 2010-09-29 21:53:02 UTC (rev 6702)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/main/java/org/jbpm/graph/exe/Token.java 2010-09-30 04:32:10 UTC (rev 6703)
@@ -349,7 +349,7 @@
if (isRoot()) {
processInstance.end();
}
- else if (!parent.hasActiveChildren()) {
+ else if (parent != null && !parent.hasActiveChildren()) {
parent.end();
}
}
@@ -406,15 +406,15 @@
// various information extraction methods ///////////////////////////////////
public boolean hasEnded() {
- return (end != null);
+ return end != null;
}
public boolean isRoot() {
- return (parent == null);
+ return processInstance != null && equals(processInstance.getRootToken());
}
public boolean hasParent() {
- return (parent != null);
+ return parent != null;
}
public boolean hasChild(String name) {
@@ -426,11 +426,15 @@
}
public String getFullName() {
- if (parent == null)
- return "/";
- if (parent.getParent() == null)
- return "/" + name;
- return parent.getFullName() + "/" + name;
+ if (isRoot()) return "/";
+
+ StringBuffer nameBuilder = new StringBuffer();
+ for (Token token = this; token.hasParent(); token = token.getParent()) {
+ String tokenName = token.getName();
+ if (tokenName != null) nameBuilder.insert(0, tokenName);
+ nameBuilder.insert(0, '/');
+ }
+ return nameBuilder.toString();
}
public List getChildrenAtNode(Node aNode) {
@@ -462,39 +466,27 @@
}
public Token findToken(String relativeTokenPath) {
- if (relativeTokenPath == null)
- return null;
+ if (relativeTokenPath == null) return null;
+
String path = relativeTokenPath.trim();
- if (("".equals(path)) || (".".equals(path))) {
- return this;
- }
- if ("..".equals(path)) {
- return parent;
- }
+ if (path.length() == 0 || ".".equals(path)) return this;
+ if ("..".equals(path)) return parent;
+
if (path.startsWith("/")) {
- Token root = processInstance.getRootToken();
- return root.findToken(path.substring(1));
+ return processInstance.getRootToken().findToken(path.substring(1));
}
- if (path.startsWith("./")) {
- return findToken(path.substring(2));
- }
+ if (path.startsWith("./")) return findToken(path.substring(2));
if (path.startsWith("../")) {
- if (parent != null) {
- return parent.findToken(path.substring(3));
- }
- return null;
+ return parent != null ? parent.findToken(path.substring(3)) : null;
}
+
+ if (children == null) return null;
+
int slashIndex = path.indexOf('/');
- if (slashIndex == -1) {
- return (Token) (children != null ? children.get(path) : null);
- }
- Token token = null;
- String name = path.substring(0, slashIndex);
- token = (Token) children.get(name);
- if (token != null) {
- return token.findToken(path.substring(slashIndex + 1));
- }
- return null;
+ if (slashIndex == -1) return (Token) children.get(path);
+
+ Token token = (Token) children.get(path.substring(0, slashIndex));
+ return token != null ? token.findToken(path.substring(slashIndex + 1)) : null;
}
public Map getActiveChildren() {
Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml 2010-09-29 21:53:02 UTC (rev 6702)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/resources/org/jbpm/jbpm2489/processdefinition.xml 2010-09-30 04:32:10 UTC (rev 6703)
@@ -74,7 +74,7 @@
<transition to="join1"/>
</node>
- <join name="join1">
+ <join name="join1" async="exclusive">
<transition to="Shipment Notice"/>
</join>
More information about the jbpm-commits
mailing list