KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > corba > poa > WfActivityIteratorCORBA


1 package org.enhydra.shark.corba.poa;
2
3 import org.omg.WfBase.*;
4 import org.omg.WorkflowModel.WfActivity;
5 import org.omg.WorkflowModel.WfActivityIteratorPOA;
6 import org.omg.WorkflowModel.WfAssignmentHelper;
7 import org.omg.WorkflowModel.WfActivityHelper;
8 import org.omg.CORBA.ORB JavaDoc;
9 import org.omg.PortableServer.POA JavaDoc;
10 import org.omg.PortableServer.POAHelper JavaDoc;
11 import org.enhydra.shark.corba.poa.Collective;
12 import org.enhydra.shark.corba.poa.SharkCORBAUtilities;
13 import org.enhydra.shark.corba.poa.WfActivityCORBA;
14
15 /**
16  * Iterator for activities in the process.
17  *
18  * @author David Forslund
19  * @version 1.0
20  */

21 public class WfActivityIteratorCORBA extends WfActivityIteratorPOA {
22
23    org.enhydra.shark.api.client.wfmodel.WfActivityIterator myIterator;
24
25    private Collective __collective;
26     private ORB JavaDoc orb;
27
28    protected WfActivityIteratorCORBA(ORB JavaDoc orb, Collective toJoin,
29                                      org.enhydra.shark.api.client.wfmodel.WfActivityIterator iter) throws BaseException {
30
31        __collective = toJoin;
32        this.orb = orb;
33
34    // toJoin.__recruit(this);
35
this.myIterator = iter;
36    }
37
38    public String JavaDoc query_expression() throws BaseException {
39       try {
40          return myIterator.query_expression();
41       } catch (Exception JavaDoc ex) {
42          throw new BaseException();
43       }
44    }
45
46    /*
47     * The following names may be used: key, name, priority, description,
48     * state, definitionId
49     */

50    public void set_query_expression(String JavaDoc query) throws BaseException,
51                                                  InvalidQuery {
52       try {
53          myIterator.set_query_expression(query);
54       } catch (org.enhydra.shark.api.client.wfbase.InvalidQuery iq) {
55          throw new InvalidQuery();
56       } catch (Exception JavaDoc ex) {
57          throw new BaseException();
58       }
59    }
60
61    public NameValue[] names_in_expression() throws BaseException {
62       try {
63          return SharkCORBAUtilities.makeCORBANameValueArray(orb,
64                                                             myIterator.names_in_expression());
65       } catch (Exception JavaDoc ex) {
66          throw new BaseException();
67       }
68    }
69
70    public void set_names_in_expression(NameValue[] query) throws BaseException,
71                                                          NameMismatch {
72       try {
73          myIterator.set_names_in_expression(SharkCORBAUtilities.makeMap(query));
74       } catch (org.enhydra.shark.api.client.wfbase.NameMismatch nm) {
75          throw new NameMismatch();
76       } catch (Exception JavaDoc ex) {
77          throw new BaseException();
78       }
79    }
80
81    public String JavaDoc query_grammar() throws BaseException {
82       try {
83          return myIterator.query_grammar();
84       } catch (Exception JavaDoc ex) {
85          throw new BaseException();
86       }
87    }
88
89    public void set_query_grammar(String JavaDoc query_grammmar) throws BaseException,
90                                                        GrammarNotSupported {
91       try {
92          myIterator.set_query_grammar(query_grammmar);
93       } catch (org.enhydra.shark.api.client.wfbase.GrammarNotSupported gns) {
94          throw new GrammarNotSupported();
95       } catch (Exception JavaDoc ex) {
96          throw new BaseException();
97       }
98    }
99
100    public int how_many() throws BaseException {
101       try {
102          return myIterator.how_many();
103       } catch (Exception JavaDoc ex) {
104          throw new BaseException();
105       }
106    }
107
108    public void goto_start() throws BaseException {
109       try {
110          myIterator.goto_start();
111       } catch (Exception JavaDoc ex) {
112          throw new BaseException();
113       }
114    }
115
116    public void goto_end() throws BaseException {
117       try {
118          myIterator.goto_end();
119       } catch (Exception JavaDoc ex) {
120          throw new BaseException();
121       }
122    }
123
124    public WfActivity get_next_object() throws BaseException {
125
126       try {
127          WfActivity activity = SharkCORBAUtilities.makeWfActivity(new WfActivityCORBA(orb, __collective,
128                                     myIterator.get_next_object()));
129           __collective.__recruit(activity);
130           return activity;
131
132
133       } catch (Exception JavaDoc ex) {
134          throw new BaseException();
135       }
136
137    }
138
139    public WfActivity get_previous_object() throws BaseException {
140       try {
141          WfActivity activity = SharkCORBAUtilities.makeWfActivity(new WfActivityCORBA(orb,__collective,
142                                     myIterator.get_previous_object()));
143           __collective.__recruit(activity);
144           return activity;
145       } catch (Exception JavaDoc ex) {
146          throw new BaseException();
147       }
148    }
149
150    public WfActivity[] get_next_n_sequence(int max_number) throws BaseException {
151       try {
152          return SharkCORBAUtilities.makeCORBAActivities(__collective,
153                                                         myIterator.get_next_n_sequence(max_number));
154       } catch (Exception JavaDoc ex) {
155          throw new BaseException();
156       }
157    }
158
159    public WfActivity[] get_previous_n_sequence(int max_number) throws BaseException {
160       try {
161          return SharkCORBAUtilities.makeCORBAActivities(__collective,
162                                                         myIterator.get_previous_n_sequence(max_number));
163       } catch (Exception JavaDoc ex) {
164          throw new BaseException();
165       }
166    }
167
168
169 }
Popular Tags