Source code: org/jeteam/bean/project/ProjectServiceBean.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/project/ProjectServiceBean.java,v $
8 * $Date: 2003/05/28 22:07:48 $
9 * $Author: draftdog $
10 * $Revision: 1.13 $
11 */
12 package org.jeteam.bean.project;
13
14 import javax.ejb.CreateException;
15 import javax.ejb.SessionBean;
16
17
18 /**
19 *
20 * <p>
21 * This bean is a service to Project CRUD operations.
22 * </p>
23 *
24 * <p>
25 * Some other services are also provided, be extremely careful when
26 * removing roles from a project since this may impact the set of
27 * associated users too (read method documentation for more info).
28 * </p>
29 *
30 * <p>
31 * A project is the center point of the jeteam system as user will
32 * be assigned to work on it, and all the tasks will be under the
33 * context of a project.
34 * </p>
35 *
36 * <p>
37 * </p>
38 *
39 * @ejb.bean
40 * name="ProjectService"
41 * type="Stateless"
42 * jndi-name="org.jeteam.bean.project/ProjectService/Home"
43 * @ejb.util
44 * generate="physical"
45 * element.uuid 127-0-0-1-104cf67:f38b4524ba:-7e40
46 * @ejb.ejb-ref
47 * ejb-name="Project"
48 * view-type="local"
49 * ref-name="ejb/ProjectBeanRef"
50 * @ejb.security-identity
51 * run-as="InternalUser"
52 *
53 */
54 public abstract class ProjectServiceBean implements SessionBean
55 {
56
57 // ---------------- business methods ----------------------
58
59 /**
60 *
61 * <p>
62 * When creating a new project make sure the project name does not
63 * already exists.
64 * </p>
65 *
66 * @ejb.interface-method
67 * @ejb.transaction type="Required"
68 * @ejb.permission
69 * unchecked = "false"
70 * role-name = "ProjectService,ProjectService.createProject"
71 */
72 public abstract org.jeteam.bean.project.ProjectDTO createProject(org.jeteam.bean.project.ProjectDTO project)
73 throws ProjectException;
74
75 /**
76 *
77 * <p>
78 * Removing a project will result in setting its 'deleted' attribute
79 * to the current date (not <b> null </b> ) so it will be logically
80 * deleted.
81 * </p>
82 *
83 * @ejb.interface-method
84 * @ejb.transaction type="Required"
85 * @ejb.permission
86 * unchecked = "false"
87 * role-name = "ProjectService,ProjectService.removeProject"
88 */
89 public abstract void removeProject(org.jeteam.bean.project.ProjectDTO project)
90 throws ProjectException;
91
92 /**
93 *
94 * <p>
95 * Getting the projects will only return the ones that have not been
96 * logically deleted, use <b> getAllProjects() </b> in case you need
97 * to retrieve the complete list of projects.
98 * </p>
99 *
100 * @ejb.interface-method
101 * @ejb.transaction type="Required"
102 * @ejb.permission
103 * unchecked = "false"
104 * role-name = "ProjectService,ProjectService.getProjects"
105 */
106 public abstract org.jeteam.bean.project.ProjectDTO[] getProjects()
107 throws ProjectException;
108
109 /**
110 *
111 * <p>
112 * Returns all projects that can be found.
113 * </p>
114 *
115 * @ejb.interface-method
116 * @ejb.transaction type="Required"
117 * @ejb.permission
118 * unchecked = "false"
119 * role-name = "ProjectService,ProjectService.getAllProjects"
120 */
121 public abstract org.jeteam.bean.project.ProjectDTO[] getAllProjects()
122 throws ProjectException;
123
124 /**
125 *
126 * <p>
127 * Returns all the users associated with this project.
128 * </p>
129 *
130 * @ejb.interface-method
131 * @ejb.transaction type="Required"
132 * @ejb.permission
133 * unchecked = "false"
134 * role-name = "ProjectService,ProjectService.getUsers"
135 */
136 public abstract org.jeteam.bean.user.UserDTO[] getUsers(org.jeteam.bean.project.ProjectDTO project)
137 throws ProjectException;
138
139 /**
140 *
141 * <p>
142 * Removing a user from a project will result in removing the user
143 * from the relationship, it will not be deleted.
144 * </p>
145 *
146 * @ejb.interface-method
147 * @ejb.transaction type="Required"
148 * @ejb.permission
149 * unchecked = "false"
150 * role-name = "ProjectService,ProjectService.removeUser"
151 */
152 public abstract void removeUser(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.user.UserDTO user)
153 throws ProjectException;
154
155 /**
156 *
157 * <p>
158 * Removes all users from this project.
159 * </p>
160 *
161 * @ejb.interface-method
162 * @ejb.transaction type="Required"
163 * @ejb.permission
164 * unchecked = "false"
165 * role-name = "ProjectService,ProjectService.clearUsers"
166 */
167 public abstract void clearUsers(org.jeteam.bean.project.ProjectDTO project)
168 throws ProjectException;
169
170 /**
171 *
172 * <p>
173 * Updates this project's information, this can be either the name
174 * or the description. The name can be changed but must remain
175 * unique.
176 * </p>
177 *
178 * @ejb.interface-method
179 * @ejb.transaction type="Required"
180 * @ejb.permission
181 * unchecked = "false"
182 * role-name = "ProjectService,ProjectService.updateProject"
183 */
184 public abstract void updateProject(org.jeteam.bean.project.ProjectDTO project)
185 throws ProjectException;
186
187 /**
188 *
189 * <p>
190 * Assigns a new user to this project, if the user has already been
191 * assigned to this project nothing happens.
192 * </p>
193 *
194 * @ejb.interface-method
195 * @ejb.transaction type="Required"
196 * @ejb.permission
197 * unchecked = "false"
198 * role-name = "ProjectService,ProjectService.addUser"
199 */
200 public abstract void addUser(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.user.UserDTO user)
201 throws ProjectException;
202
203 /**
204 *
205 * <p>
206 * Assigns a new task to this project, if the task has already been
207 * assigned to this project nothing happens.
208 * </p>
209 *
210 * @ejb.interface-method
211 * @ejb.transaction type="Required"
212 * @ejb.permission
213 * unchecked = "false"
214 * role-name = "ProjectService,ProjectService.addTask"
215 */
216 public abstract void addTask(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.task.TaskDTO task)
217 throws ProjectException;
218
219 /**
220 *
221 * <p>
222 * Sets the status of this project.
223 * </p>
224 *
225 * @ejb.interface-method
226 * @ejb.transaction type="Required"
227 * @ejb.permission
228 * unchecked = "false"
229 * role-name = "ProjectService,ProjectService.setStatus"
230 */
231 public abstract void setStatus(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.config.StatusDTO status)
232 throws ProjectException;
233
234 /**
235 *
236 * <p>
237 * Gets the status of this project.
238 * </p>
239 *
240 * @ejb.interface-method
241 * @ejb.transaction type="Required"
242 * @ejb.permission
243 * unchecked = "false"
244 * role-name = "ProjectService,ProjectService.getStatus"
245 */
246 public abstract org.jeteam.bean.config.StatusDTO getStatus(org.jeteam.bean.project.ProjectDTO project)
247 throws ProjectException;
248
249 /**
250 *
251 * <p>
252 * Returns the collection of roles that users must have before being
253 * able to be assigned to this project. If a user has one of the
254 * roles associated to him/her, he can be assigned to the project.
255 * </p>
256 *
257 * @ejb.interface-method
258 * @ejb.transaction type="Required"
259 * @ejb.permission
260 * unchecked = "false"
261 * role-name = "ProjectService,ProjectService.getRoles"
262 */
263 public abstract org.jeteam.bean.security.RoleDTO[] getRoles(org.jeteam.bean.project.ProjectDTO project)
264 throws ProjectException;
265
266 /**
267 *
268 * <p>
269 * Adds a new role this this project, this may allow other users to
270 * be assigned to this project. If the role is already assinged to
271 * this project nothing happens.
272 * </p>
273 *
274 * @ejb.interface-method
275 * @ejb.transaction type="Required"
276 * @ejb.permission
277 * unchecked = "false"
278 * role-name = "ProjectService,ProjectService.addRole"
279 */
280 public abstract void addRole(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.security.RoleDTO role)
281 throws ProjectException;
282
283 /**
284 *
285 * <p>
286 * Removes a role from the project.
287 * </p>
288 *
289 * <p>
290 * <b> This may cause for some confusion since all associated users
291 * that do not have roles anymore required by the project will be
292 * removed from the project. </b>
293 * </p>
294 *
295 * @ejb.interface-method
296 * @ejb.transaction type="Required"
297 * @ejb.permission
298 * unchecked = "false"
299 * role-name = "ProjectService,ProjectService.removeRole"
300 */
301 public abstract void removeRole(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.security.RoleDTO role)
302 throws ProjectException;
303
304 /**
305 *
306 * <p>
307 * Removes all roles from the project.
308 * </p>
309 *
310 * <p>
311 * <b> This will remove all associated users from this project, so
312 * use it with care! </b>
313 * </p>
314 *
315 * @ejb.interface-method
316 * @ejb.transaction type="Required"
317 * @ejb.permission
318 * unchecked = "false"
319 * role-name = "ProjectService,ProjectService.clearRoles"
320 */
321 public abstract void clearRoles(org.jeteam.bean.project.ProjectDTO project)
322 throws ProjectException;
323
324 /**
325 *
326 * <p>
327 * Adds the list of users to the existing list associated with the
328 * argument project.
329 * </p>
330 *
331 * @ejb.interface-method
332 * @ejb.transaction type="Required"
333 * @ejb.permission
334 * unchecked = "false"
335 * role-name = "ProjectService,ProjectService.addUsers"
336 */
337 public abstract void addUsers(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.user.UserDTO[] users)
338 throws ProjectException;
339
340 /**
341 *
342 * <p>
343 * Returns all the tasks that have been created for this project.
344 * </p>
345 *
346 * @ejb.interface-method
347 * @ejb.transaction type="Required"
348 * @ejb.permission
349 * unchecked = "false"
350 * role-name = "ProjectService,ProjectService.getTasks"
351 */
352 public abstract org.jeteam.bean.task.TaskDTO[] getTasks(org.jeteam.bean.project.ProjectDTO project)
353 throws ProjectException;
354
355 /**
356 *
357 * <p>
358 * Removes all the tasks that have been created for this project.
359 * </p>
360 *
361 * @ejb.interface-method
362 * @ejb.transaction type="Required"
363 * @ejb.permission
364 * unchecked = "false"
365 * role-name = "ProjectService,ProjectService.clearTasks"
366 */
367 public abstract void clearTasks(org.jeteam.bean.project.ProjectDTO project)
368 throws ProjectException;
369
370 /**
371 *
372 * <p>
373 * Removes the specified task from the argument project. The task
374 * must exist, and must be associated with the project.
375 * </p>
376 *
377 * @ejb.interface-method
378 * @ejb.transaction type="Required"
379 * @ejb.permission
380 * unchecked = "false"
381 * role-name = "ProjectService,ProjectService.removeTask"
382 */
383 public abstract void removeTask(org.jeteam.bean.project.ProjectDTO project, org.jeteam.bean.task.TaskDTO task)
384 throws ProjectException;
385
386 // ---------------- create methods -------------------------
387
388 /**
389 * @ejb.create-method
390 * @ejb.transaction type="Required"
391 * @ejb.permission
392 * unchecked = "false"
393 * role-name = "ProjectService,ProjectService.ejbCreate"
394 */
395 public void ejbCreate()
396 throws CreateException
397 {
398 }
399
400 public void ejbPostCreate()
401 throws CreateException
402 {
403 }
404 }