KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba.poa;
2
3 import org.enhydra.shark.corba.WorkflowService.WfResourceIteratorPOA;
4 import org.enhydra.shark.corba.poa.Collective;
5 import org.enhydra.shark.corba.poa.SharkCORBAUtilities;
6 import org.enhydra.shark.corba.poa.WfResourceCORBA;
7 import org.enhydra.shark.api.client.wfbase.*;
8 import org.omg.WfBase.*;
9 import org.omg.WfBase.BaseException;
10 import org.omg.WfBase.GrammarNotSupported;
11 import org.omg.WfBase.InvalidQuery;
12 import org.omg.WfBase.NameMismatch;
13 import org.omg.WorkflowModel.WfResource;
14 import org.omg.WorkflowModel.WfCreateProcessEventAuditHelper;
15 import org.omg.CORBA.ORB JavaDoc;
16 import org.omg.PortableServer.POA JavaDoc;
17 import org.omg.PortableServer.POAHelper JavaDoc;
18 import org.omg.PortableServer.POAPackage.ServantAlreadyActive JavaDoc;
19 import org.omg.PortableServer.POAPackage.WrongPolicy JavaDoc;
20 import org.omg.PortableServer.POAPackage.ServantNotActive JavaDoc;
21
22 /**
23  * Iterator for engine resources.
24  *
25  * @author David Forslund
26  * @version 1.0
27  */

28 public class WfResourceIteratorCORBA extends WfResourceIteratorPOA {
29
30    org.enhydra.shark.api.client.wfservice.WfResourceIterator myIterator;
31
32    private Collective __collective;
33     private ORB JavaDoc orb;
34
35    protected WfResourceIteratorCORBA(ORB JavaDoc orb, Collective toJoin,
36                                      org.enhydra.shark.api.client.wfservice.WfResourceIterator iter) throws BaseException {
37        this.orb = orb;
38
39       __collective = toJoin;
40    // toJoin.__recruit(this);
41
this.myIterator = iter;
42    }
43
44    public String JavaDoc query_expression() throws BaseException {
45       try {
46          return myIterator.query_expression();
47       } catch (Exception JavaDoc ex) {
48          throw new BaseException();
49       }
50    }
51
52    /*
53     * The following names may be used: username
54     */

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