KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba;
2
3 import org.omg.WfBase.BaseException;
4 import org.omg.WorkflowModel.*;
5
6 /**
7  * WfAssignmentImpl - Workflow Assignment Object implementation
8  *
9  * @author Sasa Bojanic
10  * @version 1.0
11  */

12 public class WfAssignmentCORBA extends _WfAssignmentImplBase {
13    //private SharkCORBAServer myServer;
14

15    org.enhydra.shark.api.client.wfmodel.WfAssignment sharkAss;
16
17    private Collective __collective;
18
19    /**
20     * Creates new WfAssignment.
21     *
22     * @param sharkAss a WfAssignment
23     */

24    protected WfAssignmentCORBA(Collective toJoin,
25                                org.enhydra.shark.api.client.wfmodel.WfAssignment sharkAss) {
26       __collective = toJoin;
27       toJoin.__recruit(this);
28       this.sharkAss = sharkAss;
29    }
30
31    /**
32     * Gets the activity object of this assignment.
33     *
34     * @return WfActivity The activity object of this assignment.
35     */

36    public WfActivity activity() throws BaseException {
37       try {
38          return new WfActivityCORBA(__collective, sharkAss.activity());
39       } catch (Exception JavaDoc ex) {
40          throw new BaseException();
41       }
42    }
43
44    /**
45     * Gets the assignee (resource) of this assignment.
46     *
47     * @return WfResource The assignee of this assignment.
48     */

49    public WfResource assignee() throws BaseException {
50       try {
51          return new WfResourceCORBA(__collective, sharkAss.assignee());
52       } catch (Exception JavaDoc ex) {
53          throw new BaseException();
54       }
55    }
56
57    /**
58     * Sets the assignee of this assignment.
59     */

60    public void set_assignee(WfResource new_value) throws BaseException,
61                                                  InvalidResource {
62       try {
63          sharkAss.set_assignee(new WfResourceHelper(new_value.resource_key()));
64       } catch (Exception JavaDoc ex) {
65          throw new BaseException();
66       }
67    }
68
69    public synchronized void set_accepted_status(boolean accept) throws BaseException,
70                                                                CannotAcceptSuspended {
71       try {
72          sharkAss.set_accepted_status(accept);
73       } catch (Exception JavaDoc ex) {
74          throw new BaseException();
75       }
76    }
77
78    public boolean get_accepted_status() throws BaseException {
79       try {
80          return sharkAss.get_accepted_status();
81       } catch (Exception JavaDoc ex) {
82          throw new BaseException();
83       }
84    }
85
86    public boolean equals(Object JavaDoc obj) {
87       if (!(obj instanceof WfAssignment)) return false;
88       WfAssignment ass = (WfAssignment) obj;
89       try {
90          return (ass.activity().key().equals(activity().key()) && ass.assignee()
91             .resource_key()
92             .equals(assignee().resource_key()));
93       } catch (Exception JavaDoc ex) {
94          return false;
95       }
96    }
97
98    public String JavaDoc toString() {
99       return sharkAss.toString();
100    }
101
102 }
103
104
Popular Tags