KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > mc > formgenerator > servlets > bonita > ModelActivityToDoList


1 /*
2  * Created on 03 mai 2004 by the Message Center Team
3  *
4  */

5 package mc.formgenerator.servlets.bonita;
6
7 import java.rmi.RemoteException JavaDoc;
8 import java.util.ArrayList JavaDoc;
9 import java.util.Collection JavaDoc;
10
11 import javax.ejb.CreateException JavaDoc;
12 import javax.naming.NamingException JavaDoc;
13
14 import hero.interfaces.UserSessionHome;
15 import hero.interfaces.UserSession;
16 import hero.util.HeroException;
17
18 /**
19  * @author sempereb
20  */

21 public class ModelActivityToDoList {
22
23     //The project name
24
private String JavaDoc projectName = null;
25     
26     //The todo list as a collection
27
private Collection JavaDoc toDoList = null;
28
29
30     /**
31      * Default constructor
32      * Creates an instance of ModelActivityToDoList
33      */

34     public ModelActivityToDoList(){};
35
36
37
38
39     /**
40      * Gets the ToDoList
41      * @return the ToDoList as collection
42      */

43     public Collection JavaDoc getToDoList(){
44         //Return the todo list
45
return this.toDoList;
46     }
47     
48     
49     
50
51     /**
52      * Sets the ToDoList
53      * @param collection : The collection to set
54      */

55     public void setToDoList(Collection JavaDoc collection){
56         //Set the todo list
57
this.toDoList = collection;
58     }
59     
60     
61     
62
63     /**
64      * Gets the project name
65      * @return the project name as stringection
66      */

67     public String JavaDoc getProjectName(){
68         //Return the name of the project
69
return this.projectName;
70     }
71     
72     
73     
74
75     /**
76      * Sets the project name
77      * @param theProjectName : The name of the project
78      */

79     public void setProjectName(String JavaDoc theProjectName){
80         //Set the todo list
81
this.projectName = theProjectName;
82     }
83     
84     
85     
86     
87     /**
88      * Gets the to do list for the authentified user
89      * @param projectName : The name of the project
90      * @return The todo list for this project
91      * @throws HeroException
92      * @throws RemoteException
93      * @throws CreateException
94      * @throws NamingException
95      * @throws LoginException
96      */

97     private Collection JavaDoc getBonitaToDoList(String JavaDoc projectName)
98         throws HeroException, RemoteException JavaDoc,
99                CreateException JavaDoc, NamingException JavaDoc{
100         
101         //Connection to Bonita via API
102
UserSessionHome userh = (UserSessionHome)hero.interfaces.UserSessionUtil.getHome();
103         UserSession usersession = userh.create();
104         
105         //Collection as ToDo list
106
Collection JavaDoc collectionToDoList = new ArrayList JavaDoc();
107         try{
108         collectionToDoList =
109             usersession.getToDoList(projectName);
110         }catch(HeroException e){}
111             
112         return collectionToDoList;
113     }
114     
115     
116     
117     
118     /**
119      * For the MVC corresponds to the work the object has to do
120      * @param projectName : The project on which the object opers
121      * @throws RemoteException
122      * @throws LoginException
123      * @throws HeroException
124      * @throws CreateException
125      * @throws NamingException
126      */

127     public void process(String JavaDoc theProjectName)
128         throws RemoteException JavaDoc, HeroException,
129                 CreateException JavaDoc, NamingException JavaDoc{
130         
131         //Setting attributes
132
this.setProjectName(theProjectName);
133         this.setToDoList(this.getBonitaToDoList(theProjectName));
134     }
135 }
136
Popular Tags