KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba.poa;
2
3 import org.omg.WfBase.BaseException;
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.WfActivityCORBA;
14
15 /**
16  * WfAssignmentImpl - Workflow Assignment Object implementation
17  *
18  * @author David Forslund
19  * @version 1.0
20  */

21 public class WfAssignmentCORBA extends WfAssignmentPOA {
22    //private SharkCORBAServer myServer;
23

24    org.enhydra.shark.api.client.wfmodel.WfAssignment sharkAss;
25
26    private Collective __collective;
27    private ORB JavaDoc orb;
28
29    /**
30     * Creates new WfAssignment.
31     *
32     * @param orb
33     * @param sharkAss a WfAssignment
34     */

35    protected WfAssignmentCORBA(ORB JavaDoc orb, Collective toJoin,
36                                org.enhydra.shark.api.client.wfmodel.WfAssignment sharkAss) {
37       __collective = toJoin;
38       this.orb = orb;
39     // toJoin.__recruit(this);
40
this.sharkAss = sharkAss;
41    }
42
43    /**
44     * Gets the activity object of this assignment.
45     *
46     * @return WfActivity The activity object of this assignment.
47     */

48    public WfActivity activity() throws BaseException {
49       try {
50          WfActivity activity = SharkCORBAUtilities.makeWfActivity(new WfActivityCORBA(orb, __collective, sharkAss.activity()));
51           __collective.__recruit(activity);
52           return activity;
53       } catch (Exception JavaDoc ex) {
54          throw new BaseException();
55       }
56
57    }
58
59    /**
60     * Gets the assignee (resource) of this assignment.
61     *
62     * @return WfResource The assignee of this assignment.
63     */

64    public WfResource assignee() throws BaseException {
65        try {
66           WfResource wfRes = SharkCORBAUtilities.makeWfResource( new WfResourceCORBA(orb, __collective, sharkAss.assignee()));
67            __collective.__recruit(wfRes);
68            return wfRes;
69       } catch (Exception JavaDoc ex) {
70          throw new BaseException();
71       }
72
73    }
74
75    /**
76     * Sets the assignee of this assignment.
77     */

78    public void set_assignee(WfResource new_value) throws BaseException,
79                                                  InvalidResource {
80       try {
81          sharkAss.set_assignee(new WfResourceHelper(new_value.resource_key()));
82       } catch (Exception JavaDoc ex) {
83          throw new BaseException();
84       }
85    }
86
87    public synchronized void set_accepted_status(boolean accept) throws BaseException,
88                                                                CannotAcceptSuspended {
89       try {
90          sharkAss.set_accepted_status(accept);
91       } catch (Exception JavaDoc ex) {
92          throw new BaseException();
93       }
94    }
95
96    public boolean get_accepted_status() throws BaseException {
97       try {
98          return sharkAss.get_accepted_status();
99       } catch (Exception JavaDoc ex) {
100          throw new BaseException();
101       }
102    }
103
104    public boolean equals(Object JavaDoc obj) {
105       if (!(obj instanceof WfAssignment)) return false;
106       WfAssignment ass = (WfAssignment) obj;
107       try {
108          return (ass.activity().key().equals(activity().key()) && ass.assignee()
109             .resource_key()
110             .equals(assignee().resource_key()));
111       } catch (Exception JavaDoc ex) {
112          return false;
113       }
114    }
115
116    public String JavaDoc toString() {
117       return sharkAss.toString();
118    }
119
120 }
121
122
Popular Tags