Package org.jbpm.pvm.internal.model

Examples of org.jbpm.pvm.internal.model.ObservableElementImpl


    return eventListenerReference.isAsync();
  }

  public void perform(ExecutionImpl execution) {
    EventImpl event = execution.getEvent();
    ObservableElementImpl observableElement = event.getObservableElement();
    int eventListenerIndex = execution.getEventListenerIndex();
    List<EventListenerReference> eventListenerReferences = event.getListenerReferences();
    if ( (eventListenerReferences!=null)
         && (!eventListenerReferences.isEmpty())
       ) {
      EventListenerReference eventListenerReference = eventListenerReferences.get(eventListenerIndex);
      ObservableElement eventSource = execution.getEventSource();
      if ((eventSource == observableElement) || (eventListenerReference.isPropagationEnabled())) {
        EventListener eventListener = eventListenerReference.get();
        log.trace("executing " + eventListener + " for " + event);
        try {
          // TODO can/should this invocation be unified with the exception handler invocation of the event notification method?
          eventListener.notify(execution);
        } catch (Exception e) {
          log.trace("exception during action: " + e);
          execution.handleException((ObservableElementImpl) observableElement, event, eventListenerReference, e, "couldn't run action " + eventListener);
        }
      }
      // increment the event listener index
      eventListenerIndex++;
      execution.setEventListenerIndex(eventListenerIndex);
    }
   
    // if there are more listeners in this event
    if ( (eventListenerReferences!=null)
         && (eventListenerIndex < eventListenerReferences.size())
       ) {
      // execute the next listener
      execution.performAtomicOperation(AtomicOperation.EXECUTE_EVENT_LISTENER);

    } else {
      // there are no more listeners in this event

      ObservableElementImpl parent = observableElement.getParent();
      // find the next event with listeners
      EventImpl propagatedEvent = ExecutionImpl.findEvent(parent, event.getName());

      // if there is an propagated event with listeners
      if (propagatedEvent != null) {
View Full Code Here


      asyncExecutionInfo.put(KEY_TRANSITION_SOURCE_INDEX, source.getOutgoingTransitions().indexOf(transition));
    }

    asyncExecutionInfo.put(KEY_STATE, execution.getState());

    ObservableElementImpl eventSource = (ObservableElementImpl) execution.getEventSource();
    if (eventSource instanceof ProcessDefinitionImpl) {
      asyncExecutionInfo.put(KEY_EVENT_SOURCE_PROCESS_DEFINITION, null);
     
    } else if (eventSource instanceof ActivityImpl) {
      asyncExecutionInfo.put(KEY_EVENT_SOURCE_ACTIVITY, eventSource.getName());
     
    } else if (eventSource instanceof TransitionImpl) {
      asyncExecutionInfo.put(KEY_EVENT_SOURCE_TRANSITION, null);
    }
View Full Code Here

   
    } else if (asyncExecutionInfo.containsKey(KEY_EVENT_SOURCE_TRANSITION)){
      execution.setEventSource(transition);
    }
   
    ObservableElementImpl observableElement = (ObservableElementImpl) execution.getEventSource();
    int parentLevel = (Integer) asyncExecutionInfo.get(KEY_EVENT_OBSERVABLE_PARENT_LEVEL);
    for (int i=0; i<parentLevel; parentLevel++) {
      observableElement = observableElement.getParent();
    }
   
    String eventName = (String) asyncExecutionInfo.get(KEY_EVENT_NAME);
    EventImpl event = observableElement.getEvent(eventName);
    execution.setEvent(event);
   
    Integer eventListenerIndex = (Integer) asyncExecutionInfo.get(KEY_EVENT_LISTENER_INDEX);
    execution.setEventListenerIndex(eventListenerIndex);
View Full Code Here

      asyncExecutionInfo.put(KEY_TRANSITION_SOURCE_INDEX, source.getOutgoingTransitions().indexOf(transition));
    }

    asyncExecutionInfo.put(KEY_STATE, execution.getState());

    ObservableElementImpl eventSource = (ObservableElementImpl) execution.getEventSource();
    if (eventSource instanceof ProcessDefinitionImpl) {
      asyncExecutionInfo.put(KEY_EVENT_SOURCE_PROCESS_DEFINITION, null);
     
    } else if (eventSource instanceof ActivityImpl) {
      asyncExecutionInfo.put(KEY_EVENT_SOURCE_ACTIVITY, eventSource.getName());
     
    } else if (eventSource instanceof TransitionImpl) {
      asyncExecutionInfo.put(KEY_EVENT_SOURCE_TRANSITION, null);
    }
View Full Code Here

   
    } else if (asyncExecutionInfo.containsKey(KEY_EVENT_SOURCE_TRANSITION)){
      execution.setEventSource(transition);
    }
   
    ObservableElementImpl observableElement = (ObservableElementImpl) execution.getEventSource();
    int parentLevel = (Integer) asyncExecutionInfo.get(KEY_EVENT_OBSERVABLE_PARENT_LEVEL);
    for (int i=0; i<parentLevel; parentLevel++) {
      observableElement = observableElement.getParent();
    }
   
    String eventName = (String) asyncExecutionInfo.get(KEY_EVENT_NAME);
    EventImpl event = observableElement.getEvent(eventName);
    execution.setEvent(event);
   
    Integer eventListenerIndex = (Integer) asyncExecutionInfo.get(KEY_EVENT_LISTENER_INDEX);
    execution.setEventListenerIndex(eventListenerIndex);
View Full Code Here

    return eventListenerReference.isAsync();
  }

  public void perform(ExecutionImpl execution) {
    EventImpl event = execution.getEvent();
    ObservableElementImpl observableElement = event.getObservableElement();
    int eventListenerIndex = execution.getEventListenerIndex();
    List<EventListenerReference> eventListenerReferences = event.getListenerReferences();
    if ( (eventListenerReferences!=null)
         && (!eventListenerReferences.isEmpty())
       ) {
      EventListenerReference eventListenerReference = eventListenerReferences.get(eventListenerIndex);
      ObservableElement eventSource = execution.getEventSource();
      if ((eventSource == observableElement) || (eventListenerReference.isPropagationEnabled())) {
        EventListener eventListener = eventListenerReference.getEventListener();
        log.trace("executing " + eventListener + " for " + event);
        try {
          // TODO can/should this invocation be unified with the exception handler invocation of the event notification method?
          eventListener.notify(execution);
        } catch (Exception e) {
          log.trace("exception during action: " + e);
          execution.handleException((ObservableElementImpl) observableElement, event, eventListenerReference, e, "couldn't run action " + eventListener);
        }
      }
      // increment the event listener index
      eventListenerIndex++;
      execution.setEventListenerIndex(eventListenerIndex);
    }
   
    // if there are more listeners in this event
    if ( (eventListenerReferences!=null)
         && (eventListenerIndex < eventListenerReferences.size())
       ) {
      // execute the next listener
      execution.performAtomicOperation(AtomicOperation.EXECUTE_EVENT_LISTENER);

    } else {
      // there are no more listeners in this event

      ObservableElementImpl parent = observableElement.getParent();
      // find the next event with listeners
      EventImpl propagatedEvent = ExecutionImpl.findEvent(parent, event.getName());

      // if there is an propagated event with listeners
      if (propagatedEvent != null) {
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.model.ObservableElementImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.