Source Code Cross Referenced for ConcreteRoleDescriptorService.java in  » Workflow-Engines » wilos » wilos » business » services » misc » concreterole » 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.business.services.misc.concreterole 
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:         * Copyright (C) Sebastien BALARD <sbalard@wilos-project.org>
005:         *
006:         * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
007:         * General Public License as published by the Free Software Foundation; either version 2 of the License,
008:         * or (at your option) any later version.
009:         *
010:         * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
011:         * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012:         * GNU General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU General Public License along with this program; if not,
015:         * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
016:         */
017:
018:        package wilos.business.services.misc.concreterole;
019:
020:        import java.util.ArrayList;
021:        import java.util.HashSet;
022:        import java.util.List;
023:        import java.util.Set;
024:
025:        import org.springframework.transaction.annotation.Propagation;
026:        import org.springframework.transaction.annotation.Transactional;
027:
028:        import wilos.business.services.misc.concreteactivity.ConcreteActivityService;
029:        import wilos.business.services.spem2.role.RoleDescriptorService;
030:        import wilos.hibernate.misc.concreteactivity.ConcreteActivityDao;
031:        import wilos.hibernate.misc.concreterole.ConcreteRoleDescriptorDao;
032:        import wilos.hibernate.misc.concretetask.ConcreteTaskDescriptorDao;
033:        import wilos.hibernate.misc.wilosuser.ParticipantDao;
034:        import wilos.hibernate.spem2.task.TaskDescriptorDao;
035:        import wilos.model.misc.concreteactivity.ConcreteActivity;
036:        import wilos.model.misc.concreterole.ConcreteRoleDescriptor;
037:        import wilos.model.misc.concretetask.ConcreteTaskDescriptor;
038:        import wilos.model.misc.wilosuser.Participant;
039:        import wilos.model.spem2.role.RoleDescriptor;
040:        import wilos.presentation.web.utils.WebSessionService;
041:
042:        @Transactional(readOnly=false,propagation=Propagation.REQUIRED)
043:        public class ConcreteRoleDescriptorService {
044:
045:            private ConcreteRoleDescriptorDao concreteRoleDescriptorDao;
046:
047:            private ConcreteActivityService concreteActivityService;
048:
049:            private RoleDescriptorService roleDescriptorService;
050:
051:            private ParticipantDao participantDao;
052:
053:            private ConcreteTaskDescriptorDao concreteTaskDescriptorDao;
054:
055:            /**
056:             * Allows to get the participant for a concreteRoleDescriptor
057:             * 
058:             * @param _concreteRoleDescriptor
059:             * @return the participant
060:             */
061:            public Participant getParticipant(
062:                    ConcreteRoleDescriptor _concreteRoleDescriptor) {
063:                this .getConcreteRoleDescriptorDao().getSessionFactory()
064:                        .getCurrentSession().saveOrUpdate(
065:                                _concreteRoleDescriptor);
066:                return _concreteRoleDescriptor.getParticipant();
067:            }
068:
069:            /**
070:             * Allows to save the concreteRoleDescriptor
071:             * 
072:             * @param _concreteRoleDescriptor
073:             */
074:            public void saveConcreteRoleDescriptor(
075:                    ConcreteRoleDescriptor _concreteRoleDescriptor) {
076:                this .concreteRoleDescriptorDao
077:                        .saveOrUpdateConcreteRoleDescriptor(_concreteRoleDescriptor);
078:            }
079:
080:            /**
081:             * Allows to get the list of all concreteRoleDecriptors
082:             * 
083:             * @return the list of all concreteRoleDecriptors
084:             */
085:            public List<ConcreteRoleDescriptor> getAllConcreteRoleDescriptors() {
086:                return this .getConcreteRoleDescriptorDao()
087:                        .getAllConcreteRoleDescriptors();
088:            }
089:
090:            /**
091:             * Allows to get the list of primary concreteTaskDescriptors for a
092:             * concreteRole id
093:             * 
094:             * @param _concreteRoleId
095:             * @return the list of primary concreteTaskDescriptors
096:             */
097:            public List<ConcreteTaskDescriptor> getPrimaryConcreteTaskDescriptors(
098:                    String _concreteRoleId) {
099:                return this .concreteRoleDescriptorDao
100:                        .getMainConcreteTaskDescriptorsForConcreteRoleDescriptor(_concreteRoleId);
101:            }
102:
103:            /**
104:             * Allows to get the set of primary concreteTaskDescriptors for a
105:             * concreteRoleDescriptor
106:             * 
107:             * @param _concreteRoleDescriptor
108:             * @return the set of primary concreteTaskDescriptors
109:             */
110:            public Set<ConcreteTaskDescriptor> getPrimaryConcreteTaskDescriptors(
111:                    ConcreteRoleDescriptor _concreteRoleDescriptor) {
112:                Set<ConcreteTaskDescriptor> concreteTaskDescriptors = new HashSet<ConcreteTaskDescriptor>();
113:                this .concreteRoleDescriptorDao.getSessionFactory()
114:                        .getCurrentSession().saveOrUpdate(
115:                                _concreteRoleDescriptor);
116:                this .concreteRoleDescriptorDao.getSessionFactory()
117:                        .getCurrentSession().refresh(_concreteRoleDescriptor);
118:                for (ConcreteTaskDescriptor concreteTaskDescriptor : _concreteRoleDescriptor
119:                        .getPrimaryConcreteTaskDescriptors()) {
120:                    concreteTaskDescriptors.add(concreteTaskDescriptor);
121:                }
122:                return concreteTaskDescriptors;
123:            }
124:
125:            /**
126:             * Allows to get the list of concreteTaskDesscriptors for a
127:             * concreteRoleDescriptor
128:             * 
129:             * @param _concreteRoleDescriptor
130:             * @return the list of concreteTaskDesscriptors
131:             */
132:            public List<ConcreteTaskDescriptor> getAllConcreteTaskDescriptorsForConcreteRoleDescriptor(
133:                    ConcreteRoleDescriptor _concreteRoleDescriptor) {
134:                return this .concreteRoleDescriptorDao
135:                        .getMainConcreteTaskDescriptorsForConcreteRoleDescriptor(_concreteRoleDescriptor
136:                                .getId());
137:            }
138:
139:            /**
140:             * Allows to get the list of super concreteActivities for a
141:             * concreteRoleDescriptor id
142:             * 
143:             * @param _crdid
144:             * @return
145:             */
146:            public List<ConcreteActivity> getSuperConcreteActivities(
147:                    String _crdid) {
148:                ConcreteRoleDescriptor crd = this 
149:                        .getConcreteRoleDescriptor(_crdid);
150:                List<ConcreteActivity> listTmp = this .concreteActivityService
151:                        .getAllConcreteActivities();
152:                List<ConcreteActivity> listToReturn = new ArrayList<ConcreteActivity>();
153:
154:                for (ConcreteActivity ca : listTmp) {
155:                    if (ca.getConcreteBreakdownElements().contains(crd)) {
156:                        listToReturn.add(ca);
157:                    }
158:                }
159:
160:                return listToReturn;
161:            }
162:
163:            /**
164:             * Allows to delete a concreteRoleDescriptor
165:             */
166:            public void removeConcreteRoleDescriptor(
167:                    ConcreteRoleDescriptor _concreteRoledescriptor) {
168:
169:                this .concreteRoleDescriptorDao.getSessionFactory()
170:                        .getCurrentSession().saveOrUpdate(
171:                                _concreteRoledescriptor);
172:
173:                // super activities automaintenance
174:                for (ConcreteActivity sca : _concreteRoledescriptor
175:                        .getSuperConcreteActivities()) {
176:                    sca.getConcreteBreakdownElements().remove(
177:                            _concreteRoledescriptor);
178:                    this .concreteActivityService.saveConcreteActivity(sca);
179:                }
180:
181:                // RoleDescriptor automaintenance
182:                RoleDescriptor rd = _concreteRoledescriptor.getRoleDescriptor();
183:                // flush current cached version of object rd
184:                this .roleDescriptorService.getRoleDescriptorDao()
185:                        .getSessionFactory().getCurrentSession().evict(rd);
186:                // get current instance
187:                this .roleDescriptorService.getRoleDescriptorDao()
188:                        .getSessionFactory().getCurrentSession().saveOrUpdate(
189:                                rd);
190:                // refresh collections
191:                this .roleDescriptorService.getRoleDescriptorDao()
192:                        .getSessionFactory().getCurrentSession().refresh(rd);
193:
194:                rd.removeConcreteRoleDescriptor(_concreteRoledescriptor);
195:                this .roleDescriptorService.getConcreteRoleDescriptorDao()
196:                        .getSessionFactory().getCurrentSession().delete(
197:                                _concreteRoledescriptor);
198:                this .roleDescriptorService.getRoleDescriptorDao()
199:                        .getSessionFactory().getCurrentSession().saveOrUpdate(
200:                                rd);
201:
202:            }
203:
204:            /**
205:             * Return concreteRoleDescriptor for a project list
206:             * 
207:             * @return list of concreteRoleDescriptors
208:             */
209:            public List<ConcreteRoleDescriptor> getAllConcreteRoleDescriptorsForProject(
210:                    String _projectId) {
211:                return this .getConcreteRoleDescriptorDao()
212:                        .getAllConcreteRoleDescriptorsForProject(_projectId);
213:            }
214:
215:            /**
216:             * Allows to get a concreteRoleDescriptor with its id
217:             * 
218:             * @param _id
219:             * @return concreteRoleDescriptor
220:             */
221:            public ConcreteRoleDescriptor getConcreteRoleDescriptor(String _id) {
222:                return this .concreteRoleDescriptorDao
223:                        .getConcreteRoleDescriptor(_id);
224:            }
225:
226:            /*
227:             * public String getConcreteRoleDescriptorName(String
228:             * _concreteRoleDescriptorId) { return
229:             * this.concreteRoleDescriptorDao.getConcreteRoleDescriptorName(_concreteRoleDescriptorId); }
230:             */
231:
232:            /**
233:             * Allows to get the concreteRoleDescriptorDao
234:             * 
235:             * @return concreteRoleDescriptorDao
236:             */
237:            public ConcreteRoleDescriptorDao getConcreteRoleDescriptorDao() {
238:                return concreteRoleDescriptorDao;
239:            }
240:
241:            /**
242:             * Allows to set the concreteRoleDescriptorDao
243:             * 
244:             * @param _concreteRoleDescriptorDao
245:             */
246:            public void setConcreteRoleDescriptorDao(
247:                    ConcreteRoleDescriptorDao _concreteRoleDescriptorDao) {
248:                this .concreteRoleDescriptorDao = _concreteRoleDescriptorDao;
249:            }
250:
251:            /**
252:             * Allows to get the concreteActivityService
253:             * 
254:             * @return the concretActivityService
255:             */
256:            public ConcreteActivityService getConcreteActivityService() {
257:                return concreteActivityService;
258:            }
259:
260:            /**
261:             * Allows to set the concreteActivityService
262:             * 
263:             * @param concretActivityService
264:             */
265:            public void setConcreteActivityService(
266:                    ConcreteActivityService _concreteActivityService) {
267:                this .concreteActivityService = _concreteActivityService;
268:            }
269:
270:            /**
271:             * Allows to get the list of concreteRoleDescriptor for a roleDescriptor
272:             * 
273:             * @param _roleDescriptorId
274:             * @return the list of concreteRoleDescriptor
275:             */
276:            public List<ConcreteRoleDescriptor> getAllConcreteRoleDescriptorForARoleDescriptor(
277:                    String _roleDescriptorId) {
278:                return this .concreteRoleDescriptorDao
279:                        .getAllConcreteRoleDescriptorsForARoleDescriptor(_roleDescriptorId);
280:            }
281:
282:            /**
283:             * Allows to get the roleDescriptorService
284:             * 
285:             * @return the roleDescriptorService
286:             */
287:            public RoleDescriptorService getRoleDescriptorService() {
288:                return roleDescriptorService;
289:            }
290:
291:            /**
292:             * Allows to set the roleDescriptorService
293:             * 
294:             * @param roleDescriptorService
295:             */
296:            public void setRoleDescriptorService(
297:                    RoleDescriptorService roleDescriptorService) {
298:                this .roleDescriptorService = roleDescriptorService;
299:            }
300:
301:            /**
302:             * Allows to create an out of process concrete role
303:             * 
304:             * @param _user,_ctd
305:             */
306:            public RoleDescriptor createOutOfProcessConcreteRoleDescriptor(
307:                    Participant _user, ConcreteTaskDescriptor _ctd) {
308:                RoleDescriptor rd = new RoleDescriptor();
309:                // rd.getRoleDefinition().getId();
310:
311:                rd.setPresentationName("No Role");
312:                rd.setIsOptional(true);
313:                rd.setIsPlanned(false);
314:                rd.setHasMultipleOccurrences(true);
315:
316:                rd.setGuid("No Role");
317:                rd.setDescription("outprocess role");
318:
319:                this .getRoleDescriptorService().saveRoleDescriptor(rd);
320:
321:                ConcreteRoleDescriptor crd = new ConcreteRoleDescriptor();
322:                // crd.setRoleDescriptor(rd);
323:                crd.addRoleDescriptor(rd);
324:                crd.addBreakdownElement(rd);
325:                crd.addPrimaryConcreteTaskDescriptor(_ctd);
326:                crd.setConcreteName(rd.getPresentationName() + "#1");
327:                crd.setInstanciationOrder(1);
328:                // TODO Wilos 2
329:                String projectId = (String) WebSessionService
330:                        .getAttribute(WebSessionService.PROJECT_ID);
331:
332:                crd.setProject(_ctd.getProject());
333:
334:                crd.setParticipant(_user);
335:
336:                this .saveConcreteRoleDescriptor(crd);
337:
338:                return rd;
339:
340:            }
341:
342:            /**
343:             * Allows to get the participantDao
344:             * 
345:             * @return the participantDao
346:             */
347:            public ParticipantDao getParticipantDao() {
348:                return participantDao;
349:            }
350:
351:            /**
352:             * Allows to set the participantDao
353:             * 
354:             * @param _participantDao
355:             */
356:            public void setParticipantDao(ParticipantDao _participantDao) {
357:                this .participantDao = _participantDao;
358:            }
359:
360:            /**
361:             * Allows to get the concreteTaskDescriptorDao
362:             * 
363:             * @return the concreteTaskDescriptorDao
364:             */
365:            public ConcreteTaskDescriptorDao getConcreteTaskDescriptorDao() {
366:                return concreteTaskDescriptorDao;
367:            }
368:
369:            /**
370:             * Allows to set the concreteTaskDescriptorDao
371:             * 
372:             * @param _concreteTaskDescriptorDao
373:             */
374:            public void setConcreteTaskDescriptorDao(
375:                    ConcreteTaskDescriptorDao _concreteTaskDescriptorDao) {
376:                this.concreteTaskDescriptorDao = _concreteTaskDescriptorDao;
377:            }
378:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.