[jbpm-commits] JBoss JBPM SVN: r4545 - in jbpm4/trunk/modules: examples/src/test/java/org/jbpm/examples/timer and 5 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 14 04:51:49 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-04-14 04:51:49 -0400 (Tue, 14 Apr 2009)
New Revision: 4545

Added:
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/
   jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml
Modified:
   jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
Log:
JBPM-2029 added timer transition example

Added: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java	2009-04-14 08:51:49 UTC (rev 4545)
@@ -0,0 +1,17 @@
+package org.jbpm.examples.timer.transition;
+
+import org.jbpm.Execution;
+import org.jbpm.test.JbpmTestCase;
+
+
+public class TimerTransitionTest extends JbpmTestCase {
+  
+  public void testTimerTransition() {
+    deployJpdlResource("org/jbpm/examples/timer/transition/process.jpdl.xml");
+    
+    Execution processInstance = executionService.startProcessInstanceByKey("TimerTransition");
+    
+    managementService.createJobQuery()
+      .processInstanceId(processInstance.getId());
+  }
+}


Property changes on: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/timer/transition/TimerTransitionTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml	                        (rev 0)
+++ jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml	2009-04-14 08:51:49 UTC (rev 4545)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="TimerTransition" xmlns="http://jbpm.org/4/jpdl">
+
+  <start g="20,20,48,48">
+    <transition to="wait" />
+  </start>
+
+  <state name="wait" g="96,16,127,52">
+    <timer duedate="10 minutes" transition="timout" />
+    <transition name="default" to="next step" />
+    <transition name="timout" to="escalation" />
+  </state>
+  
+  <state name="next step" />
+  <state name="escalation" g="255,16,88,52"/>
+
+</process>


Property changes on: jbpm4/trunk/modules/examples/src/test/resources/org/jbpm/examples/timer/transition/process.jpdl.xml
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java	2009-04-14 07:13:56 UTC (rev 4544)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java	2009-04-14 08:51:49 UTC (rev 4545)
@@ -260,11 +260,13 @@
     String transition = XmlUtil.attribute(timerElement, "transition");
     timerDefinition.setSignalName(transition);
 
-    String duedate = XmlUtil.attribute(timerElement, "duedate", true, parse);
-    timerDefinition.setDueDateDescription(duedate);
-    
-    String duedatetime = XmlUtil.attribute(timerElement, "duedatetime", true, parse);
-    if (duedatetime!=null) {
+    String duedate = XmlUtil.attribute(timerElement, "duedate");
+    String duedatetime = XmlUtil.attribute(timerElement, "duedatetime");
+
+    if (duedate!=null) {
+      timerDefinition.setDueDateDescription(duedate);
+      
+    } else if (duedatetime!=null) {
       String dueDateTimeFormatText = (String) Environment.getFromCurrent("jbpm.duedatetime.format");
       if (dueDateTimeFormatText==null) {
         dueDateTimeFormatText = "HH:mm dd/MM/yyyy";
@@ -276,6 +278,8 @@
       } catch (ParseException e) {
         parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
       }
+    } else {
+      parse.addProblem("either duedate or duedatetime is required in timer");
     }
     
     String repeat = XmlUtil.attribute(timerElement, "repeat");




More information about the jbpm-commits mailing list