private Collection<ElementsWaitingForEvent> getEventActions(Activity activity) {
   Map<Element, ElementsWaitingForEvent> results = new HashMap<Element, ElementsWaitingForEvent>();
   for (ActivityNode node : EmfActivityUtil.getActivityNodesRecursively(activity)) {
     if (node instanceof AcceptEventAction && !(node instanceof AcceptCallAction)) {
       AcceptEventAction action = (AcceptEventAction) node;
       for (Trigger trigger : action.getTriggers()) {
         if (trigger.getEvent() != null) {
           ElementsWaitingForEvent eventActions = results.get(trigger.getEvent());
           if (eventActions == null) {
             eventActions = new ElementsWaitingForEvent(trigger.getEvent());
             results.put(trigger.getEvent(), eventActions);
           }
           eventActions.addWaitingNode(action);
         }
       }
     }
   }
   return results.values();
 }
 @Override
 protected void implementEventConsumer(
     Behavior behavior, OJAnnotatedClass ojBehavior, ElementsWaitingForEvent eventActions) {
   OJAnnotatedOperation eventConsumer =
       super.createEventConsumerSignature(behavior, ojBehavior, eventActions.getEvent());
   OJForStatement forEachToken =
       new OJForStatement("token", ActivityProcessImplementor.ACTIVITY_TOKEN, "getTokens()");
   eventConsumer.getBody().addToStatements(forEachToken);
   for (NamedElement waitingNode : eventActions.getWaitingNodes()) {
     AcceptEventAction action = (AcceptEventAction) waitingNode;
     OJPathName waitingClass = ojUtil.classifierPathname(action);
     ojBehavior.addToImports(waitingClass);
     if (EmfActivityUtil.getAllEffectiveIncoming(action).isEmpty()) {
       // TODO check if the activityNodeContainer of this action is active and create a new token
     } else {
       String condition =
           "result==false && token.isActive() && token.getCurrentExecutionElement() instanceof "
               + waitingClass.getName();
       OJIfStatement ifMatchFound = new OJIfStatement(condition);
       forEachToken.getBody().addToStatements(ifMatchFound);
       OJAnnotatedField stateActivation = new OJAnnotatedField("state", waitingClass);
       stateActivation.setInitExp(
           "(" + waitingClass.getName() + ")token.getCurrentExecutionElement()");
       ifMatchFound.getThenPart().addToLocals(stateActivation);
       for (ActivityEdge transition : action.getOutgoings()) {
         OJPathName tpn = ojUtil.classifierPathname(transition);
         OJIfStatement ifAccept =
             new OJIfStatement(
                 "result==false &&  get"
                     + tpn.getLast()
                     + "()."
                     + OperationAnnotator.delegateParameters(eventConsumer));
         ifMatchFound.getThenPart().addToStatements(ifAccept);
         ifAccept.getThenPart().addToStatements("result=true");
         ifAccept.getThenPart().addToStatements("break");
         break;
       }
     }
   }
 }