01: /*
02: * Created on 12 mai 2004
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package mc.formgenerator.servlets.bonita;
08:
09: import hero.util.HeroException;
10: import hero.interfaces.UserSession;
11: import hero.interfaces.UserSessionHome;
12: import hero.interfaces.UserSessionUtil;
13:
14: import java.rmi.RemoteException;
15: import java.util.Collection;
16:
17: import javax.ejb.CreateException;
18: import javax.naming.NamingException;
19:
20: /**
21: * Model for servlet ServletInstancesProjects to give projects instances to display.
22: *
23: */
24: public class ModeleInstances {
25:
26: /**
27: * Attribute which stocks the project names
28: */
29: private Collection instanceProjectList;
30:
31: /**
32: * Default class constructor
33: */
34: public ModeleInstances() {
35: }
36:
37: /**
38: * The main method which finds and initialises the model projects list.
39: * @throws LoginException
40: * @throws RemoteException
41: * @throws NamingException
42: * @throws CreateException
43: * @throws HeroException
44: */
45: public void process() throws RemoteException, NamingException,
46: CreateException, HeroException {
47:
48: Collection list = this .getAllInstancesProjects();
49:
50: this .setInstanceProjectList(list);
51: }
52:
53: /**
54: * Returns the projects instances list of the current user.
55: * @return Collection List of the projects instances of the user.
56: * @throws NamingException
57: * @throws CreateException
58: * @throws RemoteException
59: * @throws HeroException
60: */
61: private Collection getAllInstancesProjects()
62: throws NamingException, CreateException, RemoteException,
63: HeroException {
64:
65: UserSessionHome userh = UserSessionUtil.getHome();
66:
67: UserSession userSession = userh.create();
68:
69: Collection list = userSession.getInstancesListNames();
70:
71: return list;
72: }
73:
74: /**
75: * Set the value of the attribute instanceProjectList with the value 'col'.
76: * @param col Collection List of all instance projects.
77: */
78: public void setInstanceProjectList(Collection col) {
79:
80: this .instanceProjectList = col;
81: }
82:
83: /**
84: * Get the value of the attribute instanceProjectList.
85: * @return Collection List of all instance projects.
86: */
87: public Collection getInstanceProjectList() {
88:
89: return this.instanceProjectList;
90: }
91:
92: }
|