001: package org.andromda.cartridges.jbpm.metafacades;
002:
003: import java.util.List;
004: import java.util.ArrayList;
005: import java.util.Collection;
006: import java.util.Iterator;
007:
008: /**
009: * MetafacadeLogic implementation for org.andromda.cartridges.jbpm.metafacades.JBpmEventState.
010: *
011: * @see org.andromda.cartridges.jbpm.metafacades.JBpmEventState
012: */
013: public class JBpmEventStateLogicImpl extends JBpmEventStateLogic {
014:
015: public JBpmEventStateLogicImpl(Object metaObject, String context) {
016: super (metaObject, context);
017: }
018:
019: protected java.util.List handleGetBeforeSignal() {
020: final List beforeSignals = new ArrayList();
021:
022: final Collection events = this .getDeferrableEvents();
023: for (final Iterator eventIterator = events.iterator(); eventIterator
024: .hasNext();) {
025: final Object eventObject = eventIterator.next();
026: if (eventObject instanceof JBpmAction
027: && ((JBpmAction) eventObject).isBeforeSignal()) {
028: beforeSignals.add(eventObject);
029: }
030: }
031:
032: return beforeSignals;
033: }
034:
035: protected java.util.List handleGetAfterSignal() {
036: final List afterSignals = new ArrayList();
037:
038: final Collection events = this .getDeferrableEvents();
039: for (final Iterator eventIterator = events.iterator(); eventIterator
040: .hasNext();) {
041: final Object eventObject = eventIterator.next();
042: if (eventObject instanceof JBpmAction
043: && ((JBpmAction) eventObject).isAfterSignal()) {
044: afterSignals.add(eventObject);
045: }
046: }
047:
048: return afterSignals;
049: }
050:
051: protected java.util.List handleGetNodeEnter() {
052: final List nodeEnters = new ArrayList();
053:
054: final Collection events = this .getDeferrableEvents();
055: for (final Iterator eventIterator = events.iterator(); eventIterator
056: .hasNext();) {
057: final Object eventObject = eventIterator.next();
058: if (eventObject instanceof JBpmAction
059: && ((JBpmAction) eventObject).isNodeEnter()) {
060: nodeEnters.add(eventObject);
061: }
062: }
063:
064: return nodeEnters;
065: }
066:
067: protected java.util.List handleGetNodeLeave() {
068: final List nodeLeaves = new ArrayList();
069:
070: final Collection events = this .getDeferrableEvents();
071: for (final Iterator eventIterator = events.iterator(); eventIterator
072: .hasNext();) {
073: final Object eventObject = eventIterator.next();
074: if (eventObject instanceof JBpmAction
075: && ((JBpmAction) eventObject).isNodeLeave()) {
076: nodeLeaves.add(eventObject);
077: }
078: }
079:
080: return nodeLeaves;
081: }
082:
083: protected java.util.List handleGetTasks() {
084: final List tasks = new ArrayList();
085:
086: final Collection events = this .getDeferrableEvents();
087: for (final Iterator eventIterator = events.iterator(); eventIterator
088: .hasNext();) {
089: final Object eventObject = eventIterator.next();
090: if (eventObject instanceof JBpmAction
091: && ((JBpmAction) eventObject).isTask()) {
092: tasks.add(eventObject);
093: }
094: }
095:
096: return tasks;
097: }
098:
099: protected List handleGetTimers() {
100: final List timers = new ArrayList();
101:
102: final Collection events = this .getDeferrableEvents();
103: for (final Iterator eventIterator = events.iterator(); eventIterator
104: .hasNext();) {
105: final Object eventObject = eventIterator.next();
106: if (eventObject instanceof JBpmAction
107: && ((JBpmAction) eventObject).isTimer()) {
108: timers.add(eventObject);
109: }
110: }
111:
112: return timers;
113: }
114: }
|