[jbpm-commits] JBoss JBPM SVN: r6475 - in jbpm4/trunk/modules: jpdl/src/test/java/org/jbpm/jpdl/parsing and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Jul 9 04:42:30 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-07-09 04:42:29 -0400 (Fri, 09 Jul 2010)
New Revision: 6475

Removed:
   jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/slashinactivity/
   jbpm4/trunk/modules/test-cfg/src/test/resources/org/jbpm/test/slashinactivity/
Modified:
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
   jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
   jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml
Log:
JBPM-2904: remove slash in activity name restriction without introducing a configuration setting

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-09 07:38:13 UTC (rev 6474)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java	2010-07-09 08:42:29 UTC (rev 6475)
@@ -24,7 +24,6 @@
 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;
@@ -33,10 +32,9 @@
 
 /**
  * @author Tom Baeyens
- * @author Huisheng Xu
  */
 public abstract class JpdlBinding extends TagBinding {
-
+  
   public JpdlBinding(String tagName) {
     super(tagName, null, null);
   }
@@ -49,21 +47,12 @@
 
   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)) {
+      if (name.length()==0) {
         parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
       }
-
-      boolean isActivityAllowSlash = true;
-      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);
     }
   }
@@ -71,31 +60,4 @@
   public boolean isNameRequired() {
     return true;
   }
-
-//  TODO remove this dead code
-//
-//  public void parseTransitions(Element element, ActivityImpl activity, Parse parse, JpdlParser jpdlParser) {
-//    List<Element> transitionElements = XmlUtil.elements(element, "transition");
-//    UnresolvedTransitions unresolvedTransitions = parse.contextStackFind(UnresolvedTransitions.class);
-//    for (Element transitionElement: transitionElements) {
-//      String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
-//
-//      Element timerElement = XmlUtil.element(transitionElement, "timer");
-//      if (timerElement!=null) {
-//        if (transitionName!=null) {
-//          TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
-//          timerDefinitionImpl.setSignalName(transitionName);
-//        } else {
-//          parse.addProblem("a transition name is required when a timer is placed on a transition", element);
-//        }
-//      }
-//
-//      TransitionImpl transition = activity.createOutgoingTransition();
-//      transition.setName(transitionName);
-//
-//      unresolvedTransitions.add(transition, transitionElement);
-//
-//      jpdlParser.parseOnEvent(transitionElement, parse, transition, Event.TAKE);
-//    }
-//  }
 }

Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java	2010-07-09 07:38:13 UTC (rev 6474)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/ActivityParsingTest.java	2010-07-09 08:42:29 UTC (rev 6475)
@@ -23,17 +23,27 @@
 
 import java.util.List;
 
+import org.jbpm.api.model.Activity;
 import org.jbpm.pvm.internal.client.ClientProcessDefinition;
 import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
 import org.jbpm.pvm.internal.xml.Problem;
 
-
 /**
  * @author Tom Baeyens
  */
 public class ActivityParsingTest extends JpdlParseTestCase {
 
+  public void testSlashInActivityName() {
+    ClientProcessDefinition processDefinition = parse(
+      "<process name='p'>" +
+      "  <start name='slash / activityname' />" +
+      "</process>"
+    );
+
+    Activity initial = processDefinition.getInitial();
+    assertEquals("slash / activityname", initial.getName());
+  }
+
   public void testEmptyActivityName() {
     List<Problem> problems = parseProblems(
       "<process name='p'>" +
@@ -54,8 +64,7 @@
     );
     assertEquals("process definition description", processDefinition.getDescription());
 
-    ProcessDefinitionImpl processDefinitionImpl = (ProcessDefinitionImpl) processDefinition;
-    ActivityImpl activity = processDefinitionImpl.getInitial();
+    ActivityImpl activity = (ActivityImpl) processDefinition.getInitial();
     assertEquals("start description", activity.getDescription());
   }
 }

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-09 07:38:13 UTC (rev 6474)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch09-Configuration.xml	2010-07-09 08:42:29 UTC (rev 6475)
@@ -88,39 +88,4 @@
       url="http://docs.jboss.com/jbpm/v4/devguide/html_single/#mailsupport">Developer
       Guide</ulink> for advanced, yet unsupported, email settings.</para>
   </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>Before jBPM 4.4, 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 since jBPM 4.4, we allowed slash(/) in the name of activity by default.
-              If someone want to use the previous validation rule for slash(/) in jBPM 4.4,
-              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;false name='jbpm.activity.allow.slash'/></emphasis>
-  &lt;/process-engine-context>
-&lt;/jbpm-configuration>
-              </programlisting>
-          </listitem>
-      </itemizedlist>
-    </para>
-  </section>
 </chapter>



More information about the jbpm-commits mailing list