KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba;
2
3 import org.enhydra.shark.api.*;
4
5 import org.enhydra.shark.api.client.wfbase.*;
6 import org.enhydra.shark.api.client.wfmodel.*;
7
8 /**
9  * WfResourceHelper - Helper class to be able to implement method
10  * WfAssignment.set_assignee(). Only required method to be implemented
11  * is resource_key().
12  * @author Sasa Bojanic
13  */

14 public class WfResourceHelper implements WfResource {
15    private String JavaDoc username;
16
17    /**
18     * Creates a new WfResource
19     * @param username - Uniquely identifies the resource
20     */

21    protected WfResourceHelper(String JavaDoc username) {
22       this.username = username;
23    }
24
25    /**
26     * Gets the number of work items currently assigned to this resource.
27     */

28    public int how_many_work_item () throws BaseException {
29       throw new BaseException("Not implemented");
30    }
31
32    public int how_many_work_item (SharkTransaction t) throws BaseException {
33       throw new BaseException("Not implemented");
34    }
35
36    /**
37     * Gets an iterator of work items.
38     */

39    public WfAssignmentIterator get_iterator_work_item () throws BaseException {
40       throw new BaseException("Not implemented");
41    }
42
43    public WfAssignmentIterator get_iterator_work_item (SharkTransaction t)
44    throws BaseException {
45       throw new BaseException("Not implemented");
46    }
47
48    /**
49     * Gets the work items.
50     * @return List of WfAssignment objects.
51     */

52    public WfAssignment[] get_sequence_work_item (int max_number) throws BaseException {
53       throw new BaseException("Not implemented");
54    }
55
56    public WfAssignment[] get_sequence_work_item(SharkTransaction t,int max_number)
57    throws BaseException {
58       throw new BaseException("Not implemented");
59    }
60
61    /**
62     * Checks if an assignment object is associated with this resource
63     * @return true if assignment is part of the work list for this resource.
64     */

65    public boolean is_member_of_work_items(WfAssignment member) throws BaseException {
66       throw new BaseException("Not implemented");
67    }
68
69    public boolean is_member_of_work_items(SharkTransaction t,WfAssignment member) throws BaseException {
70       throw new BaseException("Not implemented");
71    }
72
73    /**
74     * Gets the resource username.
75     */

76    public String JavaDoc resource_key () throws BaseException {
77       return username;
78    }
79
80    public String JavaDoc resource_key (SharkTransaction t) throws BaseException {
81       return username;
82    }
83
84    /**
85     * Gets the resource name.
86     */

87    public String JavaDoc resource_name () throws BaseException {
88       throw new BaseException("Not implemented");
89    }
90
91    public String JavaDoc resource_name (SharkTransaction t) throws BaseException {
92       throw new BaseException("Not implemented");
93    }
94
95    /**
96     * Release the resouce from the assignment.
97     */

98    public void release (WfAssignment from_assigment, String JavaDoc release_info) throws BaseException, NotAssigned {
99       throw new BaseException("Not implemented");
100    }
101
102    public void release (SharkTransaction t,WfAssignment from_assigment, String JavaDoc release_info) throws BaseException, NotAssigned {
103       throw new BaseException("Not implemented");
104    }
105
106    public String JavaDoc toString () {
107       return "[Id="+username+"]";
108    }
109
110    /**
111     * It is assumed that there can't be two or more
112     * resources having the same resource key.
113     */

114    public boolean equals (Object JavaDoc obj) {
115       if (!(obj instanceof WfResource)) return false;
116       WfResource res=(WfResource)obj;
117       try {
118          return res.resource_key().equals(username);
119       } catch (Exception JavaDoc ex) {
120          return false;
121       }
122    }
123
124 }
125
Popular Tags