01: /*
02: * Created on Jan 9, 2004
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.xdev.base.xssl.manage;
08:
09: import java.util.ArrayList;
10: import java.util.HashMap;
11: import java.util.Observable;
12:
13: import org.xdev.base.core.object.Configuration;
14: import org.xdev.base.xssl.XReference;
15: import org.xdev.base.xssl.XSSLAction;
16: import org.xdev.base.xssl.XSSLActionIterator;
17: import org.xdev.base.xssl.XSSLReturn;
18:
19: /**
20: * @author AYegorov
21: *
22: * To change the template for this generated type comment go to
23: * Window>Preferences>Java>Code Generation>Code and Comments
24: */
25: public class TransactionTriggerFlow extends XSSLReturn implements
26: ITransactionTriggerable {
27: private TransactionTrigger trigger = null;
28:
29: private Object returnObject = null;
30:
31: /**
32: * @param id
33: */
34: public TransactionTriggerFlow(String id) {
35: super (id);
36: // XXX Auto-generated constructor stub
37: }
38:
39: /**
40: * @param id
41: * @param properties
42: */
43: public TransactionTriggerFlow(String id, HashMap properties) {
44: super (id, properties);
45: // XXX Auto-generated constructor stub
46: }
47:
48: protected void set() throws Exception {
49: }
50:
51: /* (non-Javadoc)
52: * @see org.xdev.base.xssl.manage.TransactionTriggerable#trigger(java.util.Observable, java.lang.Object)
53: */
54: public Object trigger(Configuration o, Object parameter)
55: throws Exception {
56: int size = this .getCount();
57:
58: XSSLAction triggerable = null;
59:
60: ArrayList list = new ArrayList();
61:
62: for (int i = 0; i < size; i++) {
63: triggerable = (XSSLAction) this .getElement(i);
64:
65: if (triggerable.execute()) {
66: if (triggerable instanceof XReference) {
67: triggerable = (XSSLAction) ((XReference) triggerable)
68: .getObjectValue();
69: }
70:
71: this .logDebug("Trying to trigger object: "
72: + triggerable);
73:
74: if (triggerable instanceof ITransactionTriggerable) {
75:
76: list.add(((ITransactionTriggerable) triggerable)
77: .trigger(o, parameter));
78: } else {
79: this .logDebug("Object: " + triggerable
80: + " is not triggerable.");
81: }
82: }
83: }
84:
85: this .returnObject = list;
86:
87: return list;
88: }
89:
90: /* (non-Javadoc)
91: * @see org.xdev.base.xssl.XSSLReturn#getValue()
92: */
93: public Object getObjectValue() {
94: return this.returnObject;
95: }
96: }
|