Source Code Cross Referenced for Participant.java in  » Workflow-Engines » wilos » wilos » model » misc » wilosuser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » wilos » wilos.model.misc.wilosuser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
003:         * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
004:         *
005:         * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
006:         * General Public License as published by the Free Software Foundation; either version 2 of the License,
007:         * or (at your option) any later version.
008:         *
009:         * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
010:         * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011:         * GNU General Public License for more details.
012:         *
013:         * You should have received a copy of the GNU General Public License along with this program; if not,
014:         * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
015:         */
016:
017:        package wilos.model.misc.wilosuser;
018:
019:        import java.util.HashSet;
020:        import java.util.Set;
021:
022:        import org.apache.commons.lang.builder.EqualsBuilder;
023:        import org.apache.commons.lang.builder.HashCodeBuilder;
024:        import org.hsqldb.lib.Iterator;
025:
026:        import wilos.model.misc.project.Project;
027:        import wilos.model.misc.concreterole.ConcreteRoleDescriptor;
028:        import wilos.model.misc.concreteworkproduct.ConcreteWorkProductDescriptor;
029:        import wilos.model.spem2.role.RoleDescriptor;
030:
031:        /**
032:         * This class represents a participant of a {@link Project}. This type of user
033:         * can work on projects and select a role from the {@link Process} defined in
034:         * relation with a {@link Project}.
035:         * 
036:         */
037:        public class Participant extends WilosUser implements  Cloneable {
038:
039:            private Set<ConcreteRoleDescriptor> concreteRoleDescriptors;
040:
041:            private Set<ConcreteWorkProductDescriptor> concreteWorkProductDescriptors;
042:
043:            private Set<Project> affectedProjectList;
044:
045:            private Set<Project> managedProjects;
046:
047:            /**
048:             * Class Constructor.
049:             * 
050:             */
051:            public Participant() {
052:                super ();
053:                concreteRoleDescriptors = new HashSet<ConcreteRoleDescriptor>();
054:                affectedProjectList = new HashSet<Project>();
055:                managedProjects = new HashSet<Project>();
056:                concreteWorkProductDescriptors = new HashSet<ConcreteWorkProductDescriptor>();
057:            }
058:
059:            /**
060:             * Adds a Project to the Participant
061:             * 
062:             * @param _arg0
063:             *            the Project to be add
064:             * @return true if the addition was well done
065:             */
066:            public boolean add(Project _arg0) {
067:                return this .affectedProjectList.add(_arg0);
068:            }
069:
070:            /**
071:             * Removes a Project to the Participant
072:             * 
073:             * @param _arg0
074:             *            the Project to be remove
075:             * @return true if the removal was well done
076:             */
077:            public boolean remove(Object _arg0) {
078:                return this .affectedProjectList.remove(_arg0);
079:            }
080:
081:            /**
082:             * Returns the number of projects related to the Participant
083:             * 
084:             * @return the Participant number of assigned Project
085:             */
086:            public int size() {
087:                return this .affectedProjectList.size();
088:            }
089:
090:            /**
091:             * Returns the Collection of ConcreteWorkProductDescriptor related to the
092:             * Participant
093:             * 
094:             * @return the Collection of ConcreteWorkProductDescriptor
095:             */
096:            public Set<ConcreteWorkProductDescriptor> getConcreteWorkProductDescriptors() {
097:                return this .concreteWorkProductDescriptors;
098:            }
099:
100:            /**
101:             * Sets the Collection of ConcreteWorkProductDescriptor related to the
102:             * Participant with the Set in parameter
103:             * 
104:             * @param _concreteWorkProductDescriptors
105:             *            the Collection of ConcreteWorkProductDescriptor to set
106:             */
107:            public void setConcreteWorkProductDescriptors(
108:                    Set<ConcreteWorkProductDescriptor> _concreteWorkProductDescriptors) {
109:                this .concreteWorkProductDescriptors = _concreteWorkProductDescriptors;
110:            }
111:
112:            /**
113:             * Returns a copy of the current instance of Participant
114:             * 
115:             * @return a copy of the Participant
116:             * @throws CloneNotSupportedException
117:             */
118:            @Override
119:            public Participant clone() throws CloneNotSupportedException {
120:                Participant participant = new Participant();
121:                participant.copy(this );
122:                return participant;
123:            }
124:
125:            /**
126:             * Copy the values of the specified Participant into the current instance of the
127:             * class.
128:             * 
129:             * @param _participant
130:             *            The Participant to copy.
131:             */
132:            protected void copy(final Participant _participant) {
133:                super .copy(_participant);
134:                this .setConcreteRoleDescriptors(_participant
135:                        .getConcreteRoleDescriptors());
136:            }
137:
138:            /**
139:             * Defines if the specified Object is the same or has the same values as the
140:             * current instance of the class.
141:             * 
142:             * @param _obj
143:             *            the Object to be compare to the Participant
144:             * @return true if the specified Object is the same, false otherwise
145:             */
146:            public boolean equals(Object _obj) {
147:                if (_obj instanceof  Participant == false) {
148:                    return false;
149:                }
150:                if (this  == _obj) {
151:                    return true;
152:                }
153:                Participant participant = (Participant) _obj;
154:                return new EqualsBuilder().appendSuper(
155:                        super .equals(participant)).append(
156:                        this .concreteRoleDescriptors,
157:                        participant.concreteRoleDescriptors).isEquals();
158:            }
159:
160:            /**
161:             * Returns a hash code value for the object. This method is supported for
162:             * the benefit of hash tables.
163:             * 
164:             * @return the hash code of the current instance of Participant
165:             */
166:            public int hashCode() {
167:                return new HashCodeBuilder(17, 37)
168:                        .appendSuper(super .hashCode()).toHashCode();
169:            }
170:
171:            /**
172:             * adds a role descriptor to the Set
173:             * 
174:             * @param _roleDescriptor
175:             */
176:            public void addConcreteRoleDescriptor(
177:                    ConcreteRoleDescriptor _roleDesc) {
178:                this .concreteRoleDescriptors.add(_roleDesc);
179:                _roleDesc.setParticipant(this );
180:            }
181:
182:            /**
183:             * remove a RoleDescriptor
184:             * 
185:             * @param _roleDesc
186:             */
187:            public void removeConcreteRoleDescriptor(
188:                    ConcreteRoleDescriptor _roleDesc) {
189:                _roleDesc.setParticipant(null);
190:                this .concreteRoleDescriptors.remove(_roleDesc);
191:            }
192:
193:            /**
194:             * Remove all the role descriptors
195:             */
196:            public void removeAllConcreteRoleDescriptors() {
197:                for (ConcreteRoleDescriptor _roleD : this .concreteRoleDescriptors) {
198:                    _roleD.removeParticipant(this );
199:                }
200:                this .concreteRoleDescriptors.clear();
201:            }
202:
203:            /**
204:             * add participant to project
205:             * 
206:             * @param project
207:             *            the project to add to
208:             */
209:            public void addAffectedProject(Project project) {
210:                this .affectedProjectList.add(project);
211:                project.getParticipants().add(this );
212:            }
213:
214:            /**
215:             * remove a participant from a project
216:             * 
217:             * @param project
218:             *            the project to remove from
219:             */
220:            public void removeAffectedProject(Project project) {
221:                this .affectedProjectList.remove(project);
222:                project.getParticipants().remove(this );
223:            }
224:
225:            /**
226:             * remove the participant from all the project
227:             * 
228:             */
229:            public void removeAllAffectedProjects() {
230:                for (Project project : this .affectedProjectList) {
231:                    project.removeParticipant(this );
232:                }
233:                this .affectedProjectList.clear();
234:            }
235:
236:            /**
237:             * 
238:             * Add a managed project
239:             * 
240:             * @param project
241:             */
242:            public void addManagedProject(Project project) {
243:                this .managedProjects.add(project);
244:                project.setProjectManager(this );
245:            }
246:
247:            /**
248:             * 
249:             * Remove a managed project
250:             * 
251:             * @param project
252:             */
253:            public void removeManagedProject(Project project) {
254:                this .managedProjects.remove(project);
255:                project.setProjectManager(null);
256:            }
257:
258:            /**
259:             * 
260:             * Remove all managed projects
261:             * 
262:             */
263:            public void removeAllManagedProjects() {
264:                for (Project project : this .managedProjects) {
265:                    project.removeProjectManager(this );
266:                }
267:                this .managedProjects.clear();
268:            }
269:
270:            /* Getters & Setters */
271:
272:            /**
273:             * Getter of affectedProjectList.
274:             * 
275:             * @return the affectedProjectList.
276:             */
277:            public Set<Project> getAffectedProjectList() {
278:                return this .affectedProjectList;
279:            }
280:
281:            /**
282:             * Setter of affectedProjectList.
283:             * 
284:             * @param _affectedProjectList
285:             *            The affectedProjectList to set.
286:             */
287:            public void setAffectedProjectList(Set<Project> _affectedProjectList) {
288:                this .affectedProjectList = _affectedProjectList;
289:            }
290:
291:            /**
292:             * Getter of managedProjects.
293:             * 
294:             * @return the managedProjects.
295:             */
296:            public Set<Project> getManagedProjects() {
297:                return this .managedProjects;
298:            }
299:
300:            /**
301:             * Setter of managedProjects.
302:             * 
303:             * @param _managedProjects
304:             *            The managedProjects to set.
305:             */
306:            public void setManagedProjects(Set<Project> _managedProjects) {
307:                this .managedProjects = _managedProjects;
308:            }
309:
310:            /**
311:             * Getter of rolesListForAProject.
312:             * 
313:             * @return the rolesListForAProject.
314:             */
315:            public Set<ConcreteRoleDescriptor> getConcreteRoleDescriptors() {
316:                return this .concreteRoleDescriptors;
317:            }
318:
319:            /**
320:             * Setter of rolesListForAProject.
321:             * 
322:             * @param _rolesListForAProject
323:             *            The rolesListForAProject to set.
324:             */
325:            public void setConcreteRoleDescriptors(
326:                    Set<ConcreteRoleDescriptor> _concreteRoleDescriptors) {
327:                this .concreteRoleDescriptors = _concreteRoleDescriptors;
328:            }
329:
330:            /**
331:             * adds a concreteWorkProductDescriptor to the Set
332:             * 
333:             * @param _concreteWorkProductDescriptor
334:             */
335:            public boolean addConcreteWorkProductDescriptor(
336:                    ConcreteWorkProductDescriptor _concreteWorkProductDescriptor) {
337:                return concreteWorkProductDescriptors
338:                        .add(_concreteWorkProductDescriptor);
339:            }
340:
341:            /**
342:             * remove a concreteWorkProductDescriptor
343:             * 
344:             * @param _concreteWorkProductDescriptor
345:             */
346:            public void removeConcreteWorkProductDescriptor(
347:                    ConcreteWorkProductDescriptor _concreteWorkProductDescriptor) {
348:                this.concreteRoleDescriptors
349:                        .remove(_concreteWorkProductDescriptor);
350:            }
351:
352:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.