[jbpm-commits] JBoss JBPM SVN: r6825 - in jbpm4/trunk/modules: bpmn/src/main/java/org/jbpm/bpmn/parser and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Nov 16 01:16:58 EST 2010


Author: rebody
Date: 2010-11-16 01:16:57 -0500 (Tue, 16 Nov 2010)
New Revision: 6825

Added:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowSignalEvent.java
Modified:
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateCatchEventBinding.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java
   jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java
   jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml
   jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/BoundarySignalEventTest.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java
Log:
JBPM-2735 immediate throw signal event

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateCatchEventBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateCatchEventBinding.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateCatchEventBinding.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -33,11 +33,11 @@
  * @author Joram Barrez
  */
 public class IntermediateCatchEventBinding extends BpmnBinding {
-  
+
   public IntermediateCatchEventBinding() {
     super("intermediateCatchEvent");
   }
-  
+
   public Object parse(Element element, Parse parse, BpmnParser bpmnParser) {
     String id = XmlUtil.attribute(element, "id");
     Element eventDefinition = XmlUtil.element(element);
@@ -46,27 +46,27 @@
     } else {
       parse.addProblem("Invalid eventDefinition type : " + eventDefinition.getNodeName());
     }
-    
+
     return null;
   }
-  
-  protected IntermediateCatchTimerEvent createIntermediateTimerCatchEvent(String catchEventId, 
+
+  protected IntermediateCatchTimerEvent createIntermediateTimerCatchEvent(String catchEventId,
           Element eventDefinitionElement, BpmnParser parser, Parse parse) {
-    
+
     IntermediateCatchTimerEvent intermediateCatchTimerEvent = new IntermediateCatchTimerEvent();
     TimerDefinitionImpl timerDefinition = parser.parseTimerEventDefinition(eventDefinitionElement, parse, catchEventId);
-    
+
     // Attach the timerDefinition to the current activity.
-    // That way, the PVM will automatically pcik it up when the execution arrives in the activity.
+    // That way, the PVM will automatically pick it up when the execution arrives in the activity.
     ActivityImpl activity = parse.contextStackFind(ActivityImpl.class);
     activity.addTimerDefinition(timerDefinition);
-    
+
     // The timer will fire an event on which this class will listen.
     String eventName = "INTERMEDIATE_TIMER_" + catchEventId;
     timerDefinition.setEventName(eventName);
     EventImpl timerEvent = activity.createEvent(eventName);
     timerEvent.createEventListenerReference(intermediateCatchTimerEvent);
-   
+
     return intermediateCatchTimerEvent;
   }
 

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowEventBinding.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -0,0 +1,65 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.bpmn.parser.BpmnParser;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.TimerDefinitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+/**
+ * @author Huisheng Xu
+ */
+public class IntermediateThrowEventBinding extends BpmnBinding {
+
+  public IntermediateThrowEventBinding() {
+    super("intermediateThrowEvent");
+  }
+
+  public Object parse(Element element, Parse parse, BpmnParser bpmnParser) {
+    String id = XmlUtil.attribute(element, "id");
+    Element eventDefinition = XmlUtil.element(element);
+    if ("signalEventDefinition".equals(eventDefinition.getNodeName())) {
+      return createIntermediateSignalThrowEvent(id, eventDefinition, bpmnParser, parse);
+    } else {
+      parse.addProblem("Invalid eventDefinition type : " + eventDefinition.getNodeName());
+    }
+
+    return null;
+  }
+
+  protected IntermediateThrowSignalEvent createIntermediateSignalThrowEvent(String throwEventId,
+          Element eventDefinitionElement, BpmnParser parser, Parse parse) {
+
+    // String eventName = "INTERMEDIATE_SIGNAL_" + throwEventId;
+    String eventName = XmlUtil.attribute(eventDefinitionElement, "signalRef");
+
+    IntermediateThrowSignalEvent intermediateThrowSignalEvent = new IntermediateThrowSignalEvent();
+    intermediateThrowSignalEvent.setSignalCode(eventName);
+
+    return intermediateThrowSignalEvent;
+  }
+
+}

Added: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowSignalEvent.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowSignalEvent.java	                        (rev 0)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/IntermediateThrowSignalEvent.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -0,0 +1,61 @@
+/*
+ * 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.bpmn.flownodes;
+
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ *
+ * @author Huisheng Xu
+ */
+public class IntermediateThrowSignalEvent extends BpmnActivity implements EventListener, BpmnEvent {
+
+  private static final long serialVersionUID = 1L;
+
+  protected String signalCode;
+
+  public void execute(ActivityExecution execution) {
+    ExecutionImpl executionImpl = (ExecutionImpl) execution;
+    execute(executionImpl);
+    proceed(executionImpl, findOutgoingSequenceFlow(executionImpl, CONDITIONS_CHECKED));
+  }
+
+  public void execute(ExecutionImpl execution) {
+    execution.fire(signalCode, execution.getActivity());
+  }
+
+  public void notify(EventListenerExecution execution) throws Exception {
+    this.execute((ExecutionImpl) execution);
+  }
+
+  public void setSignalCode(String signalCode) {
+    this.signalCode = signalCode;
+  }
+
+  public boolean isDefaultEnabled() {
+    return true;
+  }
+
+}

Modified: jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/flownodes/SubProcessActivity.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -49,7 +49,7 @@
     if (!startActivities.isEmpty()) {
       ExecutionImpl parent = execution.createScope(execution.getActivity());
  
-      for (Activity startActivity: startActivities) {
+      for (Activity startActivity : startActivities) {
         parent.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
         ExecutionImpl concurrentExecution = parent.createExecution();
         concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
@@ -69,7 +69,7 @@
     List<Activity> startActivities = new ArrayList<Activity>();
     
     for (Activity nestedActivity : execution.getActivity().getActivities()) {
-      if ( (nestedActivity.getIncomingTransitions()==null)
+      if ( (nestedActivity.getIncomingTransitions() == null)
               || (nestedActivity.getIncomingTransitions().isEmpty())) {
         startActivities.add(nestedActivity);
       }

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-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/bpmn/src/main/java/org/jbpm/bpmn/parser/BpmnParser.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -341,6 +341,7 @@
       event = refActivity.createEvent(eventName);
     }
     EventListenerReference eventListenerReference = event.createEventListenerReference(boundaryEscalationEvent);
+    eventListenerReference.setPropagationEnabled(true);
 
     escalationActivity.setActivityBehaviour(boundaryEscalationEvent);
   }
@@ -362,6 +363,7 @@
       event = refActivity.createEvent(eventName);
     }
     EventListenerReference eventListenerReference = event.createEventListenerReference(boundarySignalEvent);
+    eventListenerReference.setPropagationEnabled(true);
 
     signalActivity.setActivityBehaviour(boundarySignalEvent);
   }
@@ -381,6 +383,7 @@
       event = refActivity.createEvent(eventName);
     }
     EventListenerReference eventListenerReference = event.createEventListenerReference(boundaryErrorEvent);
+    eventListenerReference.setPropagationEnabled(true);
 
     errorActivity.setActivityBehaviour(boundaryErrorEvent);
   }

Modified: jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml
===================================================================
--- jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/bpmn/src/main/resources/jbpm.bpmn.flownodes.xml	2010-11-16 06:16:57 UTC (rev 6825)
@@ -6,6 +6,7 @@
 
     <!-- Events -->
     <activity binding="org.jbpm.bpmn.flownodes.IntermediateCatchEventBinding" />
+    <activity binding="org.jbpm.bpmn.flownodes.IntermediateThrowEventBinding" />
 
     <!-- Gateway bindings -->
     <activity binding="org.jbpm.bpmn.flownodes.ExclusiveGatewayBinding" />

Modified: jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/BoundarySignalEventTest.java
===================================================================
--- jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/BoundarySignalEventTest.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/examples/src/test/java/org/jbpm/examples/bpmn/event/signal/BoundarySignalEventTest.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -19,7 +19,7 @@
  * 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.examples.bpmn.event.error;
+package org.jbpm.examples.bpmn.event.signal;
 
 import org.jbpm.api.NewDeployment;
 import org.jbpm.api.ProcessInstance;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -47,7 +47,7 @@
   // listener references //////////////////////////////////////////////////////
   
   public EventListenerReference createEventListenerReference() {
-    if (listenerReferences==null) {
+    if (listenerReferences == null) {
       listenerReferences = new ArrayList<EventListenerReference>();
     }
     EventListenerReference activityReference = new EventListenerReference();

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -50,16 +50,16 @@
   }
 
   public boolean isAsync() {
-    return Continuation.SYNCHRONOUS!=continuation;
+    return Continuation.SYNCHRONOUS != continuation;
   }
 
   // customized getters and setters ///////////////////////////////////////////
 
   public EventListener getEventListener() {
-    if (eventListener!=null) {
+    if (eventListener != null) {
       return eventListener;
     }
-    if (eventListenerDescriptor!=null) {
+    if (eventListenerDescriptor != null) {
       EventListener createdEventListener = (EventListener) ReflectUtil.instantiateUserCode(eventListenerDescriptor, processDefinition, null);
       if (!isEventListenerStateful) {
         eventListener = createdEventListener;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -101,7 +101,7 @@
 
   /** a unique id for this execution. */
   protected String id;
-  
+
   /** user id/name who started the process instance, can be null */
   protected String initiator;
 
@@ -533,7 +533,7 @@
     // in graph based processDefinition languages we assume that a
     // default transition is available
     TransitionImpl defaultTransition = findDefaultTransition();
-    if (defaultTransition!=null) {
+    if (defaultTransition != null) {
       take(defaultTransition);
     }
     // in block structured processDefinition languages we assume that
@@ -543,7 +543,7 @@
       ActivityImpl parentActivity = getActivity().getParentActivity();
 
       // if there is a parent activity
-      if (parentActivity!=null) {
+      if (parentActivity != null) {
         // propagate to the parent
         performAtomicOperation(AtomicOperation.PROPAGATE_TO_PARENT);
       }
@@ -574,7 +574,7 @@
   public void fire(String eventName, ObservableElementImpl observableElement,
     AtomicOperation eventCompletedOperation) {
     EventImpl event = findEvent(observableElement, eventName);
-    if (event!=null) {
+    if (event != null) {
       setEvent(event);
       setEventSource(observableElement);
       setEventListenerIndex(0);
@@ -648,7 +648,7 @@
   }
 
   public void performAtomicOperationSync(AtomicOperation operation) {
-    if (atomicOperations==null) {
+    if (atomicOperations == null) {
       // initialise the fifo queue of atomic operations
       atomicOperations = new LinkedList<AtomicOperation>();
       atomicOperations.offer(operation);
@@ -656,7 +656,7 @@
       ExecutionContext originalExecutionContext = null;
       ExecutionContext executionContext = null;
       EnvironmentImpl environment = EnvironmentImpl.getCurrent();
-      if (environment!=null) {
+      if (environment != null) {
         originalExecutionContext = (ExecutionContext) environment
           .getContext(Context.CONTEXTNAME_EXECUTION);
         if (originalExecutionContext != null
@@ -670,7 +670,7 @@
       }
 
       try {
-        while (! atomicOperations.isEmpty()) {
+        while (!atomicOperations.isEmpty()) {
           AtomicOperation atomicOperation = atomicOperations.poll();
           atomicOperation.perform(this);
         }
@@ -678,10 +678,10 @@
       finally {
         atomicOperations = null;
 
-        if (executionContext!=null) {
+        if (executionContext != null) {
           environment.removeContext(executionContext);
         }
-        if (originalExecutionContext!=null) {
+        if (originalExecutionContext != null) {
           environment.setContext(originalExecutionContext);
         }
       }
@@ -1046,7 +1046,7 @@
     }
     subProcessInstance = (ExecutionImpl) processDefinition.createProcessInstance(key);
     subProcessInstance.setSuperProcessExecution(this);
-    
+
     return subProcessInstance;
   }
 

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -31,39 +31,34 @@
 import org.jbpm.pvm.internal.util.Clock;
 
 public class ExecuteActivity extends AtomicOperation {
-  
+
   private static final long serialVersionUID = 1L;
-  
+
   private static final Log log = Log.getLog(ExecuteActivity.class.getName());
-  
+
   public boolean isAsync(ExecutionImpl execution) {
     return execution.getActivity().isAsync();
   }
 
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+
     ActivityImpl activity = execution.getActivity();
-    
-    if (log.isDebugEnabled()) {
-      if (execution.getName()!=null) {
-        log.debug(execution.toString()+" executes "+activity);
-      } else {
-        log.debug("executing "+activity);
-      }
-    }
-    
+
     ActivityBehaviour activityBehaviour = activity.getActivityBehaviour();
-    
+
     try {
       execution.setPropagation(Propagation.UNSPECIFIED);
       execution.setHistoryActivityStart(Clock.getTime());
 
       activityBehaviour.execute(execution);
-      
+
     } catch (Exception e) {
-      execution.handleException(activity, null, null, e, execution.toString()+" couldn't execute "+activityBehaviour+" for activity "+activity);
+      execution.handleException(activity, null, null, e, execution.toString() + " couldn't execute " + activityBehaviour + " for activity " + activity);
     }
-    
-    if (execution.getPropagation()==Propagation.UNSPECIFIED) {
+
+    if (execution.getPropagation() == Propagation.UNSPECIFIED) {
       execution.proceed();
     }
   }
@@ -74,7 +69,7 @@
 
   public MessageImpl createAsyncMessage(ExecutionImpl execution) {
     ExecuteActivityMessage executeActivityMessage = new ExecuteActivityMessage(execution);
-    if (execution.getActivity().getContinuation()==Continuation.EXCLUSIVE) {
+    if (execution.getActivity().getContinuation() == Continuation.EXCLUSIVE) {
       executeActivityMessage.setExclusive(true);
     }
     return executeActivityMessage;

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -37,23 +37,23 @@
  * @author Tom Baeyens
  */
 public class ExecuteEventListener extends AtomicOperation {
-  
+
   private static final long serialVersionUID = 1L;
-  
+
   private static Log log = Log.getLog(ExecuteEventListener.class.getName());
-  
+
   public boolean isAsync(ExecutionImpl execution) {
     int eventListenerIndex = execution.getEventListenerIndex();
     EventImpl event = execution.getEvent();
-    
-    if ( (eventListenerIndex==0)
+
+    if ( (eventListenerIndex == 0)
          && (event.isAsync())
        ) {
       return true;
     }
-    
+
     List<EventListenerReference> eventListenerReferences = event.getListenerReferences();
-    if ( (eventListenerReferences==null)
+    if ( (eventListenerReferences == null)
          || (eventListenerReferences.isEmpty())
        ) {
       return false;
@@ -64,11 +64,14 @@
   }
 
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+
     EventImpl event = execution.getEvent();
     ObservableElementImpl observableElement = event.getObservableElement();
     int eventListenerIndex = execution.getEventListenerIndex();
     List<EventListenerReference> eventListenerReferences = event.getListenerReferences();
-    if ( (eventListenerReferences!=null)
+    if ( (eventListenerReferences != null)
          && (!eventListenerReferences.isEmpty())
        ) {
       EventListenerReference eventListenerReference = eventListenerReferences.get(eventListenerIndex);
@@ -103,7 +106,7 @@
       // find the next event with listeners
       EventImpl propagatedEvent = ExecutionImpl.findEvent(parent, event.getName());
 
-      // if there is an propagated event with listeners 
+      // if there is an propagated event with listeners
       if (propagatedEvent != null) {
         // propagate to the that event
         execution.setEvent(propagatedEvent);
@@ -111,7 +114,7 @@
         execution.performAtomicOperation(AtomicOperation.EXECUTE_EVENT_LISTENER);
 
       } else {
-        // event is completed, perform the eventCompletedOperation 
+        // event is completed, perform the eventCompletedOperation
         AtomicOperation eventCompletedOperation = execution.getEventCompletedOperation();
 
         execution.setEvent(null);

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -21,6 +21,7 @@
  */
 package org.jbpm.pvm.internal.model.op;
 
+import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.job.MessageImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.ActivityImpl;
@@ -29,9 +30,11 @@
  * @author Tom Baeyens
  */
 public class MoveToChildActivity extends AtomicOperation {
-  
+
   private static final long serialVersionUID = 1L;
 
+  private static final Log log = Log.getLog(MoveToChildActivity.class.getName());
+
   private ActivityImpl activity;
 
   public MoveToChildActivity(ActivityImpl activity) {
@@ -39,6 +42,10 @@
   }
 
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+    log.debug("activity " + activity);
+
     execution.setActivity(activity);
     ExecutionImpl propagatingExecution = execution.startActivity(activity);
     propagatingExecution.performAtomicOperation(AtomicOperation.EXECUTE_ACTIVITY);
@@ -51,4 +58,8 @@
   public MessageImpl createAsyncMessage(ExecutionImpl execution) {
     return null;
   }
+
+  public String toString() {
+    return "MoveToChildActivity";
+  }
 }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -21,6 +21,7 @@
  */
 package org.jbpm.pvm.internal.model.op;
 
+import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.job.MessageImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.ActivityImpl;
@@ -32,11 +33,18 @@
 
   private static final long serialVersionUID = 1L;
 
+  private static final Log log = Log.getLog(MoveToParentActivity.class.getName());
+
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+    log.debug("activity " + execution.getActivity() + ", parent activity : " + execution.getActivity().getParentActivity());
+
     ActivityImpl activity = execution.getActivity();
     ActivityImpl parentActivity = activity.getParentActivity();
+
     ExecutionImpl propagatingExecution = execution.endActivity(activity);
-    
+
     propagatingExecution.setActivity(parentActivity);
     propagatingExecution.performAtomicOperation(new Signal(null, null));
   }
@@ -48,7 +56,7 @@
   public boolean isAsync(ExecutionImpl execution) {
     return false;
   }
-  
+
   public String toString() {
     return "MoveToParentActivity";
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -55,13 +55,10 @@
 
   @Override
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+
     ActivityImpl activity = execution.getActivity();
-    if (execution.getName() != null) {
-      log.debug(execution.toString() + " signals " + activity);
-    }
-    else {
-      log.debug("signalling " + activity + ", signalName=" + signalName);
-    }
 
     ExternalActivityBehaviour activityBehaviour = (ExternalActivityBehaviour) activity
       .getActivityBehaviour();
@@ -80,7 +77,7 @@
       execution.proceed();
     }
   }
-  
+
   @Override
   public String toString() {
     return "Signal(" + signalName + ')';

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -22,6 +22,7 @@
 package org.jbpm.pvm.internal.model.op;
 
 import org.jbpm.api.model.Event;
+import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.job.MessageImpl;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -33,13 +34,18 @@
 
   private static final long serialVersionUID = 1L;
 
+  private static final Log log = Log.getLog(TransitionEndActivity.class.getName());
+
   public boolean isAsync(ExecutionImpl execution) {
     return false;
   }
 
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+
     ActivityImpl activity = execution.getActivity();
-    
+
     ExecutionImpl propagatingExecution = execution;
     if (activity.isLocalScope()) {
       propagatingExecution = execution.destroyScope(activity);
@@ -47,7 +53,7 @@
 
     ActivityImpl parentActivity = activity.getParentActivity();
     ActivityImpl destination = execution.getTransition().getDestination();
-    if ( (parentActivity!=null)
+    if ( (parentActivity != null)
          && (!parentActivity.contains(destination))
        ) {
       propagatingExecution.setActivity(parentActivity);

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -23,6 +23,7 @@
 
 import org.jbpm.api.JbpmException;
 import org.jbpm.api.model.Event;
+import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.job.MessageImpl;
 import org.jbpm.pvm.internal.model.ActivityImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -32,48 +33,53 @@
  * @author Tom Baeyens
  */
 public class TransitionStartActivity extends AtomicOperation {
-  
+
   private static final long serialVersionUID = 1L;
 
+  private static final Log log = Log.getLog(TransitionStartActivity.class.getName());
+
   public boolean isAsync(ExecutionImpl execution) {
     return false;
   }
 
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+
     TransitionImpl transition = execution.getTransition();
     ActivityImpl source = transition.getSource();
     ActivityImpl destination = transition.getDestination();
-    
+
     ActivityImpl activity = execution.getActivity();
-    if (activity==null) {
+    if (activity == null) {
       // find outer most activity to start
       activity = destination;
-      while ( (activity.getParentActivity()!=null)
+      while ( (activity.getParentActivity() != null)
               && (!activity.getParentActivity().contains(source))
             ) {
         activity = activity.getParentActivity();
       }
-      
-    } else if (activity==destination){
+
+    } else if (activity == destination){
       activity = null;
 
     } else {
       ActivityImpl parent = activity;
       activity = destination;
-      while ( (activity!=null)
-              && (activity.getParent()!=parent) 
+      while ( (activity != null)
+              && (activity.getParent() != parent)
             ) {
         activity = activity.getParentActivity();
       }
-      if (activity==null) {
+      if (activity == null) {
         throw new JbpmException("implementation bug: couldn't find parent "+parent+" around destination "+destination);
       }
     }
 
-    if (activity==null) {
+    if (activity == null) {
       execution.setTransition(null);
       execution.performAtomicOperation(AtomicOperation.EXECUTE_ACTIVITY);
-   
+
     } else {
       execution.setActivity(activity);
 
@@ -85,7 +91,7 @@
       propagatingExecution.fire(Event.START, activity, AtomicOperation.TRANSITION_START_ACTIVITY);
     }
   }
-  
+
   public MessageImpl createAsyncMessage(ExecutionImpl execution) {
     throw new UnsupportedOperationException("please implement me");
   }

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java	2010-11-14 17:01:38 UTC (rev 6824)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java	2010-11-16 06:16:57 UTC (rev 6825)
@@ -22,6 +22,7 @@
 package org.jbpm.pvm.internal.model.op;
 
 import org.jbpm.api.model.Event;
+import org.jbpm.internal.log.Log;
 import org.jbpm.pvm.internal.job.MessageImpl;
 import org.jbpm.pvm.internal.model.ExecutionImpl;
 import org.jbpm.pvm.internal.model.TransitionImpl;
@@ -34,12 +35,18 @@
 
   private static final long serialVersionUID = 1L;
 
+  private static final Log log = Log.getLog(TransitionTake.class.getName());
+
   public boolean isAsync(ExecutionImpl execution) {
     return false;
   }
 
   public void perform(ExecutionImpl execution) {
+
+    log.debug("execution : " + execution + ", activity : " + execution.getActivity() + ", transition : " + execution.getTransition());
+
     TransitionImpl transition = execution.getTransition();
+
     execution.setActivity(null);
     execution.fire(Event.TAKE, transition, AtomicOperation.TRANSITION_START_ACTIVITY);
   }



More information about the jbpm-commits mailing list