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: PropertySelectActors.java,v 1.3 2005/11/15 15:24:49 dparisek Exp $
26: *
27: --------------------------------------------------------------------------
28: */package hero.performerAssign;
29:
30: import hero.util.HeroException;
31: import hero.interfaces.BnNodeLocal;
32: import hero.interfaces.BnNodePropertyLocal;
33: import hero.interfaces.BnProjectPropertyLocal;
34:
35: public class PropertySelectActors implements
36: hero.performerAssign.NodePerformerAssignI {
37:
38: public void selectActors(Object b, BnNodeLocal n, String userName)
39: throws HeroException {
40: String nodeName = n.getName();
41: String projectName = n.getBnProject().getName();
42: // logs trace
43: System.out.println("[PropertySelectActors] BnNode name:"
44: + nodeName + " - Project name = " + projectName);
45: try {
46: String user = "";
47: // get the property name
48: String propertyName = n.getBnNodePerformerAssign()
49: .getPropertyName();
50: // get the property value
51: java.util.Collection coN = null;
52: java.util.Collection coP = null;
53: coN = n.getBnProperties();
54: coP = n.getBnProject().getBnProperties();
55: BnProjectPropertyLocal propertyPl;
56: BnNodePropertyLocal propertyL;
57: java.util.Iterator it = coN.iterator();
58: while (it.hasNext()) {
59: propertyL = (BnNodePropertyLocal) it.next();
60: if ((propertyL.getTheKey()).equals(propertyName))
61: user = propertyL.getTheValue();
62: }
63: if (user.equals("")) {
64: it = coP.iterator();
65: while (it.hasNext()) {
66: propertyPl = (BnProjectPropertyLocal) it.next();
67: if ((propertyPl.getTheKey()).equals(propertyName))
68: user = propertyPl.getTheValue();
69: }
70: }
71: // logs trace
72: System.out.println("[PropertySelectActors] user = " + user);
73: n.setActivityPerformer(user);
74: } catch (Exception e) {
75: e.printStackTrace();
76: throw new HeroException("[PropertySelectActors]: "
77: + e.getMessage());
78: }
79: }
80: }
|