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