Index: modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java (revision 6446)
+++ modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java (working copy)
@@ -24,6 +24,7 @@
import org.w3c.dom.Element;
import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.util.TagBinding;
import org.jbpm.pvm.internal.util.XmlUtil;
@@ -32,9 +33,10 @@
/**
* @author Tom Baeyens
+ * @author Huisheng Xu
*/
public abstract class JpdlBinding extends TagBinding {
-
+
public JpdlBinding(String tagName) {
super(tagName, null, null);
}
@@ -47,12 +49,19 @@
public void parseName(Element element, ActivityImpl activity, Parse parse) {
String name = XmlUtil.attribute(element, "name", isNameRequired() ? parse : null);
-
- if (name!=null) {
+
+ if (name != null) {
// basic name validation
if ("".equals(name)) {
parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
- } else if (name.indexOf('/')!=-1) {
+ }
+
+ boolean isActivityAllowSlash = false;
+ Boolean candidateCondition = (Boolean) EnvironmentImpl.getFromCurrent("jbpm.activity.allow.slash", false);
+ if (candidateCondition != null) {
+ isActivityAllowSlash = candidateCondition.booleanValue();
+ }
+ if (!isActivityAllowSlash && name.indexOf('/') != -1) {
parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
}
activity.setName(name);
@@ -85,7 +94,7 @@
// transition.setName(transitionName);
//
// unresolvedTransitions.add(transition, transitionElement);
-//
+//
// jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
// }
// }
Index: modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java
===================================================================
--- modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java (revision 0)
+++ modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/SlashInActivityTest.java (revision 0)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+/**
+ *
+ */
+package org.jbpm.test.slashinactivity;
+
+import org.jbpm.api.Configuration;
+import org.jbpm.api.Execution;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmCustomCfgTestCase;
+import org.jbpm.test.JbpmTestCase;
+
+
+public class SlashInActivityTest extends JbpmCustomCfgTestCase {
+
+ private static final String PROCESS_KEY = "test_process";
+
+ private static final String TEST_PROCESS =
+ "" +
+ " " +
+ " " +
+ " " +
+ " " +
+ "";
+
+ public void testSlashInActivity() {
+ deployJpdlXmlString(TEST_PROCESS);
+ }
+}
Index: modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml
===================================================================
--- modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml (revision 0)
+++ modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/jbpm.cfg.xml (revision 0)
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
===================================================================
--- modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml (revision 6446)
+++ modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml (working copy)
@@ -8,7 +8,7 @@
and replace it with the custom values.
<jbpm-configuration>
-
+
<import resource="jbpm.businesscalendar.cfg.xml" />
...
@@ -25,20 +25,20 @@
</jbpm-configuration>
-
+
Console
By default the server host and port of the console
web app are respectively localhost
- and 8080. It is not hard to imagine
+ and 8080. It is not hard to imagine
situations where it is needed to change those defaults.
Hence they are made configurable. To customize,
- change the values of the default configuration
- (e.g. in the file "jbpm.console.cfg.xml")
+ change the values of the default configuration
+ (e.g. in the file "jbpm.console.cfg.xml")
and replace them with the values you want.
<jbpm-configuration>
-
+
<process-engine-context>
<string name="jbpm.console.server.host" value="myNewHost">
<string name="jbpm.console.server.port" value="9191">
@@ -46,13 +46,13 @@
</jbpm-configuration>
-
+
Email
The default configuration looks for a jbpm.mail.properties
- classpath resource containing JavaMail properties.
- To send mail through a server other than local host, set the
+ To send mail through a server other than local host, set the
mail.smtp.host property in the mail properties file.
Refer to the Developer
Guide for advanced, yet unsupported, email settings.
-
+
+
+
+ Validate activity name
+
+ When we try to deploy a jpdl process definition,
+ the JpdlBinding will validate the name of activities contained by this process definition.
+ By default, the rule of validation as followed:
+
+
+ If the activity has a name, the name shouldnot be empty. The "" isnot allowed to be used by the name of activity.
+
+
+ The name of activity cannot contain slash(/). It comes from jBPM 3.x. Because jBPM 3.x supported hierarchical names, it allowed an execution could jump from a super-state to the other level of activities. But in jBPM 4.x, there would be no chance to achieve this feature. So if someone want to use slash(/) in the name of activity. He could add this configuration parameter into jbpm.cfg.xml.
+
+<jbpm-configuration>
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+
+ <process-engine-context>
+ <true name='jbpm.activity.allow.slash'/>
+ </process-engine-context>
+</jbpm-configuration>
+
+ By using this, JpdlBinding will skip validation for slash(/) in activity name.
+
+
+
+