001: package org.enhydra.shark.corba;
002:
003: import javax.transaction.UserTransaction;
004:
005: import org.omg.WfBase.*;
006: import org.omg.WorkflowModel.WfAssignment;
007: import org.omg.WorkflowModel._WfAssignmentIteratorImplBase;
008:
009: /**
010: * Iterator for assignments of activity.
011: *
012: * @author Sasa Bojanic
013: * @version 1.0
014: */
015: public class WfAssignmentIteratorCORBA extends
016: _WfAssignmentIteratorImplBase {
017: // private SharkCORBAServer myServer;
018:
019: org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator myIterator;
020:
021: private Collective __collective;
022:
023: protected WfAssignmentIteratorCORBA(
024: Collective toJoin,
025: org.enhydra.shark.api.client.wfmodel.WfAssignmentIterator iter)
026: throws BaseException {
027: __collective = toJoin;
028: toJoin.__recruit(this );
029: this .myIterator = iter;
030: }
031:
032: public String query_expression() throws BaseException {
033: UserTransaction ut = null;
034: boolean e = SharkCORBAServer.doesTransactionExist();
035: try {
036: ut = SharkCORBAUtilities.beginTransaction(e);
037: String ret = myIterator.query_expression();
038: SharkCORBAUtilities.commitTransaction(ut, e);
039: return ret;
040: } catch (Exception ex) {
041: SharkCORBAUtilities.rollbackTransaction(ut, e);
042: throw new BaseException();
043: }
044: }
045:
046: public void set_query_expression(String query)
047: throws BaseException, InvalidQuery {
048: UserTransaction ut = null;
049: boolean e = SharkCORBAServer.doesTransactionExist();
050: try {
051: ut = SharkCORBAUtilities.beginTransaction(e);
052: myIterator.set_query_expression(query);
053: SharkCORBAUtilities.commitTransaction(ut, e);
054: } catch (org.enhydra.shark.api.client.wfbase.InvalidQuery iq) {
055: SharkCORBAUtilities.rollbackTransaction(ut, e);
056: throw new InvalidQuery();
057: } catch (Exception ex) {
058: SharkCORBAUtilities.rollbackTransaction(ut, e);
059: throw new BaseException();
060: }
061: }
062:
063: public NameValue[] names_in_expression() throws BaseException {
064: UserTransaction ut = null;
065: boolean e = SharkCORBAServer.doesTransactionExist();
066: try {
067: ut = SharkCORBAUtilities.beginTransaction(e);
068: NameValue[] ret = SharkCORBAUtilities
069: .makeCORBANameValueArray(this ._orb(), myIterator
070: .names_in_expression());
071: SharkCORBAUtilities.commitTransaction(ut, e);
072: return ret;
073: } catch (Exception ex) {
074: SharkCORBAUtilities.rollbackTransaction(ut, e);
075: throw new BaseException();
076: }
077: }
078:
079: public void set_names_in_expression(NameValue[] query)
080: throws BaseException, NameMismatch {
081: UserTransaction ut = null;
082: boolean e = SharkCORBAServer.doesTransactionExist();
083: try {
084: ut = SharkCORBAUtilities.beginTransaction(e);
085: myIterator.set_names_in_expression(SharkCORBAUtilities
086: .makeMap(query));
087: SharkCORBAUtilities.commitTransaction(ut, e);
088: } catch (org.enhydra.shark.api.client.wfbase.NameMismatch nm) {
089: SharkCORBAUtilities.rollbackTransaction(ut, e);
090: throw new NameMismatch();
091: } catch (Exception ex) {
092: SharkCORBAUtilities.rollbackTransaction(ut, e);
093: throw new BaseException();
094: }
095: }
096:
097: public String query_grammar() throws BaseException {
098: UserTransaction ut = null;
099: boolean e = SharkCORBAServer.doesTransactionExist();
100: try {
101: ut = SharkCORBAUtilities.beginTransaction(e);
102: String ret = myIterator.query_grammar();
103: SharkCORBAUtilities.commitTransaction(ut, e);
104: return ret;
105: } catch (Exception ex) {
106: SharkCORBAUtilities.rollbackTransaction(ut, e);
107: throw new BaseException();
108: }
109: }
110:
111: public void set_query_grammar(String query_grammmar)
112: throws BaseException, GrammarNotSupported {
113: UserTransaction ut = null;
114: boolean e = SharkCORBAServer.doesTransactionExist();
115: try {
116: ut = SharkCORBAUtilities.beginTransaction(e);
117: myIterator.set_query_grammar(query_grammmar);
118: SharkCORBAUtilities.commitTransaction(ut, e);
119: } catch (org.enhydra.shark.api.client.wfbase.GrammarNotSupported gns) {
120: SharkCORBAUtilities.rollbackTransaction(ut, e);
121: throw new GrammarNotSupported();
122: } catch (Exception ex) {
123: SharkCORBAUtilities.rollbackTransaction(ut, e);
124: throw new BaseException();
125: }
126: }
127:
128: public int how_many() throws BaseException {
129: UserTransaction ut = null;
130: boolean e = SharkCORBAServer.doesTransactionExist();
131: try {
132: ut = SharkCORBAUtilities.beginTransaction(e);
133: int ret = myIterator.how_many();
134: SharkCORBAUtilities.commitTransaction(ut, e);
135: return ret;
136: } catch (Exception ex) {
137: SharkCORBAUtilities.rollbackTransaction(ut, e);
138: throw new BaseException();
139: }
140: }
141:
142: public void goto_start() throws BaseException {
143: UserTransaction ut = null;
144: boolean e = SharkCORBAServer.doesTransactionExist();
145: try {
146: ut = SharkCORBAUtilities.beginTransaction(e);
147: myIterator.goto_start();
148: SharkCORBAUtilities.commitTransaction(ut, e);
149: } catch (Exception ex) {
150: SharkCORBAUtilities.rollbackTransaction(ut, e);
151: throw new BaseException();
152: }
153: }
154:
155: public void goto_end() throws BaseException {
156: UserTransaction ut = null;
157: boolean e = SharkCORBAServer.doesTransactionExist();
158: try {
159: ut = SharkCORBAUtilities.beginTransaction(e);
160: myIterator.goto_end();
161: SharkCORBAUtilities.commitTransaction(ut, e);
162: } catch (Exception ex) {
163: SharkCORBAUtilities.rollbackTransaction(ut, e);
164: throw new BaseException();
165: }
166: }
167:
168: public WfAssignment get_next_object() throws BaseException {
169: UserTransaction ut = null;
170: boolean e = SharkCORBAServer.doesTransactionExist();
171: try {
172: ut = SharkCORBAUtilities.beginTransaction(e);
173: WfAssignment ret = new WfAssignmentCORBA(__collective,
174: myIterator.get_next_object());
175: SharkCORBAUtilities.commitTransaction(ut, e);
176: return ret;
177: } catch (Exception ex) {
178: SharkCORBAUtilities.rollbackTransaction(ut, e);
179: throw new BaseException();
180: }
181: }
182:
183: public WfAssignment get_previous_object() throws BaseException {
184: UserTransaction ut = null;
185: boolean e = SharkCORBAServer.doesTransactionExist();
186: try {
187: ut = SharkCORBAUtilities.beginTransaction(e);
188: WfAssignment ret = new WfAssignmentCORBA(__collective,
189: myIterator.get_previous_object());
190: SharkCORBAUtilities.commitTransaction(ut, e);
191: return ret;
192: } catch (Exception ex) {
193: SharkCORBAUtilities.rollbackTransaction(ut, e);
194: throw new BaseException();
195: }
196: }
197:
198: public WfAssignment[] get_next_n_sequence(int max_number)
199: throws BaseException {
200: UserTransaction ut = null;
201: boolean e = SharkCORBAServer.doesTransactionExist();
202: try {
203: ut = SharkCORBAUtilities.beginTransaction(e);
204: WfAssignment[] ret = SharkCORBAUtilities
205: .makeCORBAAssignments(__collective, myIterator
206: .get_next_n_sequence(max_number));
207: SharkCORBAUtilities.commitTransaction(ut, e);
208: return ret;
209: } catch (Exception ex) {
210: SharkCORBAUtilities.rollbackTransaction(ut, e);
211: throw new BaseException();
212: }
213: }
214:
215: public WfAssignment[] get_previous_n_sequence(int max_number)
216: throws BaseException {
217: UserTransaction ut = null;
218: boolean e = SharkCORBAServer.doesTransactionExist();
219: try {
220: ut = SharkCORBAUtilities.beginTransaction(e);
221: WfAssignment[] ret = SharkCORBAUtilities
222: .makeCORBAAssignments(__collective, myIterator
223: .get_previous_n_sequence(max_number));
224: SharkCORBAUtilities.commitTransaction(ut, e);
225: return ret;
226: } catch (Exception ex) {
227: SharkCORBAUtilities.rollbackTransaction(ut, e);
228: throw new BaseException();
229: }
230: }
231:
232: }
|