KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba.poa;
2
3 import org.omg.WfBase.*;
4 import org.omg.WorkflowModel.*;
5 import org.omg.CORBA.ORB JavaDoc;
6 import org.omg.PortableServer.POA JavaDoc;
7 import org.omg.PortableServer.POAHelper JavaDoc;
8 import org.omg.PortableServer.POAPackage.ServantAlreadyActive JavaDoc;
9 import org.omg.PortableServer.POAPackage.WrongPolicy JavaDoc;
10 import org.omg.PortableServer.POAPackage.ServantNotActive JavaDoc;
11 import org.enhydra.shark.corba.poa.Collective;
12 import org.enhydra.shark.corba.poa.SharkCORBAUtilities;
13 import org.enhydra.shark.corba.poa.WfProcessCORBA;
14
15 /**
16  * Iterator for process managers processes.
17  *
18  * @author David Forslund
19  * @version 1.0
20  */

21 public class WfProcessIteratorCORBA extends WfProcessIteratorPOA {
22
23    org.enhydra.shark.api.client.wfmodel.WfProcessIterator myIterator;
24
25    private Collective __collective;
26    private ORB JavaDoc orb;
27
28    protected WfProcessIteratorCORBA(ORB JavaDoc orb, Collective toJoin,
29                                     org.enhydra.shark.api.client.wfmodel.WfProcessIterator iter) throws BaseException {
30       __collective = toJoin;
31        this.orb = orb;
32
33      // toJoin.__recruit(this);
34
this.myIterator = iter;
35    }
36
37    public String JavaDoc query_expression() throws BaseException {
38       try {
39          return myIterator.query_expression();
40       } catch (Exception JavaDoc ex) {
41          throw new BaseException();
42       }
43    }
44
45    /**
46     * The following names may be used in queries: processDefinitionId,
47     * key, name, priority, description, state. Also the names of process
48     * context variables can be used, but the "context_" prefix should be
49     * placed before variable Id, i.e. "context_myvariable".
50     */

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