001: package org.enhydra.shark.corba;
002:
003: import javax.transaction.UserTransaction;
004:
005: import org.omg.TimeBase.UtcT;
006: import org.omg.WfBase.BaseException;
007: import org.omg.WfBase.NameValue;
008: import org.omg.WorkflowModel.*;
009:
010: /**
011: * WfActivityImpl - Workflow Activity Object implementation
012: *
013: * @author Sasa Bojanic
014: * @version 1.0
015: */
016: public class WfActivityCORBA extends _WfActivityImplBase {
017:
018: org.enhydra.shark.api.client.wfmodel.WfActivity sharkAct;
019:
020: private Collective __collective;
021:
022: /**
023: * Create a new WfActivityImpl
024: */
025: protected WfActivityCORBA(Collective toJoin,
026: org.enhydra.shark.api.client.wfmodel.WfActivity sharkAct) {
027: __collective = toJoin;
028: toJoin.__recruit(this );
029: this .sharkAct = sharkAct;
030: }
031:
032: /**
033: * Retrieve the no. of Assignment objects.
034: *
035: * @throws org.omg.WfBase.BaseException General workflow exception.
036: * @return No. of current assignments.
037: */
038: public int how_many_assignment() throws BaseException {
039: UserTransaction ut = null;
040: boolean e = SharkCORBAServer.doesTransactionExist();
041: try {
042: ut = SharkCORBAUtilities.beginTransaction(e);
043: int ret = sharkAct.how_many_assignment();
044: SharkCORBAUtilities.commitTransaction(ut, e);
045: return ret;
046: } catch (Exception ex) {
047: SharkCORBAUtilities.rollbackTransaction(ut, e);
048: throw new BaseException();
049: }
050: }
051:
052: /**
053: * Retrieve the Iterator of Assignments objects.
054: */
055: public WfAssignmentIterator get_iterator_assignment()
056: throws BaseException {
057: UserTransaction ut = null;
058: boolean e = SharkCORBAServer.doesTransactionExist();
059: try {
060: ut = SharkCORBAUtilities.beginTransaction(e);
061: WfAssignmentIterator ret = new WfAssignmentIteratorCORBA(
062: __collective, sharkAct.get_iterator_assignment());
063: SharkCORBAUtilities.commitTransaction(ut, e);
064: return ret;
065: } catch (Exception ex) {
066: SharkCORBAUtilities.rollbackTransaction(ut, e);
067: throw new BaseException();
068: }
069: }
070:
071: /**
072: * Retrieve all assignments of this activity.
073: *
074: * @return array of WfAssignment objects.
075: */
076: public WfAssignment[] get_sequence_assignment(int max_number)
077: throws BaseException {
078: UserTransaction ut = null;
079: boolean e = SharkCORBAServer.doesTransactionExist();
080: try {
081: ut = SharkCORBAUtilities.beginTransaction(e);
082: WfAssignment[] ret = SharkCORBAUtilities
083: .makeCORBAAssignments(__collective, sharkAct
084: .get_sequence_assignment(max_number));
085: SharkCORBAUtilities.commitTransaction(ut, e);
086: return ret;
087: } catch (Exception ex) {
088: SharkCORBAUtilities.rollbackTransaction(ut, e);
089: throw new BaseException();
090: }
091: }
092:
093: /**
094: * Check if a specific assignment is a member of this activity.
095: *
096: * @return true if the assignment is a member of this activity.
097: */
098: public boolean is_member_of_assignment(WfAssignment member)
099: throws BaseException {
100: UserTransaction ut = null;
101: boolean e = SharkCORBAServer.doesTransactionExist();
102: try {
103: ut = SharkCORBAUtilities.beginTransaction(e);
104: String actId = member.activity().key();
105: boolean ret = actId.equals(sharkAct.key());
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: /**
115: * Getter for the process of this activity.
116: */
117: public WfProcess container() throws BaseException {
118: UserTransaction ut = null;
119: boolean e = SharkCORBAServer.doesTransactionExist();
120: try {
121: ut = SharkCORBAUtilities.beginTransaction(e);
122: WfProcess ret = new WfProcessCORBA(__collective, sharkAct
123: .container());
124: SharkCORBAUtilities.commitTransaction(ut, e);
125: return ret;
126: } catch (Exception ex) {
127: SharkCORBAUtilities.rollbackTransaction(ut, e);
128: throw new BaseException();
129: }
130: }
131:
132: /**
133: * Retrieve the Result map of this activity.
134: *
135: * @return Map of results from this activity
136: */
137: public NameValue[] result() throws BaseException,
138: ResultNotAvailable {
139: UserTransaction ut = null;
140: boolean e = SharkCORBAServer.doesTransactionExist();
141: try {
142: ut = SharkCORBAUtilities.beginTransaction(e);
143: NameValue[] ret = SharkCORBAUtilities
144: .makeCORBANameValueArray(this ._orb(), sharkAct
145: .result());
146: SharkCORBAUtilities.commitTransaction(ut, e);
147: return ret;
148: } catch (org.enhydra.shark.api.client.wfmodel.ResultNotAvailable rna) {
149: SharkCORBAUtilities.rollbackTransaction(ut, e);
150: throw new ResultNotAvailable();
151: } catch (Exception ex) {
152: SharkCORBAUtilities.rollbackTransaction(ut, e);
153: throw new BaseException();
154: }
155: }
156:
157: /**
158: * Assign Result for this activity.
159: */
160: public void set_result(NameValue[] results) throws BaseException,
161: InvalidData {
162: UserTransaction ut = null;
163: boolean e = SharkCORBAServer.doesTransactionExist();
164: try {
165: ut = SharkCORBAUtilities.beginTransaction(e);
166: sharkAct.set_result(SharkCORBAUtilities.makeMap(results));
167: SharkCORBAUtilities.commitTransaction(ut, e);
168: } catch (org.enhydra.shark.api.client.wfmodel.InvalidData id) {
169: SharkCORBAUtilities.rollbackTransaction(ut, e);
170: throw new InvalidData();
171: } catch (Exception ex) {
172: SharkCORBAUtilities.rollbackTransaction(ut, e);
173: throw new BaseException();
174: }
175: }
176:
177: /**
178: * Complete this activity.
179: */
180: public void complete() throws BaseException, CannotComplete {
181: UserTransaction ut = null;
182: boolean e = SharkCORBAServer.doesTransactionExist();
183: try {
184: ut = SharkCORBAUtilities.beginTransaction(e);
185: sharkAct.complete();
186: SharkCORBAUtilities.commitTransaction(ut, e);
187: } catch (org.enhydra.shark.api.client.wfmodel.CannotComplete cnc) {
188: SharkCORBAUtilities.rollbackTransaction(ut, e);
189: throw new CannotComplete();
190: } catch (Exception ex) {
191: SharkCORBAUtilities.rollbackTransaction(ut, e);
192: throw new BaseException();
193: }
194: }
195:
196: public workflow_stateType workflow_state() throws BaseException {
197: UserTransaction ut = null;
198: boolean e = SharkCORBAServer.doesTransactionExist();
199: try {
200: ut = SharkCORBAUtilities.beginTransaction(e);
201: workflow_stateType ret = workflow_stateType
202: .from_int(sharkAct.workflow_state().value());
203: SharkCORBAUtilities.commitTransaction(ut, e);
204: return ret;
205: } catch (Exception ex) {
206: SharkCORBAUtilities.rollbackTransaction(ut, e);
207: throw new BaseException();
208: }
209: }
210:
211: public while_openType while_open() throws BaseException {
212: UserTransaction ut = null;
213: boolean e = SharkCORBAServer.doesTransactionExist();
214: try {
215: ut = SharkCORBAUtilities.beginTransaction(e);
216: while_openType ret = while_openType.from_int(sharkAct
217: .while_open().value());
218: SharkCORBAUtilities.commitTransaction(ut, e);
219: return ret;
220: } catch (Exception ex) {
221: SharkCORBAUtilities.rollbackTransaction(ut, e);
222: throw new BaseException();
223: }
224: }
225:
226: public why_not_runningType why_not_running() throws BaseException {
227: UserTransaction ut = null;
228: boolean e = SharkCORBAServer.doesTransactionExist();
229: try {
230: ut = SharkCORBAUtilities.beginTransaction(e);
231: why_not_runningType ret = why_not_runningType
232: .from_int(sharkAct.why_not_running().value());
233: SharkCORBAUtilities.commitTransaction(ut, e);
234: return ret;
235: } catch (Exception ex) {
236: SharkCORBAUtilities.rollbackTransaction(ut, e);
237: throw new BaseException();
238: }
239: }
240:
241: public how_closedType how_closed() throws BaseException {
242: UserTransaction ut = null;
243: boolean e = SharkCORBAServer.doesTransactionExist();
244: try {
245: ut = SharkCORBAUtilities.beginTransaction(e);
246: how_closedType ret = how_closedType.from_int(sharkAct
247: .how_closed().value());
248: SharkCORBAUtilities.commitTransaction(ut, e);
249: return ret;
250: } catch (Exception ex) {
251: SharkCORBAUtilities.rollbackTransaction(ut, e);
252: throw new BaseException();
253: }
254: }
255:
256: public String[] valid_states() throws BaseException {
257: UserTransaction ut = null;
258: boolean e = SharkCORBAServer.doesTransactionExist();
259: try {
260: ut = SharkCORBAUtilities.beginTransaction(e);
261: String[] ret = sharkAct.valid_states();
262: SharkCORBAUtilities.commitTransaction(ut, e);
263: return ret;
264: } catch (Exception ex) {
265: SharkCORBAUtilities.rollbackTransaction(ut, e);
266: throw new BaseException();
267: }
268: }
269:
270: public String state() throws BaseException {
271: UserTransaction ut = null;
272: boolean e = SharkCORBAServer.doesTransactionExist();
273: try {
274: ut = SharkCORBAUtilities.beginTransaction(e);
275: String ret = sharkAct.state();
276: SharkCORBAUtilities.commitTransaction(ut, e);
277: return ret;
278: } catch (Exception ex) {
279: SharkCORBAUtilities.rollbackTransaction(ut, e);
280: throw new BaseException();
281: }
282: }
283:
284: public void change_state(String new_state) throws BaseException,
285: InvalidState, TransitionNotAllowed {
286: UserTransaction ut = null;
287: boolean e = SharkCORBAServer.doesTransactionExist();
288: try {
289: ut = SharkCORBAUtilities.beginTransaction(e);
290: sharkAct.change_state(new_state);
291: SharkCORBAUtilities.commitTransaction(ut, e);
292: } catch (org.enhydra.shark.api.client.wfmodel.InvalidState is) {
293: SharkCORBAUtilities.rollbackTransaction(ut, e);
294: throw new InvalidState();
295: } catch (org.enhydra.shark.api.client.wfmodel.TransitionNotAllowed tna) {
296: SharkCORBAUtilities.rollbackTransaction(ut, e);
297: throw new TransitionNotAllowed();
298: } catch (Exception ex) {
299: SharkCORBAUtilities.rollbackTransaction(ut, e);
300: throw new BaseException();
301: }
302: }
303:
304: public String name() throws BaseException {
305: UserTransaction ut = null;
306: boolean e = SharkCORBAServer.doesTransactionExist();
307: try {
308: ut = SharkCORBAUtilities.beginTransaction(e);
309: String ret = sharkAct.name();
310: SharkCORBAUtilities.commitTransaction(ut, e);
311: return ret;
312: } catch (Exception ex) {
313: SharkCORBAUtilities.rollbackTransaction(ut, e);
314: throw new BaseException();
315: }
316: }
317:
318: public void set_name(String new_value) throws BaseException {
319: UserTransaction ut = null;
320: boolean e = SharkCORBAServer.doesTransactionExist();
321: try {
322: ut = SharkCORBAUtilities.beginTransaction(e);
323: sharkAct.set_name(new_value);
324: SharkCORBAUtilities.commitTransaction(ut, e);
325: } catch (Exception ex) {
326: SharkCORBAUtilities.rollbackTransaction(ut, e);
327: throw new BaseException();
328: }
329: }
330:
331: public String key() throws BaseException {
332: UserTransaction ut = null;
333: boolean e = SharkCORBAServer.doesTransactionExist();
334: try {
335: ut = SharkCORBAUtilities.beginTransaction(e);
336: String ret = sharkAct.key();
337: SharkCORBAUtilities.commitTransaction(ut, e);
338: return ret;
339: } catch (Exception ex) {
340: SharkCORBAUtilities.rollbackTransaction(ut, e);
341: throw new BaseException();
342: }
343: }
344:
345: public String description() throws BaseException {
346: UserTransaction ut = null;
347: boolean e = SharkCORBAServer.doesTransactionExist();
348: try {
349: ut = SharkCORBAUtilities.beginTransaction(e);
350: String ret = sharkAct.description();
351: SharkCORBAUtilities.commitTransaction(ut, e);
352: return ret;
353: } catch (Exception ex) {
354: SharkCORBAUtilities.rollbackTransaction(ut, e);
355: throw new BaseException();
356: }
357: }
358:
359: public void set_description(String new_value) throws BaseException {
360: UserTransaction ut = null;
361: boolean e = SharkCORBAServer.doesTransactionExist();
362: try {
363: ut = SharkCORBAUtilities.beginTransaction(e);
364: sharkAct.set_description(new_value);
365: SharkCORBAUtilities.commitTransaction(ut, e);
366: } catch (Exception ex) {
367: SharkCORBAUtilities.rollbackTransaction(ut, e);
368: throw new BaseException();
369: }
370: }
371:
372: public NameValue[] process_context() throws BaseException {
373: UserTransaction ut = null;
374: boolean e = SharkCORBAServer.doesTransactionExist();
375: try {
376: ut = SharkCORBAUtilities.beginTransaction(e);
377: NameValue[] ret = SharkCORBAUtilities
378: .makeCORBANameValueArray(this ._orb(), sharkAct
379: .process_context());
380: SharkCORBAUtilities.commitTransaction(ut, e);
381: return ret;
382: } catch (Exception ex) {
383: SharkCORBAUtilities.rollbackTransaction(ut, e);
384: throw new BaseException();
385: }
386: }
387:
388: public void set_process_context(NameValue[] new_value)
389: throws BaseException, InvalidData, UpdateNotAllowed {
390: UserTransaction ut = null;
391: boolean e = SharkCORBAServer.doesTransactionExist();
392: try {
393: ut = SharkCORBAUtilities.beginTransaction(e);
394: sharkAct.set_process_context(SharkCORBAUtilities
395: .makeMap(new_value));
396: SharkCORBAUtilities.commitTransaction(ut, e);
397: } catch (org.enhydra.shark.api.client.wfmodel.InvalidData id) {
398: SharkCORBAUtilities.rollbackTransaction(ut, e);
399: throw new InvalidData();
400: } catch (org.enhydra.shark.api.client.wfmodel.UpdateNotAllowed una) {
401: SharkCORBAUtilities.rollbackTransaction(ut, e);
402: throw new UpdateNotAllowed();
403: } catch (Exception ex) {
404: SharkCORBAUtilities.rollbackTransaction(ut, e);
405: throw new BaseException();
406: }
407: }
408:
409: public short priority() throws BaseException {
410: UserTransaction ut = null;
411: boolean e = SharkCORBAServer.doesTransactionExist();
412: try {
413: ut = SharkCORBAUtilities.beginTransaction(e);
414: short ret = sharkAct.priority();
415: SharkCORBAUtilities.commitTransaction(ut, e);
416: return ret;
417: } catch (Exception ex) {
418: SharkCORBAUtilities.rollbackTransaction(ut, e);
419: throw new BaseException();
420: }
421: }
422:
423: public void set_priority(short new_value) throws BaseException {
424: UserTransaction ut = null;
425: boolean e = SharkCORBAServer.doesTransactionExist();
426: try {
427: ut = SharkCORBAUtilities.beginTransaction(e);
428: sharkAct.set_priority(new_value);
429: SharkCORBAUtilities.commitTransaction(ut, e);
430: } catch (Exception ex) {
431: SharkCORBAUtilities.rollbackTransaction(ut, e);
432: throw new BaseException();
433: }
434: }
435:
436: /**
437: * Resume this process or activity.
438: */
439: public void resume() throws BaseException, CannotResume,
440: NotSuspended {
441: UserTransaction ut = null;
442: boolean e = SharkCORBAServer.doesTransactionExist();
443: try {
444: ut = SharkCORBAUtilities.beginTransaction(e);
445: sharkAct.resume();
446: SharkCORBAUtilities.commitTransaction(ut, e);
447: } catch (org.enhydra.shark.api.client.wfmodel.CannotResume cnr) {
448: SharkCORBAUtilities.rollbackTransaction(ut, e);
449: throw new CannotResume();
450: } catch (org.enhydra.shark.api.client.wfmodel.NotSuspended ns) {
451: SharkCORBAUtilities.rollbackTransaction(ut, e);
452: throw new NotSuspended();
453: } catch (Exception ex) {
454: SharkCORBAUtilities.rollbackTransaction(ut, e);
455: throw new BaseException();
456: }
457: }
458:
459: /**
460: * Suspend this process or activity.
461: */
462: public void suspend() throws BaseException, CannotSuspend,
463: NotRunning, AlreadySuspended {
464: UserTransaction ut = null;
465: boolean e = SharkCORBAServer.doesTransactionExist();
466: try {
467: ut = SharkCORBAUtilities.beginTransaction(e);
468: sharkAct.suspend();
469: SharkCORBAUtilities.commitTransaction(ut, e);
470: } catch (org.enhydra.shark.api.client.wfmodel.CannotSuspend cns) {
471: SharkCORBAUtilities.rollbackTransaction(ut, e);
472: throw new CannotSuspend();
473: } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) {
474: SharkCORBAUtilities.rollbackTransaction(ut, e);
475: throw new NotRunning();
476: } catch (org.enhydra.shark.api.client.wfmodel.AlreadySuspended as) {
477: SharkCORBAUtilities.rollbackTransaction(ut, e);
478: throw new AlreadySuspended();
479: } catch (Exception ex) {
480: SharkCORBAUtilities.rollbackTransaction(ut, e);
481: throw new BaseException();
482: }
483: }
484:
485: /**
486: * Terminate this process or activity.
487: */
488: public void terminate() throws BaseException, CannotStop,
489: NotRunning {
490: UserTransaction ut = null;
491: boolean e = SharkCORBAServer.doesTransactionExist();
492: try {
493: ut = SharkCORBAUtilities.beginTransaction(e);
494: sharkAct.terminate();
495: SharkCORBAUtilities.commitTransaction(ut, e);
496: } catch (org.enhydra.shark.api.client.wfmodel.CannotStop cns) {
497: SharkCORBAUtilities.rollbackTransaction(ut, e);
498: throw new CannotStop();
499: } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) {
500: SharkCORBAUtilities.rollbackTransaction(ut, e);
501: throw new NotRunning();
502: } catch (Exception ex) {
503: SharkCORBAUtilities.rollbackTransaction(ut, e);
504: throw new BaseException();
505: }
506: }
507:
508: /**
509: * Abort the execution of this process or activity.
510: */
511: public void abort() throws BaseException, CannotStop, NotRunning {
512: UserTransaction ut = null;
513: boolean e = SharkCORBAServer.doesTransactionExist();
514: try {
515: ut = SharkCORBAUtilities.beginTransaction(e);
516: sharkAct.abort();
517: SharkCORBAUtilities.commitTransaction(ut, e);
518: } catch (org.enhydra.shark.api.client.wfmodel.CannotStop cns) {
519: SharkCORBAUtilities.rollbackTransaction(ut, e);
520: throw new CannotStop();
521: } catch (org.enhydra.shark.api.client.wfmodel.NotRunning nr) {
522: SharkCORBAUtilities.rollbackTransaction(ut, e);
523: throw new NotRunning();
524: } catch (Exception ex) {
525: SharkCORBAUtilities.rollbackTransaction(ut, e);
526: throw new BaseException();
527: }
528: }
529:
530: public int how_many_history() throws BaseException,
531: HistoryNotAvailable {
532: UserTransaction ut = null;
533: boolean e = SharkCORBAServer.doesTransactionExist();
534: try {
535: ut = SharkCORBAUtilities.beginTransaction(e);
536: int ret = sharkAct.how_many_history();
537: SharkCORBAUtilities.commitTransaction(ut, e);
538: return ret;
539: } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) {
540: SharkCORBAUtilities.rollbackTransaction(ut, e);
541: throw new HistoryNotAvailable();
542: } catch (Exception ex) {
543: SharkCORBAUtilities.rollbackTransaction(ut, e);
544: throw new BaseException();
545: }
546: }
547:
548: /**
549: * Search in the history for specific elements.
550: *
551: * @param query Search criteria.
552: * @param names_in_query elements to search.
553: * @return Found history elements that meet the search criteria.
554: */
555: public WfEventAuditIterator get_iterator_history(String query,
556: NameValue[] names_in_query) throws BaseException,
557: HistoryNotAvailable {
558: UserTransaction ut = null;
559: boolean e = SharkCORBAServer.doesTransactionExist();
560: try {
561: ut = SharkCORBAUtilities.beginTransaction(e);
562: WfEventAuditIterator ret = new WfEventAuditIteratorCORBA(
563: __collective, sharkAct
564: .get_iterator_history(query,
565: SharkCORBAUtilities
566: .makeMap(names_in_query)));
567: SharkCORBAUtilities.commitTransaction(ut, e);
568: return ret;
569: } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) {
570: SharkCORBAUtilities.rollbackTransaction(ut, e);
571: throw new HistoryNotAvailable();
572: } catch (Exception ex) {
573: SharkCORBAUtilities.rollbackTransaction(ut, e);
574: throw new BaseException();
575: }
576: }
577:
578: /**
579: * Getter for history sequence.
580: *
581: * @param max_number Maximum number of element in result list.
582: * @return List of History objects.
583: */
584: public WfEventAudit[] get_sequence_history(int max_number)
585: throws BaseException, HistoryNotAvailable {
586: UserTransaction ut = null;
587: boolean e = SharkCORBAServer.doesTransactionExist();
588: try {
589: ut = SharkCORBAUtilities.beginTransaction(e);
590: WfEventAudit[] ret = SharkCORBAUtilities
591: .makeCORBAEventAudits(__collective, sharkAct
592: .get_sequence_history(max_number));
593: SharkCORBAUtilities.commitTransaction(ut, e);
594: return ret;
595: } catch (org.enhydra.shark.api.client.wfmodel.HistoryNotAvailable hna) {
596: SharkCORBAUtilities.rollbackTransaction(ut, e);
597: throw new HistoryNotAvailable();
598: } catch (Exception ex) {
599: SharkCORBAUtilities.rollbackTransaction(ut, e);
600: throw new BaseException();
601: }
602: }
603:
604: /**
605: * Predicate to check if a 'member' is an element of the history.
606: *
607: * @return true if the element of the history, false otherwise.
608: */
609: public boolean is_member_of_history(WfExecutionObject member)
610: throws BaseException {
611: UserTransaction ut = null;
612: boolean e = SharkCORBAServer.doesTransactionExist();
613: try {
614: ut = SharkCORBAUtilities.beginTransaction(e);
615: boolean ret = false;
616: WfEventAudit[] evs = SharkCORBAUtilities
617: .makeCORBAEventAudits(__collective, sharkAct
618: .get_sequence_history(0));
619: if (evs != null) {
620: for (int i = 0; i < evs.length; i++) {
621: WfEventAudit ea = evs[i];
622: if (member instanceof WfActivity) {
623: WfActivity act = (WfActivity) member;
624: if (act.container().key().equals(
625: ea.process_key())
626: && act.key().equals(ea.activity_key())) {
627: ret = true;
628: break;
629: }
630: } else {
631: if (member.key().equals(ea.process_key())) {
632: ret = true;
633: break;
634: }
635: }
636: }
637: }
638: return ret;
639: } catch (Exception ex) {
640: SharkCORBAUtilities.rollbackTransaction(ut, e);
641: throw new BaseException();
642: }
643: }
644:
645: public UtcT last_state_time() throws BaseException {
646: UserTransaction ut = null;
647: boolean e = SharkCORBAServer.doesTransactionExist();
648: try {
649: ut = SharkCORBAUtilities.beginTransaction(e);
650: org.enhydra.shark.api.client.timebase.UtcT t = sharkAct
651: .last_state_time();
652: UtcT ret = new UtcT(t.time, t.inacclo, t.inacchi, t.tdf);
653: SharkCORBAUtilities.commitTransaction(ut, e);
654: return ret;
655: } catch (Exception ex) {
656: SharkCORBAUtilities.rollbackTransaction(ut, e);
657: throw new BaseException();
658: }
659: }
660:
661: /**
662: * Gets the number of processes.
663: */
664: public int how_many_performer() throws BaseException {
665: UserTransaction ut = null;
666: boolean e = SharkCORBAServer.doesTransactionExist();
667: try {
668: ut = SharkCORBAUtilities.beginTransaction(e);
669: int ret = sharkAct.how_many_performer();
670: SharkCORBAUtilities.commitTransaction(ut, e);
671: return ret;
672: } catch (Exception ex) {
673: SharkCORBAUtilities.rollbackTransaction(ut, e);
674: throw new BaseException();
675: }
676: }
677:
678: /**
679: * Gets an iterator of processes.
680: */
681: public WfProcessIterator get_iterator_performer()
682: throws BaseException {
683: UserTransaction ut = null;
684: boolean e = SharkCORBAServer.doesTransactionExist();
685: try {
686: ut = SharkCORBAUtilities.beginTransaction(e);
687: WfProcessIterator ret = new WfProcessIteratorCORBA(
688: __collective, sharkAct.get_iterator_performer());
689: SharkCORBAUtilities.commitTransaction(ut, e);
690: return ret;
691: } catch (Exception ex) {
692: SharkCORBAUtilities.rollbackTransaction(ut, e);
693: throw new BaseException();
694: }
695: }
696:
697: /**
698: * A list of processes
699: *
700: * @return List of WfProcess objects.
701: */
702: public WfProcess[] get_sequence_performer(int max_number)
703: throws BaseException {
704: UserTransaction ut = null;
705: boolean e = SharkCORBAServer.doesTransactionExist();
706: try {
707: ut = SharkCORBAUtilities.beginTransaction(e);
708: WfProcess[] ret = SharkCORBAUtilities.makeCORBAProcesses(
709: __collective, sharkAct
710: .get_sequence_performer(max_number));
711: SharkCORBAUtilities.commitTransaction(ut, e);
712: return ret;
713: } catch (Exception ex) {
714: SharkCORBAUtilities.rollbackTransaction(ut, e);
715: throw new BaseException();
716: }
717: }
718:
719: /**
720: * Checks if a WfProcess is associated with this requester object
721: *
722: * @return true if the process is found.
723: */
724: public boolean is_member_of_performer(WfProcess member)
725: throws BaseException {
726: UserTransaction ut = null;
727: boolean e = SharkCORBAServer.doesTransactionExist();
728: try {
729: ut = SharkCORBAUtilities.beginTransaction(e);
730: boolean ret = false;
731: WfProcess[] perfs = SharkCORBAUtilities.makeCORBAProcesses(
732: __collective, sharkAct.get_sequence_performer(0));
733: if (perfs != null) {
734: for (int i = 0; i < perfs.length; i++) {
735: WfProcess perf = perfs[i];
736: if (perf.key().equals(member.key())) {
737: ret = true;
738: break;
739: }
740: }
741: }
742: SharkCORBAUtilities.commitTransaction(ut, e);
743: return ret;
744: } catch (Exception ex) {
745: SharkCORBAUtilities.rollbackTransaction(ut, e);
746: throw new BaseException();
747: }
748: }
749:
750: public void receive_event(WfEventAudit event) throws BaseException,
751: InvalidPerformer {
752: }
753:
754: /**
755: * It is assumed that there can't be two or more activities having the same key.
756: */
757: public boolean equals(java.lang.Object obj) {
758: if (!(obj instanceof WfActivity))
759: return false;
760: WfActivity act = (WfActivity) obj;
761: UserTransaction ut = null;
762: boolean e = SharkCORBAServer.doesTransactionExist();
763: try {
764: ut = SharkCORBAUtilities.beginTransaction(e);
765: boolean ret = act.key().equals(key());
766: SharkCORBAUtilities.commitTransaction(ut, ret);
767: return ret;
768: } catch (Exception ex) {
769: SharkCORBAUtilities.rollbackTransaction(ut, e);
770: return false;
771: }
772: }
773:
774: public String toString() {
775: return sharkAct.toString();
776: }
777:
778: }
|