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