01: /**
02: *
03: * Bonita
04: * Copyright (C) 1999 Bull S.A.
05: * Bull 68 route de versailles 78434 Louveciennes Cedex France
06: * Further information: bonita@objectweb.org
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation; either
11: * version 2.1 of the License, or any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public
19: * License along with this library; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21: * USA
22: *
23: *
24: --------------------------------------------------------------------------
25: * $Id: LoadProcessInitiatorMapper.java,v 1.1 2005/07/06 12:18:00 blachonm Exp $
26: *
27: --------------------------------------------------------------------------
28: */package hero.client.samples;
29:
30: import java.util.ArrayList;
31: import java.util.Collection;
32: import java.util.Iterator;
33:
34: import javax.security.auth.login.LoginContext;
35: import hero.client.test.SimpleCallbackHandler;
36:
37: import hero.interfaces.BnProjectLightValue;
38: import hero.interfaces.Constants;
39: import hero.interfaces.ProjectSession;
40: import hero.interfaces.ProjectSessionHome;
41: import hero.interfaces.ProjectSessionUtil;
42:
43: import hero.interfaces.UserSession;
44: import hero.interfaces.UserSessionHome;
45: import hero.interfaces.UserSessionUtil;
46:
47: public class LoadProcessInitiatorMapper {
48:
49: static public void main(String[] args) throws Exception {
50: // Admin login
51: char[] password = { 't', 'o', 't', 'o' };
52: SimpleCallbackHandler handler = new SimpleCallbackHandler(
53: "admin", password);
54: LoginContext lc = new LoginContext("TestClient", handler);
55: lc.login();
56:
57: ProjectSessionHome projectSessionh = ProjectSessionUtil
58: .getHome();
59: UserSessionHome usersh = UserSessionUtil.getHome();
60: UserSession usr = usersh.create();
61:
62: ProjectSession pss = projectSessionh.create();
63: pss.initModel("LoadProcessInitiatorMapper");
64:
65: pss.addNode("node1", Constants.Nd.AND_JOIN_NODE);
66: pss.setNodeRole("node1", "admin");
67: pss.addNode("node2", Constants.Nd.AND_JOIN_NODE);
68: pss.addEdge("node1", "node2");
69: pss.addInitiatorMapper(
70: "hero.initiatorMapper.CustomGroupMembers",
71: Constants.InitiatorMapper.CUSTOM);
72:
73: //User Session Bean Creation using Remote Interface
74: UserSessionHome usrHome = (UserSessionHome) UserSessionUtil
75: .getHome();
76: UserSession usrSession = usrHome.create();
77:
78: // Check process available for admin user
79: Collection ar_precess = usrSession.getModels();
80: Iterator it_pro = ar_precess.iterator();
81: System.out
82: .println("List of process available for admin user:\n");
83: if (ar_precess.isEmpty())
84: System.out.println("No process available !!");
85: else {
86: while (it_pro.hasNext()) {
87: BnProjectLightValue pro_lv = (BnProjectLightValue) it_pro
88: .next();
89: System.out.println(" - process = " + pro_lv.getName());
90: }
91: }
92:
93: }
94: }
|