View Javadoc
1   package org.andromda.cartridges.jbpm.metafacades;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   import org.andromda.metafacades.uml.EventFacade;
6   
7   /**
8    * MetafacadeLogic implementation for org.andromda.cartridges.jbpm.metafacades.JBpmEventState.
9    *
10   * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventState
11   * @author Bob Fields
12   */
13  public class JBpmEventStateLogicImpl
14      extends JBpmEventStateLogic
15  {
16      private static final long serialVersionUID = 34L;
17      /**
18       * @param metaObject
19       * @param context
20       */
21      public JBpmEventStateLogicImpl(Object metaObject, String context)
22      {
23          super(metaObject, context);
24      }
25  
26      /**
27       * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventStateLogic#handleGetBeforeSignals()
28       */
29      protected List<JBpmAction> handleGetBeforeSignals()
30      {
31          final List<JBpmAction> beforeSignals = new ArrayList<JBpmAction>();
32          for (final EventFacade eventObject : this.getDeferrableEvents())
33          {
34              if (eventObject instanceof JBpmAction && ((JBpmAction)eventObject).isBeforeSignal())
35              {
36                  beforeSignals.add((JBpmAction)eventObject);
37              }
38          }
39          return beforeSignals;
40      }
41  
42      /**
43       * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventStateLogic#handleGetAfterSignals()
44       */
45      protected List<JBpmAction> handleGetAfterSignals()
46      {
47          final List<JBpmAction> afterSignals = new ArrayList<JBpmAction>();
48          for (final EventFacade eventObject : this.getDeferrableEvents())
49          {
50              if (eventObject instanceof JBpmAction && ((JBpmAction)eventObject).isAfterSignal())
51              {
52                  afterSignals.add((JBpmAction)eventObject);
53              }
54          }
55          return afterSignals;
56      }
57  
58      /**
59       * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventStateLogic#handleGetNodeEnters()
60       */
61      protected List<JBpmAction> handleGetNodeEnters()
62      {
63          final List<JBpmAction> nodeEnters = new ArrayList<JBpmAction>();
64          for (final EventFacade eventObject : this.getDeferrableEvents())
65          {
66              if (eventObject instanceof JBpmAction && ((JBpmAction)eventObject).isNodeEnter())
67              {
68                  nodeEnters.add((JBpmAction)eventObject);
69              }
70          }
71          return nodeEnters;
72      }
73  
74      /**
75       * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventStateLogic#handleGetNodeLeaves()
76       */
77      protected List<JBpmAction> handleGetNodeLeaves()
78      {
79          final List<JBpmAction> nodeLeaves = new ArrayList<JBpmAction>();
80          for (final EventFacade eventObject : this.getDeferrableEvents())
81          {
82              if (eventObject instanceof JBpmAction && ((JBpmAction)eventObject).isNodeLeave())
83              {
84                  nodeLeaves.add((JBpmAction)eventObject);
85              }
86          }
87          return nodeLeaves;
88      }
89  
90      /**
91       * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventStateLogic#handleGetTasks()
92       */
93      protected List<JBpmAction> handleGetTasks()
94      {
95          final List<JBpmAction> tasks = new ArrayList<JBpmAction>();
96          for (final EventFacade eventObject : this.getDeferrableEvents())
97          {
98              if (eventObject instanceof JBpmAction && ((JBpmAction)eventObject).isTask())
99              {
100                 tasks.add((JBpmAction)eventObject);
101             }
102         }
103         return tasks;
104     }
105 
106     /**
107      * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventStateLogic#handleGetTimers()
108      */
109     protected List<JBpmAction> handleGetTimers()
110     {
111         final List<JBpmAction> timers = new ArrayList<JBpmAction>();
112         for (final EventFacade eventObject : this.getDeferrableEvents())
113         {
114             if (eventObject instanceof JBpmAction && ((JBpmAction)eventObject).isTimer())
115             {
116                 timers.add((JBpmAction)eventObject);
117             }
118         }
119         return timers;
120     }
121 }