Source code: org/jeteam/bean/task/TaskServiceBean.java
1 /*
2 * JETeam, Java Enterprise TeamWork
3 *
4 * Distributable under the GPL license.
5 * See terms of licence at http://www.gnu.org
6 *
7 * $Source: /cvsroot/jeteam/jeteam/jeteam-bcx/src/java/org/jeteam/bean/task/TaskServiceBean.java,v $
8 * $Date: 2003/05/28 22:07:49 $
9 * $Author: draftdog $
10 * $Revision: 1.13 $
11 */
12 package org.jeteam.bean.task;
13
14 import javax.ejb.CreateException;
15 import javax.ejb.SessionBean;
16
17
18 /**
19 *
20 * <p>
21 * This bean is a service to Task CRUD operations.
22 * </p>
23 *
24 * <p>
25 * A task has only meaning in the context of a project. Please note
26 * that the task will always be associated to this project. There is
27 * no means of associating another project to this task after the
28 * task has been created. If the argument project does not exist or
29 * is invalid (deleted flag) an exception will be thrown.
30 * </p>
31 *
32 * <p>
33 * A task typically is assigned by a user to a user, a user is
34 * allowed to assign a task to himself.
35 * </p>
36 *
37 * <p>
38 * A task can have many notes attached to it giving some more extra
39 * information along the way.
40 * </p>
41 *
42 * <p>
43 * A task also has a status and priority field associated with it,
44 * this way the user has a view on the importance of the task.
45 * </p>
46 *
47 * @ejb.bean
48 * name="TaskService"
49 * type="Stateless"
50 * jndi-name="org.jeteam.bean.task/TaskService/Home"
51 * @ejb.util
52 * generate="physical"
53 * element.uuid 127-0-0-1-104cf67:f38b4524ba:-7e1b
54 * @ejb.ejb-ref
55 * ejb-name="Task"
56 * view-type="local"
57 * ref-name="ejb/TaskBeanRef"
58 * @ejb.security-identity
59 * run-as="InternalUser"
60 *
61 */
62 public abstract class TaskServiceBean implements SessionBean
63 {
64
65 // ---------------- business methods ----------------------
66
67 /**
68 *
69 * <p>
70 * A task is created by a user for a collection of users and needs a
71 * specific status and priority field associated with it. A task
72 * also is associated to a specific project.
73 * </p>
74 *
75 * <p>
76 * The name of the task must be unique.
77 * </p>
78 *
79 * <p>
80 * It is required that the assignees are all members of the same
81 * project, concretely this means that all UserDTO instances
82 * contained in the "assignedToUser" Collection must be a member of
83 * the argument project. Failing to do so will result in an
84 * exception being thrown.
85 * </p>
86 *
87 * <p>
88 * This method will perform the following: (1) check if the argument
89 * project can be found and has not been marked as deleted, (2) the
90 * task has a non-null name that is not empty and does not already
91 * exist in the argument project, (3) the assigner must be a valid
92 * member of the argument project, (4) the list of argument
93 * assignees (users) may be empty but may not contain any users that
94 * are not an active member of the argument project, (5) the status
95 * must exist, (6) the priority must exist
96 * </p>
97 *
98 * @ejb.interface-method
99 * @ejb.transaction type="Required"
100 * @ejb.permission
101 * unchecked = "false"
102 * role-name = "TaskService,TaskService.createTask"
103 */
104 public abstract org.jeteam.bean.task.TaskDTO createTask(org.jeteam.bean.task.TaskDTO task, org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.user.UserDTO assignedByUser, org.jeteam.bean.user.UserDTO[] assignedToUsers, org.jeteam.bean.config.StatusDTO status, org.jeteam.bean.config.PriorityDTO priority)
105 throws TaskException;
106
107 /**
108 *
109 * <p>
110 * Removing a task will result in setting its 'deleted' attribute to
111 * the current date (not <b> null </b> ) so it will be logically
112 * deleted.
113 * </p>
114 *
115 * @ejb.interface-method
116 * @ejb.transaction type="Required"
117 * @ejb.permission
118 * unchecked = "false"
119 * role-name = "TaskService,TaskService.removeTask"
120 */
121 public abstract void removeTask(org.jeteam.bean.task.TaskDTO task)
122 throws TaskException;
123
124 /**
125 *
126 * <p>
127 * Getting the tasks will only return the ones that have not been
128 * logically deleted, use <b> getAllTasks() </b> in case you need to
129 * retrieve the complete list of tasks.
130 * </p>
131 *
132 * @ejb.interface-method
133 * @ejb.transaction type="Required"
134 * @ejb.permission
135 * unchecked = "false"
136 * role-name = "TaskService,TaskService.getTasks"
137 */
138 public abstract org.jeteam.bean.task.TaskDTO[] getTasks()
139 throws TaskException;
140
141 /**
142 *
143 * <p>
144 * Returns all tasks in the data source, even the ones that have
145 * been logically deleted. If you want only the active ones, use <b>
146 * getTasks() </b> instead.
147 * </p>
148 *
149 * @ejb.interface-method
150 * @ejb.transaction type="Required"
151 * @ejb.permission
152 * unchecked = "false"
153 * role-name = "TaskService,TaskService.getAllTasks"
154 */
155 public abstract org.jeteam.bean.task.TaskDTO[] getAllTasks()
156 throws TaskException;
157
158 /**
159 *
160 * <p>
161 * Returns a collection of notes attached to the task, notes that
162 * have previously logically deleted are included in this
163 * collection.
164 * </p>
165 *
166 * @ejb.interface-method
167 * @ejb.transaction type="Required"
168 * @ejb.permission
169 * unchecked = "false"
170 * role-name = "TaskService,TaskService.getNotes"
171 */
172 public abstract org.jeteam.bean.task.NoteDTO[] getNotes(org.jeteam.bean.task.TaskDTO task)
173 throws TaskException;
174
175 /**
176 *
177 * <p>
178 * Returns the users to whom this task has been assigned, the
179 * returned Collection contains all UserDTO instances.
180 * </p>
181 *
182 * @ejb.interface-method
183 * @ejb.transaction type="Required"
184 * @ejb.permission
185 * unchecked = "false"
186 * role-name = "TaskService,TaskService.getAssignedToUsers"
187 */
188 public abstract org.jeteam.bean.user.UserDTO[] getAssignedToUsers(org.jeteam.bean.task.TaskDTO task)
189 throws TaskException;
190
191 /**
192 *
193 * <p>
194 * The user who assigned to task, typically the one that created it.
195 * </p>
196 *
197 * @ejb.interface-method
198 * @ejb.transaction type="Required"
199 * @ejb.permission
200 * unchecked = "false"
201 * role-name = "TaskService,TaskService.getAssignedByUser"
202 */
203 public abstract org.jeteam.bean.user.UserDTO getAssignedByUser(org.jeteam.bean.task.TaskDTO task)
204 throws TaskException;
205
206 /**
207 *
208 * <p>
209 * Returns the project context in which this task has a meaning.
210 * </p>
211 *
212 * @ejb.interface-method
213 * @ejb.transaction type="Required"
214 * @ejb.permission
215 * unchecked = "false"
216 * role-name = "TaskService,TaskService.getProject"
217 */
218 public abstract org.jeteam.bean.project.ProjectDTO getProject(org.jeteam.bean.task.TaskDTO task)
219 throws TaskException;
220
221 /**
222 *
223 * <p>
224 * Logically deletes the notes attached to this task, does <b> not
225 * </b> remove them from the relationship.
226 * </p>
227 *
228 * @ejb.interface-method
229 * @ejb.transaction type="Required"
230 * @ejb.permission
231 * unchecked = "false"
232 * role-name = "TaskService,TaskService.clearNotes"
233 */
234 public abstract void clearNotes(org.jeteam.bean.task.TaskDTO task)
235 throws TaskException;
236
237 /**
238 *
239 * <p>
240 * Updates the properties of the task, this can be the name,
241 * description, due date or the progress indicator. The name of the
242 * task may be changed but must remain unique.
243 * </p>
244 *
245 * @ejb.interface-method
246 * @ejb.transaction type="Required"
247 * @ejb.permission
248 * unchecked = "false"
249 * role-name = "TaskService,TaskService.updateTask"
250 */
251 public abstract void updateTask(org.jeteam.bean.task.TaskDTO task)
252 throws TaskException;
253
254 /**
255 *
256 * <p>
257 * Gets this task's priority.
258 * </p>
259 *
260 * @ejb.interface-method
261 * @ejb.transaction type="Required"
262 * @ejb.permission
263 * unchecked = "false"
264 * role-name = "TaskService,TaskService.getPriority"
265 */
266 public abstract org.jeteam.bean.config.PriorityDTO getPriority(org.jeteam.bean.task.TaskDTO task)
267 throws TaskException;
268
269 /**
270 *
271 * <p>
272 * Gets this task's status.
273 * </p>
274 *
275 * @ejb.interface-method
276 * @ejb.transaction type="Required"
277 * @ejb.permission
278 * unchecked = "false"
279 * role-name = "TaskService,TaskService.getStatus"
280 */
281 public abstract org.jeteam.bean.config.StatusDTO getStatus(org.jeteam.bean.task.TaskDTO task)
282 throws TaskException;
283
284 /**
285 *
286 * <p>
287 * Sets this task's priority.
288 * </p>
289 *
290 * @ejb.interface-method
291 * @ejb.transaction type="Required"
292 * @ejb.permission
293 * unchecked = "false"
294 * role-name = "TaskService,TaskService.setPriority"
295 */
296 public abstract void setPriority(org.jeteam.bean.task.TaskDTO task, org.jeteam.bean.config.PriorityDTO priority)
297 throws TaskException;
298
299 /**
300 *
301 * <p>
302 * Sets this task's status.
303 * </p>
304 *
305 * @ejb.interface-method
306 * @ejb.transaction type="Required"
307 * @ejb.permission
308 * unchecked = "false"
309 * role-name = "TaskService,TaskService.setStatus"
310 */
311 public abstract void setStatus(org.jeteam.bean.task.TaskDTO task, org.jeteam.bean.config.StatusDTO status)
312 throws TaskException;
313
314 /**
315 *
316 * <p>
317 * Set the users to whom this task has been assigned, the argument
318 * Collection must contain all UserDTO instances.
319 * </p>
320 *
321 * <p>
322 * It is required that the assignees are all members of the same
323 * project, concretely this means that all UserDTO instances
324 * contained in the "assignedToUser" Collection must be a member of
325 * the task's project. Failing to do so will result in an exception
326 * being thrown.
327 * </p>
328 *
329 * <p>
330 * This method clears the current set of users and replaces it by
331 * the ones represented by the argument array.
332 * </p>
333 *
334 * @ejb.interface-method
335 * @ejb.transaction type="Required"
336 * @ejb.permission
337 * unchecked = "false"
338 * role-name = "TaskService,TaskService.setAssignedToUsers"
339 */
340 public abstract void setAssignedToUsers(org.jeteam.bean.task.TaskDTO task, org.jeteam.bean.user.UserDTO[] users)
341 throws TaskException;
342
343 // ---------------- create methods -------------------------
344
345 /**
346 * @ejb.create-method
347 * @ejb.transaction type="Required"
348 * @ejb.permission
349 * unchecked = "false"
350 * role-name = "TaskService,TaskService.ejbCreate"
351 */
352 public void ejbCreate()
353 throws CreateException
354 {
355 }
356
357 public void ejbPostCreate()
358 throws CreateException
359 {
360 }
361 }