[jbpm-commits] JBoss JBPM SVN: r6804 - in jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn: parser and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Nov 7 13:05:42 EST 2010


Author: rebody
Date: 2010-11-07 13:05:42 -0500 (Sun, 07 Nov 2010)
New Revision: 6804

Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndEventBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
Log:
JBPM-2725 error end event

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java	2010-11-07 17:24:08 UTC (rev 6803)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndActivity.java	2010-11-07 18:05:42 UTC (rev 6804)
@@ -33,30 +33,36 @@
 
 
 /**
+ * end event.
+ *
  * @author Tom Baeyens
+ * @author Huisheng Xu
  */
 public class EndActivity extends BpmnActivity implements BpmnEvent {
 
   private static final long serialVersionUID = 1L;
-  
+
   protected boolean endProcessInstance = true;
+
   protected String state = null;
 
+  protected String errorCode = null;
+
   public void execute(ActivityExecution execution) {
     execute((ExecutionImpl)execution);
   }
-  
+
   public void execute(ExecutionImpl execution) {
     Activity activity = execution.getActivity();
     List<? extends Transition> outgoingTransitions = activity.getOutgoingTransitions();
     ActivityImpl parentActivity = (ActivityImpl) activity.getParentActivity();
 
     if (parentActivity != null && "subProcess".equals(parentActivity.getType())) {
-      // if the end activity itself has an outgoing transition 
+      // if the end activity itself has an outgoing transition
       // (such end activities should be drawn on the border of the group)
       if (outgoingTransitions != null && outgoingTransitions.size() == 1) {
          Transition outgoingTransition = outgoingTransitions.get(0);
-         // taking the transition that goes over the group boundaries will 
+         // taking the transition that goes over the group boundaries will
          // destroy the scope automatically (see atomic operation TakeTransition)
          execution.take(outgoingTransition);
 
@@ -64,7 +70,7 @@
         execution.setActivity(parentActivity);
         execution.signal();
       }
-        
+
     } else {
       OpenExecution executionToEnd = null;
       if (endProcessInstance) {
@@ -72,29 +78,38 @@
       } else {
         executionToEnd = execution;
       }
-      
+
       ExecutionImpl parent = (ExecutionImpl) executionToEnd.getParent(); // save parent before it is nullified
-      
-      if (state==null) {
+
+      if (state == null) {
         execution.end(executionToEnd);
       } else {
         execution.end(executionToEnd, state);
       }
-      
+
+      if (parent != null && errorCode != null) {
+        parent.fire(errorCode, (ActivityImpl) activity.getParentActivity());
+      }
+
       // Special case: if during concurrent execution all child executions are ended,
       // then the parent execution must be ended too.
       if (parent != null && parent.getExecutions().isEmpty()
               && Execution.STATE_INACTIVE_CONCURRENT_ROOT.equals(parent.getState()) ) {
         parent.end();
       }
-    } 
-    
+    }
+
   }
-  
+
   public void setEndProcessInstance(boolean endProcessInstance) {
     this.endProcessInstance = endProcessInstance;
   }
+
   public void setState(String state) {
     this.state = state;
   }
+
+  public void setErrorCode(String errorCode) {
+    this.errorCode = errorCode;
+  }
 }

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndEventBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndEventBinding.java	2010-11-07 17:24:08 UTC (rev 6803)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/EndEventBinding.java	2010-11-07 18:05:42 UTC (rev 6804)
@@ -29,6 +29,7 @@
 
 /**
  * @author Tom Baeyens
+ * @author Huisheng Xu
  */
 public class EndEventBinding extends BpmnBinding {
 
@@ -39,17 +40,22 @@
   protected EndEventBinding(String tag) {
     super(tag);
   }
-  
+
   public Object parse(Element element, Parse parse, BpmnParser bpmnParser) {
-EndActivity endActivity = new EndActivity();
-    
+    EndActivity endActivity = new EndActivity();
+
     Element terminateEventDefinition = XmlUtil.element(element, "terminateEventDefinition");
     if (terminateEventDefinition != null) {
-        endActivity.setEndProcessInstance(true);    
+        endActivity.setEndProcessInstance(true);
     } else {
-        endActivity.setEndProcessInstance(false); // default is to end execution, not the process instance    
+        endActivity.setEndProcessInstance(false); // default is to end execution, not the process instance
     }
-    
+
+    Element errorEventDefinition = XmlUtil.element(element, "errorEventDefinition");
+    if (errorEventDefinition != null) {
+      endActivity.setErrorCode(XmlUtil.attribute(errorEventDefinition, "errorRef"));
+    }
+
     return endActivity;
   }
 

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2010-11-07 17:24:08 UTC (rev 6803)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2010-11-07 18:05:42 UTC (rev 6804)
@@ -224,7 +224,7 @@
 
       TagBinding activityBinding = (TagBinding) getBinding(nestedElement, CATEGORY_ACTIVITY);
       if (activityBinding == null) {
-        if (!"sequenceFlow".equals(tagName)) {
+        if (!"sequenceFlow".equals(tagName) && !"boundaryEvent".equals(tagName)) {
           log.debug("unrecognized activity: " + tagName);
         }
         continue;
@@ -275,8 +275,11 @@
       boolean interrupting = cancelActivity.equals("true");
 
       Element timerEventDefinition = XmlUtil.element(boundaryEventElement, "timerEventDefinition");
+      Element errorEventDefinition = XmlUtil.element(boundaryEventElement, "errorEventDefinition");
       if (timerEventDefinition != null) {
         parseBoundaryTimerEventDefinition(timerEventDefinition, interrupting, nestedActivity, refActivity, parse);
+      } else if (errorEventDefinition != null) {
+          // TODO: error event boundary
       } else {
         parse.addProblem("Unsupported boundary event type : " + boundaryEventElement);
       }



More information about the jbpm-commits mailing list