01: /*
02: * Created on Oct 16, 2003
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.bpm.flow;
08:
09: import java.util.ArrayList;
10: import java.util.HashMap;
11:
12: import org.xdev.base.xssl.XSSLAction;
13: import org.xdev.base.xssl.XSSLReturn;
14:
15: /**
16: * @author AYegorov
17: *
18: * To change the template for this generated type comment go to
19: * Window>Preferences>Java>Code Generation>Code and Comments
20: */
21: public class ForFlow extends XSSLReturn {
22: private Object returnValue = null;
23:
24: /**
25: * @param id
26: */
27: public ForFlow(String id) {
28: super (id);
29: // TODO Auto-generated constructor stub
30: }
31:
32: /**
33: * @param id
34: * @param properties
35: */
36: public ForFlow(String id, HashMap properties) {
37: super (id, properties);
38: // TODO Auto-generated constructor stub
39: }
40:
41: /* (non-Javadoc)
42: * @see org.xdev.base.transaction.TemplateAbstractElement#getValue()
43: */
44: public Object getObjectValue() {
45: return this .returnValue;
46: }
47:
48: protected synchronized void set() throws Exception {
49:
50: int count = 0;
51:
52: XSSLAction start = (XSSLAction) this .getElement(count++);
53: XSSLAction condition = (XSSLAction) this .getElement(count++);
54:
55: XSSLAction inc = null;
56:
57: if (this .getCount() > 2) {
58: inc = (XSSLAction) this .getElement(count++);
59: } else {
60: inc = start;
61: }
62:
63: XSSLAction action = (XSSLAction) this .getElement(count);
64:
65: Object obj = null;
66:
67: if (start.execute()) {
68:
69: if (start instanceof XSSLReturn) {
70: obj = ((XSSLReturn) start).getObjectValue();
71: }
72:
73: for (this
74: .setReference((start instanceof XSSLReturn ? obj = ((XSSLReturn) start)
75: .getObjectValue()
76: : null)); condition.execute(); this
77: .setReference(obj)) {
78: if (action.execute(this )) {
79: if (action instanceof XSSLReturn) {
80: this .returnValue = ((XSSLReturn) action)
81: .getObjectValue();
82: }
83:
84: inc.execute();
85:
86: if (inc instanceof XSSLReturn) {
87: obj = ((XSSLReturn) inc).getObjectValue();
88: } else {
89: obj = null;
90: }
91: }
92: }
93: }
94: }
95:
96: }
|