[jbpm-commits] JBoss JBPM SVN: r6456 - in jbpm4/trunk/modules: userguide/src/main/docbook/en/modules and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Jul 3 21:07:22 EDT 2010


Author: rebody
Date: 2010-07-03 21:07:22 -0400 (Sat, 03 Jul 2010)
New Revision: 6456

Modified:
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
Log:
JBPM-2904 add a parameter to decide whether we allow Slash(/) in activity name.

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2010-07-04 00:43:32 UTC (rev 6455)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2010-07-04 01:07:22 UTC (rev 6456)
@@ -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);
 //    }
 //  }

Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	2010-07-04 00:43:32 UTC (rev 6455)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	2010-07-04 01:07:22 UTC (rev 6456)
@@ -8,7 +8,7 @@
       and replace it with the custom values.
     </para>
     <programlisting>&lt;jbpm-configuration&gt;
-    
+
   &lt;import resource=&quot;jbpm.businesscalendar.cfg.xml&quot; /&gt;
   ...
 
@@ -25,20 +25,20 @@
 
 &lt;/jbpm-configuration&gt;</programlisting>
   </section>
-  
+
   <section>
     <title>Console</title>
     <para>By default the server host and port of the console
     web app are respectively <literal>localhost</literal>
-    and <literal>8080</literal>. It is not hard to imagine 
+    and <literal>8080</literal>. 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 &quot;jbpm.console.cfg.xml&quot;) 
+    change the values of the default configuration
+    (e.g. in the file &quot;jbpm.console.cfg.xml&quot;)
     and replace them with the values you want.</para>
 
     <programlisting>&lt;jbpm-configuration&gt;
-    
+
   &lt;process-engine-context&gt;
     &lt;string name=&quot;jbpm.console.server.host&quot; value=&quot;myNewHost&quot;&gt;
     &lt;string name=&quot;jbpm.console.server.port&quot; value=&quot;9191&quot;&gt;
@@ -46,13 +46,13 @@
 
 &lt;/jbpm-configuration&gt;</programlisting>
   </section>
-  
+
   <section>
     <title>Email</title>
     <para>The default configuration looks for a <literal>jbpm.mail.properties</literal>
-      classpath resource containing <ulink 
+      classpath resource containing <ulink
       url="http://java.sun.com/products/javamail/javadocs/">JavaMail properties</ulink>.
-      To send mail through a server other than local host, set the 
+      To send mail through a server other than local host, set the
       <literal>mail.smtp.host</literal> property in the mail properties file.</para>
 
     <programlisting><![CDATA[mail.smtp.host=localhost
@@ -87,5 +87,34 @@
     <para>Refer to the <ulink
       url="http://docs.jboss.com/jbpm/v4/devguide/html_single/#mailsupport">Developer
       Guide</ulink> for advanced, yet unsupported, email settings.</para>
-  </section>  
+  </section>
+
+  <section id="configuration-jpdl">
+    <title>Validate activity name</title>
+
+    <para>When we try to deploy a jpdl process definition,
+      the <literal>JpdlBinding</literal> will validate the name of activities contained by this process definition.
+      By default, the rule of validation as followed:
+      <itemizedlist>
+          <listitem>
+              <para>If the activity has a name, the name shouldnot be empty.  The <literal>""</literal> isnot allowed to be used by the name of activity.</para>
+          </listitem>
+          <listitem>
+              <para>The name of activity cannot contain slash(/).  It comes from jBPM 3.x.  Because jBPM 3.x supported <literal>hierarchical names</literal>, 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.</para>
+              <programlisting>
+&lt;jbpm-configuration>
+  &lt;import resource="jbpm.default.cfg.xml" />
+  &lt;import resource="jbpm.tx.hibernate.cfg.xml" />
+  &lt;import resource="jbpm.jpdl.cfg.xml" />
+
+  &lt;process-engine-context>
+    <emphasis role="bold">&lt;true name='jbpm.activity.allow.slash'/></emphasis>
+  &lt;/process-engine-context>
+&lt;/jbpm-configuration>
+              </programlisting>
+              <para>By using this, JpdlBinding will skip validation for slash(/) in activity name.</para>
+          </listitem>
+      </itemizedlist>
+    </para>
+  </section>
 </chapter>



More information about the jbpm-commits mailing list