2 Replies Latest reply on Dec 19, 2006 6:05 AM by ralfoeldi

    Checking for RuntimeActions in GraphElement

    ralfoeldi

      Hi everybody,

      I'm back at hacking a jBPM App and I've just run into my favorite topic:

      Is it possible that the

      GraphElement
      
      List getRuntimeActionsForEvent(ExecutionContext executionContext, String eventType) {
       List runtimeActionsForEvent = null;
       List runtimeActions = executionContext.getProcessInstance().getRuntimeActions();
       if (runtimeActions!=null) {
       Iterator iter = runtimeActions.iterator();
       while (iter.hasNext()) {
       RuntimeAction runtimeAction = (RuntimeAction) iter.next();
       // if the runtime-action action is registered on this element and this eventType
       if ( (this==runtimeAction.getGraphElement())
       && (eventType.equals(runtimeAction.getEventType()))
       ) {
       // ... add its action to the list of runtime actions
       if (runtimeActionsForEvent==null) runtimeActionsForEvent = new ArrayList();
       runtimeActionsForEvent.add(runtimeAction.getAction());
       }
       }
       }
       return runtimeActionsForEvent;
       }
      


      isn't really what you want?

      If you debug it you will (sometimes) have the situation that thisis a straight forward Java Object and runtimeAction.getGraphElement() resolves to a Node$$EnhancerByCGLIB$$xxxxx. Both objects represent the same node (same id, the CGLIB even refs to the 'this' instance in its 'target' field.... but '==' obviously fails.

      Am I missing something? Bug? Jira? Help?

      Greetings from Bern