KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hero > performerAssign > PropertySelectActors


1 /**
2  *
3  * Bonita
4  * Copyright (C) 1999 Bull S.A.
5  * Bull 68 route de versailles 78434 Louveciennes Cedex France
6  * Further information: bonita@objectweb.org
7  *
8  * This library is free software; you can redistribute it and/or
9  * 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.1 2004/07/30 14:57:58 mvaldes Exp $
26  *
27 --------------------------------------------------------------------------
28  */

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