Source Code Cross Referenced for ProjectBean.java in  » Workflow-Engines » wilos » wilos » presentation » web » project » 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.presentation.web.project 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
0003:         * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
0004:         * Copyright (C) 2007 Emilien PERICO <eperico@wilos-project.org>
0005:         * Copyright (C) 2007-2008 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
0006:         *
0007:         * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
0008:         * General Public License as published by the Free Software Foundation; either version 2 of the License,
0009:         * or (at your option) any later version.
0010:         *
0011:         * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
0012:         * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013:         * GNU General Public License for more details.
0014:         * 
0015:         * You should have received a copy of the GNU General Public License along with this program; if not,
0016:         * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
0017:         */
0018:        package wilos.presentation.web.project;
0019:
0020:        import java.text.DateFormat;
0021:        import java.text.SimpleDateFormat;
0022:        import java.util.ArrayList;
0023:        import java.util.Date;
0024:        import java.util.HashMap;
0025:        import java.util.Iterator;
0026:        import java.util.List;
0027:        import java.util.SortedSet;
0028:
0029:        import javax.faces.context.FacesContext;
0030:        import javax.faces.event.ActionEvent;
0031:        import javax.faces.event.ValueChangeEvent;
0032:        import javax.faces.model.SelectItem;
0033:
0034:        import org.apache.commons.logging.Log;
0035:        import org.apache.commons.logging.LogFactory;
0036:
0037:        import wilos.business.services.misc.concreteactivity.ConcreteActivityService;
0038:        import wilos.business.services.misc.concreterole.ConcreteRoleDescriptorService;
0039:        import wilos.business.services.misc.concretetask.ConcreteTaskDescriptorService;
0040:        import wilos.business.services.misc.project.ProjectService;
0041:        import wilos.business.services.misc.wilosuser.ParticipantService;
0042:        import wilos.business.services.misc.wilosuser.ProjectDirectorService;
0043:        import wilos.business.services.spem2.activity.ActivityService;
0044:        import wilos.business.services.spem2.breakdownelement.BreakdownElementService;
0045:        import wilos.business.services.spem2.process.ProcessService;
0046:        import wilos.business.services.spem2.role.RoleDescriptorService;
0047:        import wilos.business.services.spem2.task.TaskDescriptorService;
0048:        import wilos.model.misc.concreteactivity.ConcreteActivity;
0049:        import wilos.model.misc.concretebreakdownelement.ConcreteBreakdownElement;
0050:        import wilos.model.misc.concretetask.ConcreteTaskDescriptor;
0051:        import wilos.model.misc.project.Project;
0052:        import wilos.model.misc.wilosuser.Participant;
0053:        import wilos.model.misc.wilosuser.ProjectDirector;
0054:        import wilos.model.spem2.process.Process;
0055:        import wilos.model.spem2.role.RoleDescriptor;
0056:        import wilos.model.spem2.task.TaskDescriptor;
0057:        import wilos.presentation.web.tree.TreeBean;
0058:        import wilos.presentation.web.utils.WebCommonService;
0059:        import wilos.presentation.web.utils.WebSessionService;
0060:        import wilos.resources.WilosBundle;
0061:
0062:        /**
0063:         * Managed-Bean link to project_create.jspx
0064:         * 
0065:         */
0066:        public class ProjectBean {
0067:
0068:            private ProjectService projectService;
0069:
0070:            private ProcessService processService;
0071:
0072:            private ParticipantService participantService;
0073:
0074:            private ProjectDirectorService projectDirectorService;
0075:
0076:            private RoleDescriptorService roleDescriptorService;
0077:
0078:            private ConcreteTaskDescriptorService concreteTaskDescriptorService;
0079:
0080:            private ConcreteRoleDescriptorService concreteRoleDescriptorService;
0081:
0082:            private ConcreteActivityService concreteActivityService;
0083:
0084:            private Project project;
0085:
0086:            // TODO utile ?
0087:            private TreeBean treeBean;
0088:
0089:            private String selectedProcessGuid;
0090:
0091:            private ArrayList<SelectItem> processNamesList;
0092:
0093:            private List<HashMap<String, Object>> projectList;
0094:
0095:            private List<Project> projectListWithoutProcess = new ArrayList<Project>();
0096:
0097:            private List<Project> projectListWithProcess = new ArrayList<Project>();
0098:
0099:            public static final String MODIFY_ICON = "images/modify.gif";
0100:
0101:            private static final String PROCESS_NULL = "projectProcesses_null";
0102:
0103:            private static final String PROCESS_NOT_NULL = "projectProcesses_not_null";
0104:
0105:            private boolean visiblePopup = false;
0106:
0107:            protected final Log logger = LogFactory.getLog(this .getClass());
0108:
0109:            @SuppressWarnings("unused")
0110:            private SimpleDateFormat formatter;
0111:
0112:            private String selectProcessAffectation;
0113:
0114:            private String processName;
0115:
0116:            private String projectListView;
0117:
0118:            private String processesListView;
0119:
0120:            private String projectId;
0121:
0122:            private boolean displayCreateButton;
0123:
0124:            private boolean newProject;
0125:
0126:            private String selectedConcreteActivityForNewRoleId = "default";
0127:
0128:            private String selectedTaskDescriptorId = "default";
0129:
0130:            private boolean addRoleRendered = false;
0131:
0132:            private String newRoleName;
0133:
0134:            private String newRoleDescription;
0135:
0136:            private boolean visibleTaskComboBox = false;
0137:
0138:            private boolean isVisibleNewTaskPanel = false;
0139:
0140:            /**
0141:             * Constructor.
0142:             * 
0143:             */
0144:            public ProjectBean() {
0145:                this .project = new Project();
0146:                this .selectedProcessGuid = "";
0147:                this .processNamesList = new ArrayList<SelectItem>();
0148:                this .formatter = new SimpleDateFormat("dd/MM/yyyy");
0149:                this .displayCreateButton = true;
0150:            }
0151:
0152:            /* Manage the popup. */
0153:
0154:            /**
0155:             * This method allow to print the right message when an user want to delete
0156:             * the selected project
0157:             * 
0158:             * @param event
0159:             */
0160:            public void confirmDelete(ActionEvent event) {
0161:                if (this .projectService.deleteProject(this .projectId))
0162:                    WebCommonService.addInfoMessage(WilosBundle
0163:                            .getText("component.projectcreate.deleteSuccess"));
0164:                else
0165:                    WebCommonService.addErrorMessage(WilosBundle
0166:                            .getText("component.projectcreate.deleteError"));
0167:
0168:                this .visiblePopup = false;
0169:                displayCreateButton = true;
0170:            }
0171:
0172:            /**
0173:             * This method fixed the visiblePopup boolean attribute to false
0174:             * 
0175:             * @param event
0176:             */
0177:            public void cancelDelete(ActionEvent event) {
0178:                this .visiblePopup = false;
0179:            }
0180:
0181:            /* Others */
0182:
0183:            /**
0184:             * Method for creating a new project
0185:             * 
0186:             * @return nothing
0187:             */
0188:            public void createNewProject(ActionEvent e) {
0189:                displayCreateButton = false;
0190:                String user_id = (String) WebSessionService
0191:                        .getAttribute(WebSessionService.WILOS_USER_ID);
0192:                ProjectDirector pd = this .projectDirectorService
0193:                        .getProjectDirector(user_id);
0194:                this .project.setProjectDirector(pd);
0195:                this .project.setDisplayOrder("0");
0196:                this .projectService.saveProject(this .project);
0197:                this .newProject = true;
0198:                // active edit
0199:                String projectId = this .project.getId();
0200:                for (HashMap<String, Object> projectDescription : getProjectList()) {
0201:                    if (((String) projectDescription.get("id"))
0202:                            .equals(projectId)) {
0203:                        projectDescription.put("isEditable", new Boolean(true));
0204:                    }
0205:                }
0206:                // delete the focus on the new create project
0207:                this .project = new Project();
0208:            }
0209:
0210:            /**
0211:             * 
0212:             * Editing a project
0213:             * 
0214:             * @param e
0215:             *                event received when a user clicks on edit button in the
0216:             *                datatable
0217:             */
0218:            public void editProject(ActionEvent e) {
0219:
0220:                String projectId = (String) FacesContext.getCurrentInstance()
0221:                        .getExternalContext().getRequestParameterMap().get(
0222:                                "projectEditId");
0223:
0224:                // project director of the selected project
0225:                Project selectedProject = this .projectService
0226:                        .getProject(projectId);
0227:                String projectDirectorId = selectedProject.getProjectDirector()
0228:                        .getId();
0229:
0230:                if (isActionAllowedForThePD(projectDirectorId)) {
0231:                    for (HashMap<String, Object> projectDescription : projectList) {
0232:                        if (((String) projectDescription.get("id"))
0233:                                .equals(projectId)) {
0234:                            projectDescription.put("isEditable", new Boolean(
0235:                                    true));
0236:                        }
0237:                    }
0238:                }
0239:            }
0240:
0241:            /**
0242:             * Private method to check permissions (delete and edit) for a given project
0243:             * director
0244:             * 
0245:             * @param projectDirectorId
0246:             * @return boolean true if the project director is allowed to manage the
0247:             *         selected project
0248:             */
0249:            private boolean isActionAllowedForThePD(String projectDirectorId) {
0250:                // user from session
0251:                String userId = (String) WebSessionService
0252:                        .getAttribute(WebSessionService.WILOS_USER_ID);
0253:
0254:                if (userId.equals(projectDirectorId)) {
0255:                    return true;
0256:                } else {
0257:                    WebCommonService.addInfoMessage(WilosBundle
0258:                            .getText("component.projectcreate.notallowed"));
0259:                    return false;
0260:                }
0261:            }
0262:
0263:            /**
0264:             * 
0265:             * Saving new project
0266:             * 
0267:             * @param e
0268:             *                event received when a user clicks on save button in the
0269:             *                datatable
0270:             */
0271:            @SuppressWarnings("unchecked")
0272:            public void saveProject(ActionEvent e) {
0273:                String projectId = (String) FacesContext.getCurrentInstance()
0274:                        .getExternalContext().getRequestParameterMap().get(
0275:                                "projectSaveId");
0276:                Project project = projectService.getProjectDao().getProject(
0277:                        projectId);
0278:
0279:                for (Iterator iter = this .getProjectList().iterator(); iter
0280:                        .hasNext();) {
0281:
0282:                    HashMap<String, Object> projectDescription = (HashMap<String, Object>) iter
0283:                            .next();
0284:
0285:                    if (((String) projectDescription.get("id"))
0286:                            .equals(projectId)) {
0287:
0288:                        String projectName = (String) projectDescription
0289:                                .get("projectName");
0290:
0291:                        // format the dates to compare both
0292:                        DateFormat formatter = new SimpleDateFormat(
0293:                                "yyyy-MM-dd");
0294:                        String launchingDate = formatter
0295:                                .format(projectDescription.get("launchingDate"));
0296:                        String creatingDate = formatter
0297:                                .format(projectDescription.get("creationDate"));
0298:
0299:                        if (projectName.trim().length() == 0) {
0300:                            projectDescription.put("projectName", project
0301:                                    .getConcreteName());
0302:                            WebCommonService
0303:                                    .addInfoMessage(WilosBundle
0304:                                            .getText("component.projectList.message.invalidName"));
0305:                        } else if (this .projectNameAlreadyExists(projectName,
0306:                                projectId)) {
0307:                            projectDescription.put("projectName", project
0308:                                    .getConcreteName());
0309:                            WebCommonService
0310:                                    .addInfoMessage(WilosBundle
0311:                                            .getText("component.projectList.message.nameAlreadyExists"));
0312:                        } else if (creatingDate.compareTo(launchingDate) > 0) {
0313:                            WebCommonService
0314:                                    .addInfoMessage(WilosBundle
0315:                                            .getText("component.projectList.message.invalidlaunchingdate"));
0316:                        } else {
0317:                            project.setConcreteName(projectName);
0318:                            project.setLaunchingDate((Date) projectDescription
0319:                                    .get("launchingDate"));
0320:                            project.setDescription((String) projectDescription
0321:                                    .get("description"));
0322:
0323:                            projectService.getProjectDao().saveOrUpdateProject(
0324:                                    project);
0325:                            projectDescription.put("isEditable", new Boolean(
0326:                                    false));
0327:                            displayCreateButton = true;
0328:
0329:                            if (this .newProject) {
0330:                                WebCommonService
0331:                                        .addInfoMessage(WilosBundle
0332:                                                .getText("component.projectcreate.success"));
0333:                            } else {
0334:                                WebCommonService
0335:                                        .addInfoMessage(WilosBundle
0336:                                                .getText("component.projectcreate.modificationSuccess"));
0337:                            }
0338:                            this .newProject = false;
0339:                        }
0340:                        break;
0341:                    }
0342:                }
0343:            }
0344:
0345:            /**
0346:             * this method allow to search if the given projectName 
0347:             * for the given Project is already existing in the database
0348:             * 
0349:             * @param _presentationName
0350:             * @param _processId
0351:             * @return boolean
0352:             */
0353:
0354:            private boolean projectNameAlreadyExists(String _projectName,
0355:                    String _projectId) {
0356:                for (Project project : projectService.getAllProjects()) {
0357:                    if (project.getConcreteName().equals(_projectName)
0358:                            && !_projectId.equals(project.getId())) {
0359:                        return true;
0360:                    }
0361:                }
0362:                return false;
0363:            }
0364:
0365:            // ================================================ Getters & Setters
0366:            // ===================================================
0367:
0368:            /**
0369:             * Getter of project.
0370:             * 
0371:             * @return the project.
0372:             */
0373:            public Project getProject() {
0374:                return this .project;
0375:            }
0376:
0377:            /**
0378:             * Setter of project.
0379:             * 
0380:             * @param _project
0381:             *                The project to set.
0382:             */
0383:            public void setProject(Project _project) {
0384:                this .project = _project;
0385:            }
0386:
0387:            /**
0388:             * Getter of projectService.
0389:             * 
0390:             * @return the projectService.
0391:             */
0392:            public ProjectService getProjectService() {
0393:                return this .projectService;
0394:            }
0395:
0396:            /**
0397:             * Setter of projectService.
0398:             * 
0399:             * @param _projectService
0400:             *                The projectService to set.
0401:             */
0402:            public void setProjectService(ProjectService _projectService) {
0403:                this .projectService = _projectService;
0404:            }
0405:
0406:            /**
0407:             * Return all the Projects
0408:             * 
0409:             * @return A set of Project
0410:             */
0411:            public List<Project> getAllProjects() {
0412:                return this .projectService.getAllProjects();
0413:            }
0414:
0415:            /**
0416:             * this method return all project without a Process 
0417:             * 
0418:             * @return a List of Project
0419:             */
0420:            public List<Project> getProjectListWithoutProcess() {
0421:                this .projectListWithoutProcess = new ArrayList<Project>();
0422:                this .projectListWithoutProcess.addAll(this .projectService
0423:                        .getAllProjectsWithNoProcess());
0424:                return projectListWithoutProcess;
0425:            }
0426:
0427:            /**
0428:             * setter of projectListWithoutProcess List<Project> attribute
0429:             * 
0430:             * @param projectListWithoutProcess
0431:             */
0432:            public void setProjectListWithoutProcess(
0433:                    List<Project> projectListWithoutProcess) {
0434:                this .projectListWithoutProcess = projectListWithoutProcess;
0435:            }
0436:
0437:            /**
0438:             * this method return all the project with a process 
0439:             * instantiation 
0440:             * 
0441:             * @return a List<Project> of Project
0442:             */
0443:            public List<Project> getProjectListWithProcess() {
0444:                this .projectListWithProcess = new ArrayList<Project>();
0445:                this .projectListWithProcess.addAll(this .projectService
0446:                        .getAllProjectsWithProcess());
0447:                return projectListWithProcess;
0448:            }
0449:
0450:            /**
0451:             * setter of setProjectListWithProcess List<Project> attribute
0452:             * 
0453:             * @param projectListWithProcess
0454:             */
0455:            public void setProjectListWithProcess(
0456:                    List<Project> projectListWithProcess) {
0457:                this .projectListWithProcess = projectListWithProcess;
0458:            }
0459:
0460:            /**
0461:             * Getter of processNamesList.
0462:             * 
0463:             * @return the processNamesList.
0464:             */
0465:            public ArrayList<SelectItem> getProcessNamesList() {
0466:                ArrayList<SelectItem> tmpListNames = new ArrayList<SelectItem>();
0467:                ArrayList<wilos.model.spem2.process.Process> tmpListProcess = (ArrayList<wilos.model.spem2.process.Process>) this .processService
0468:                        .getAllProcesses();
0469:
0470:                for (int i = 0; i < tmpListProcess.size(); i++) {
0471:                    tmpListNames.add(new SelectItem(tmpListProcess.get(i)
0472:                            .getGuid(), tmpListProcess.get(i)
0473:                            .getPresentationName()));
0474:                }
0475:                processNamesList = tmpListNames;
0476:                return this .processNamesList;
0477:            }
0478:
0479:            /**
0480:             * Setter of processNamesList.
0481:             * 
0482:             * @param _processNamesList
0483:             *                The processNamesList to set.
0484:             */
0485:            public void setProcessNamesList(
0486:                    ArrayList<SelectItem> _processNamesList) {
0487:                this .processNamesList = _processNamesList;
0488:            }
0489:
0490:            /**
0491:             * Getter of processService.
0492:             * 
0493:             * @return the processService.
0494:             */
0495:            public ProcessService getProcessService() {
0496:                return this .processService;
0497:            }
0498:
0499:            /**
0500:             * Setter of processService.
0501:             * 
0502:             * @param _processService
0503:             *                The processService to set.
0504:             */
0505:            public void setProcessService(ProcessService _processService) {
0506:                this .processService = _processService;
0507:            }
0508:
0509:            /**
0510:             * Getter of selectedProcessGuid.
0511:             * 
0512:             * @return the selectedProcessGuid.
0513:             */
0514:            public String getSelectedProcessGuid() {
0515:                // Getting the current projet id from cession
0516:                String tmpProjId = (String) WebSessionService
0517:                        .getAttribute(WebSessionService.PROJECT_ID);
0518:                if (tmpProjId != null) {
0519:                    Project projTmp = projectService.getProject(tmpProjId);
0520:                    if (projTmp != null) {
0521:                        Process procTmp = projTmp.getProcess();
0522:                        if (procTmp != null) {
0523:                            this .selectedProcessGuid = projTmp.getProcess()
0524:                                    .getGuid();
0525:                        }
0526:                    }
0527:                }
0528:                return this .selectedProcessGuid;
0529:            }
0530:
0531:            /**
0532:             * Setter of selectedProcessGuid.
0533:             * 
0534:             * @param _selectedProcessGuid
0535:             *                The selectedProcessGuid to set.
0536:             */
0537:            public void setSelectedProcessGuid(String _selectedProcessGuid) {
0538:                this .selectedProcessGuid = _selectedProcessGuid;
0539:            }
0540:
0541:            /**
0542:             * this method allow to return a String.
0543:             * this string indicate if the selected project 
0544:             * has an instanciation process
0545:             * 
0546:             * @return the selectProcessAffectation
0547:             */
0548:            public String getSelectProcessAffectation() {
0549:                String tmpProjId = (String) WebSessionService
0550:                        .getAttribute(WebSessionService.PROJECT_ID);
0551:                Project currentProject = this .projectService
0552:                        .getProject(tmpProjId);
0553:
0554:                String participantId = (String) WebSessionService
0555:                        .getAttribute(WebSessionService.WILOS_USER_ID);
0556:                Participant participant = this .participantService
0557:                        .getParticipant(participantId);
0558:                if (currentProject.getProcess() == null) {
0559:                    if (currentProject.getProjectManager() != null) {
0560:                        if (currentProject.getProjectManager().getId().equals(
0561:                                participant.getId())) {
0562:                            this .selectProcessAffectation = "process_affectation_view";
0563:                        } else {
0564:                            this .selectProcessAffectation = "no_process_affectation_view";
0565:                        }
0566:                    } else {
0567:                        this .selectProcessAffectation = "no_process_affectation_view";
0568:                    }
0569:                } else {
0570:                    this .setProcessName(currentProject.getProcess()
0571:                            .getPresentationName());
0572:                    this .selectProcessAffectation = "selected_process_view";
0573:                }
0574:                return this .selectProcessAffectation;
0575:            }
0576:
0577:            /**
0578:             * delete a participant selected
0579:             * 
0580:             */
0581:            public void deleteProject(ActionEvent event) {
0582:
0583:                String selectedProjectId = (String) FacesContext
0584:                        .getCurrentInstance().getExternalContext()
0585:                        .getRequestParameterMap().get("projectId");
0586:
0587:                // project director of the selected project
0588:                Project selectedProject = this .projectService
0589:                        .getProject(selectedProjectId);
0590:                String projectDirectorId = selectedProject.getProjectDirector()
0591:                        .getId();
0592:
0593:                if (isActionAllowedForThePD(projectDirectorId)) {
0594:                    this .projectId = selectedProjectId;
0595:                    this .visiblePopup = true;
0596:                }
0597:            }
0598:
0599:            /**
0600:             * setter of selectProcessAffectation String attribute
0601:             * 
0602:             * @param selectProcessAffectation
0603:             *                the selectProcessAffectation to set
0604:             */
0605:            public void setSelectProcessAffectation(
0606:                    String selectProcessAffectation) {
0607:                this .selectProcessAffectation = selectProcessAffectation;
0608:            }
0609:
0610:            /**
0611:             * getter of processName String attribute
0612:             * 
0613:             * @return the processName
0614:             */
0615:            public String getProcessName() {
0616:                return processName;
0617:            }
0618:
0619:            /**
0620:             * setter of processName String attribute
0621:             * 
0622:             * @param processName
0623:             *                the processName to set
0624:             */
0625:            public void setProcessName(String processName) {
0626:                this .processName = processName;
0627:            }
0628:
0629:            /**
0630:             * Setter of projectListView.
0631:             * 
0632:             * @param _projectListView
0633:             *                The projectListView to set.
0634:             */
0635:            public void setSelectAffectedProjectView(String _projectListView) {
0636:                this .projectListView = _projectListView;
0637:            }
0638:
0639:            /**
0640:             * this method allow to return the current instance of
0641:             * ParticipantService
0642:             * 
0643:             * @return the participantService
0644:             */
0645:            public ParticipantService getParticipantService() {
0646:                return this .participantService;
0647:            }
0648:
0649:            /**
0650:             * Setter of participantService.
0651:             * 
0652:             * @param _participantService
0653:             *                The participantService to set.
0654:             */
0655:            public void setParticipantService(
0656:                    ParticipantService _participantService) {
0657:                this .participantService = _participantService;
0658:            }
0659:
0660:            /**
0661:             * Getter of projectListView
0662:             * 
0663:             * @return the projectListView.
0664:             */
0665:            public String getProjectListView() {
0666:                if (this .getProjectList().size() == 0) {
0667:                    this .projectListView = "projectsListPanelGroup_null";
0668:                } else {
0669:                    this .projectListView = "projectsListPanelGroup_not_null";
0670:                }
0671:                return this .projectListView;
0672:            }
0673:
0674:            /**
0675:             * Setter of projectListView.
0676:             * 
0677:             * @param _projectListView
0678:             *                The projectListView to set.
0679:             */
0680:            public void setProjectListView(String _projectListView) {
0681:                this .projectListView = _projectListView;
0682:            }
0683:
0684:            /**
0685:             * Getter of processesListView.
0686:             * 
0687:             * @return the processesListView.
0688:             */
0689:            public String getProcessesListView() {
0690:                if (this .getProcessNamesList().size() == 0) {
0691:                    this .processesListView = PROCESS_NULL;
0692:                } else {
0693:                    this .processesListView = PROCESS_NOT_NULL;
0694:                }
0695:                return this .processesListView;
0696:            }
0697:
0698:            /**
0699:             * Setter of processesListView.
0700:             * 
0701:             * @param _processesListView
0702:             *                The processesListView to set.
0703:             */
0704:            public void setProcessesListView(String _processesListView) {
0705:                this .processesListView = _processesListView;
0706:            }
0707:
0708:            /**
0709:             * this method allow to return the current instance of
0710:             * ProjectDirectorService
0711:             * 
0712:             * @return the projectDirectorService
0713:             */
0714:            public ProjectDirectorService getProjectDirectorService() {
0715:                return projectDirectorService;
0716:            }
0717:
0718:            /**
0719:             * this method allow to set the current instance of
0720:             * ProjectDirectorService
0721:             * 
0722:             * @param projectDirectorService
0723:             *                the projectDirectorService to set
0724:             */
0725:            public void setProjectDirectorService(
0726:                    ProjectDirectorService projectDirectorService) {
0727:                this .projectDirectorService = projectDirectorService;
0728:            }
0729:
0730:            /**
0731:             * getter of visiblePopup boolean attribute
0732:             * 
0733:             * @return the visiblePopup
0734:             */
0735:            public boolean getVisiblePopup() {
0736:                return this .visiblePopup;
0737:            }
0738:
0739:            /**
0740:             * setter of visiblePopup boolean attribute
0741:             * 
0742:             * @param visiblePopup
0743:             *                the visiblePopup to set
0744:             */
0745:            public void setVisiblePopup(boolean _visiblePopup) {
0746:                this .visiblePopup = _visiblePopup;
0747:            }
0748:
0749:            /**
0750:             * this method return all the Project store in database
0751:             * 
0752:             * @return an HashMap List of project
0753:             */
0754:            public List<HashMap<String, Object>> getProjectList() {
0755:
0756:                if (projectList == null
0757:                        || projectList.size() != projectService
0758:                                .getAllProjects().size()) {
0759:                    projectList = new ArrayList<HashMap<String, Object>>();
0760:
0761:                    for (Project project : projectService
0762:                            .getAllSortedProjects()) {
0763:                        HashMap<String, Object> projectDescription = new HashMap<String, Object>();
0764:                        projectDescription.put("id", project.getId());
0765:                        projectDescription.put("projectName", project
0766:                                .getConcreteName());
0767:                        projectDescription.put("creationDate", project
0768:                                .getCreationDate());
0769:                        projectDescription.put("launchingDate", project
0770:                                .getLaunchingDate());
0771:                        projectDescription.put("description", project
0772:                                .getDescription());
0773:                        projectDescription
0774:                                .put("isEditable", new Boolean(false));
0775:
0776:                        if (project.getProjectDirector() != null) {
0777:                            project
0778:                                    .setProjectDirector(this .projectDirectorService
0779:                                            .getProjectDirector(project
0780:                                                    .getProjectDirector()
0781:                                                    .getId()));
0782:                            projectDescription.put("owner", project
0783:                                    .getProjectDirector().getFirstname()
0784:                                    + " "
0785:                                    + project.getProjectDirector().getName());
0786:                        }
0787:                        projectList.add(projectDescription);
0788:                    }
0789:                }
0790:                return projectList;
0791:            }
0792:
0793:            /**
0794:             * setter of projectList List<HashMap<String, Object>> attribute
0795:             * 
0796:             * @param _projectList
0797:             */
0798:            public void setProjectList(
0799:                    List<HashMap<String, Object>> _projectList) {
0800:                this .projectList = _projectList;
0801:            }
0802:
0803:            /**
0804:             * getter of displayCreateButton boolean attribute
0805:             * 
0806:             * @return boolean
0807:             */
0808:            public boolean isDisplayCreateButton() {
0809:                return displayCreateButton;
0810:            }
0811:
0812:            /**
0813:             * setter of displayCreateButton boolean attribute
0814:             * 
0815:             * @param _displayCreateButton
0816:             */
0817:            public void setDisplayCreateButton(boolean _displayCreateButton) {
0818:                this .displayCreateButton = _displayCreateButton;
0819:            }
0820:
0821:            /**
0822:             * getter of newProject boolean attribute
0823:             * 
0824:             * @return boolean
0825:             */
0826:            public boolean isNewProject() {
0827:                return newProject;
0828:            }
0829:
0830:            /**
0831:             * setter of newProject boolean attribute
0832:             * 
0833:             * @param _newProject
0834:             */
0835:            public void setNewProject(boolean _newProject) {
0836:                this .newProject = _newProject;
0837:            }
0838:
0839:            /**
0840:             * this method allow to return the current instance of
0841:             * RoleDescriptorService
0842:             * 
0843:             * @return RoleDescriptorService
0844:             */
0845:            public RoleDescriptorService getRoleDescriptorService() {
0846:                return roleDescriptorService;
0847:            }
0848:
0849:            /**
0850:             * this method allow to set the current instance of
0851:             * RoleDescriptorService
0852:             * 
0853:             * @param _roleDescriptorService
0854:             */
0855:            public void setRoleDescriptorService(
0856:                    RoleDescriptorService _roleDescriptorService) {
0857:                roleDescriptorService = _roleDescriptorService;
0858:            }
0859:
0860:            /**
0861:             * this method allow to return the current instance of
0862:             * ConcreteTaskDescriptorService
0863:             * 
0864:             * @return ConcreteTaskDescriptorService
0865:             */
0866:            public ConcreteTaskDescriptorService getConcreteTaskDescriptorService() {
0867:                return concreteTaskDescriptorService;
0868:            }
0869:
0870:            /**
0871:             * this method allow to set the current instance of
0872:             * ConcreteTaskDescriptorService
0873:             * 
0874:             * @param _concreteTaskDescriptorService
0875:             */
0876:            public void setConcreteTaskDescriptorService(
0877:                    ConcreteTaskDescriptorService _concreteTaskDescriptorService) {
0878:                concreteTaskDescriptorService = _concreteTaskDescriptorService;
0879:            }
0880:
0881:            /**
0882:             * this method allow to return the current instance of
0883:             * ConcreteRoleDescriptorService
0884:             * 
0885:             * @return ConcreteRoleDescriptorService
0886:             */
0887:            public ConcreteRoleDescriptorService getConcreteRoleDescriptorService() {
0888:                return concreteRoleDescriptorService;
0889:            }
0890:
0891:            /**
0892:             * this method allow to set the current instance of
0893:             * ConcreteRoleDescriptorService
0894:             * 
0895:             * @param concreteRoleDescriptorService
0896:             */
0897:            public void setConcreteRoleDescriptorService(
0898:                    ConcreteRoleDescriptorService concreteRoleDescriptorService) {
0899:                this .concreteRoleDescriptorService = concreteRoleDescriptorService;
0900:            }
0901:
0902:            /**
0903:             * this method allow to return the current instance of
0904:             * ConcreteActivityService
0905:             * 
0906:             * @return ConcreteActivityService
0907:             */
0908:            public ConcreteActivityService getConcreteActivityService() {
0909:                return concreteActivityService;
0910:            }
0911:
0912:            /**
0913:             * this method allow to set the current instance of
0914:             * ConcreteActivityService
0915:             * 
0916:             * @param concreteActivityService
0917:             */
0918:            public void setConcreteActivityService(
0919:                    ConcreteActivityService concreteActivityService) {
0920:                this .concreteActivityService = concreteActivityService;
0921:            }
0922:
0923:            /**
0924:             * getter of treeBean Treebean attribute
0925:             * 
0926:             * @return the treeBean
0927:             */
0928:            public TreeBean getTreeBean() {
0929:                return this .treeBean;
0930:            }
0931:
0932:            /**
0933:             * Setter of treeBean.
0934:             * 
0935:             * @param _treeBean
0936:             *                The treeBean to set.
0937:             */
0938:            public void setTreeBean(TreeBean _treeBean) {
0939:                this .treeBean = _treeBean;
0940:            }
0941:
0942:            /**
0943:             * ChangeListener on the Combobox including the concrete activities
0944:             * 
0945:             * @param e
0946:             */
0947:            public void changeConcreteActivitiesListenerForNewRole(
0948:                    ValueChangeEvent evt) {
0949:                this .selectedConcreteActivityForNewRoleId = (String) evt
0950:                        .getNewValue();
0951:
0952:                this .addRoleRendered = false;
0953:
0954:                this .visibleTaskComboBox = !(this .selectedConcreteActivityForNewRoleId
0955:                        .equals("default"));
0956:
0957:            }
0958:
0959:            /**
0960:             * Give all the tasks save in the database for the given process
0961:             * 
0962:             * @return List<SelectItem> of task
0963:             */
0964:            public List<SelectItem> getTasks() {
0965:
0966:                List<SelectItem> tasksList = new ArrayList<SelectItem>();
0967:
0968:                SelectItem itemNoTask = new SelectItem(
0969:                        "no_task",
0970:                        WilosBundle
0971:                                .getText("component.project.rolesinstanciation.noTasks"));
0972:
0973:                SelectItem itemDefault = new SelectItem(
0974:                        "default",
0975:                        WilosBundle
0976:                                .getText("component.project.rolesinstanciation.concreteTasksComboBox"));
0977:
0978:                tasksList.add(itemDefault);
0979:                tasksList.add(itemNoTask);
0980:
0981:                Project project = this .projectService
0982:                        .getProject((String) WebSessionService
0983:                                .getAttribute(WebSessionService.PROJECT_ID));
0984:
0985:                ConcreteActivity cact = this .concreteActivityService
0986:                        .getConcreteActivity(this .selectedConcreteActivityForNewRoleId);
0987:
0988:                if (project != null) {
0989:                    Process process = project.getProcess();
0990:                    if (process != null) {
0991:
0992:                        if (!this .selectedConcreteActivityForNewRoleId
0993:                                .equals("default")) {
0994:                            SortedSet<ConcreteBreakdownElement> concreteBDE = this .concreteActivityService
0995:                                    .getConcreteBreakdownElements(cact);
0996:                            for (ConcreteBreakdownElement cbde : concreteBDE) {
0997:                                if (cbde instanceof  ConcreteTaskDescriptor) {
0998:                                    ConcreteTaskDescriptor ctd = (ConcreteTaskDescriptor) cbde;
0999:                                    if (ctd.getTaskDescriptor().getMainRole() == null) {
1000:                                        tasksList
1001:                                                .add(new SelectItem(
1002:                                                        ctd.getId(),
1003:                                                        ctd.getConcreteName()));
1004:                                    }
1005:
1006:                                }
1007:                            }
1008:
1009:                        }
1010:                    }
1011:                }
1012:
1013:                return tasksList;
1014:            }
1015:
1016:            /**
1017:             * this method allow to keep the selected task in the 
1018:             * selectedTaskDescriptorId attribute
1019:             * 
1020:             * @param evt
1021:             */
1022:            public void changeTasksListener(ValueChangeEvent evt) {
1023:                this .selectedTaskDescriptorId = (String) evt.getNewValue();
1024:
1025:                if (!this .selectedConcreteActivityForNewRoleId
1026:                        .equals("default")) {
1027:                    this .addRoleRendered = true;
1028:                } else {
1029:                    this .addRoleRendered = false;
1030:                }
1031:
1032:            }
1033:
1034:            /**
1035:             * Getter of selectedTaskDescriptorId.
1036:             * 
1037:             * @return the selectedTaskDescriptorId.
1038:             */
1039:            public String getSelectedTaskDescriptorId() {
1040:                return selectedTaskDescriptorId;
1041:            }
1042:
1043:            /**
1044:             * Setter of selectedTaskDescriptorId.
1045:             * 
1046:             * @param _selectedTaskDescriptorId
1047:             *                The selectedTaskDescriptorId to set.
1048:             */
1049:            public void setSelectedTaskDescriptorId(
1050:                    String _selectedTaskDescriptorId) {
1051:                this .selectedTaskDescriptorId = _selectedTaskDescriptorId;
1052:            }
1053:
1054:            /**
1055:             * getter of newRoleName String attribute
1056:             * 
1057:             * @return String
1058:             */
1059:            public String getNewRoleName() {
1060:                return this .newRoleName;
1061:            }
1062:
1063:            /**
1064:             * setter of newRoleName String attribute
1065:             * 
1066:             * @param _newRoleName
1067:             */
1068:            public void setNewRoleName(String _newRoleName) {
1069:                this .newRoleName = _newRoleName;
1070:            }
1071:
1072:            /**
1073:             * getter of newRoleDescription String attribute
1074:             * 
1075:             * @return String
1076:             */
1077:            public String getNewRoleDescription() {
1078:                return newRoleDescription;
1079:            }
1080:
1081:            /**
1082:             * setter of newRoleDescription String attribute
1083:             * 
1084:             * @param _newRoleDescription
1085:             */
1086:            public void setNewRoleDescription(String _newRoleDescription) {
1087:                this .newRoleDescription = _newRoleDescription;
1088:            }
1089:
1090:            /**
1091:             * getter of selectedConcreteActivityForNewRoleId String attribute
1092:             * 
1093:             * @return String
1094:             */
1095:            public String getSelectedConcreteActivityForNewRoleId() {
1096:                return selectedConcreteActivityForNewRoleId;
1097:            }
1098:
1099:            /**
1100:             * setter of selectedConcreteActivityForNewRoleId String attribute
1101:             * 
1102:             * @param _selectedConcreteActivityForNewRoleId
1103:             */
1104:            public void setSelectedConcreteActivityForNewRoleId(
1105:                    String _selectedConcreteActivityForNewRoleId) {
1106:                this .selectedConcreteActivityForNewRoleId = _selectedConcreteActivityForNewRoleId;
1107:            }
1108:
1109:            /**
1110:             * Give all the activities saved in the database for the given process
1111:             * 
1112:             * @return List<SelectItem> of activities
1113:             */
1114:            public List<SelectItem> getConcreteActivitiesForNewRole() {
1115:
1116:                List<SelectItem> activityList = new ArrayList<SelectItem>();
1117:
1118:                activityList
1119:                        .add(new SelectItem(
1120:                                "default",
1121:                                WilosBundle
1122:                                        .getText("component.project.rolesinstanciation.concreteActivityComboBox")));
1123:
1124:                Project project = this .projectService
1125:                        .getProject((String) WebSessionService
1126:                                .getAttribute(WebSessionService.PROJECT_ID));
1127:
1128:                if (project != null) {
1129:                    for (ConcreteActivity cact : this .concreteActivityService
1130:                            .getConcreteActivitiesFromProject(project)) {
1131:                        activityList.add(new SelectItem(cact.getId(), cact
1132:                                .getConcreteName()));
1133:                    }
1134:                }
1135:                return activityList;
1136:            }
1137:
1138:            /**
1139:             * Method to add an out of process role
1140:             * 
1141:             * @param evt
1142:             */
1143:            public String createNewRoleActionListener() {
1144:
1145:                Project project = this .projectService
1146:                        .getProject((String) WebSessionService
1147:                                .getAttribute(WebSessionService.PROJECT_ID));
1148:
1149:                if (!this .selectedTaskDescriptorId.equals("default")
1150:                        && !this .selectedConcreteActivityForNewRoleId
1151:                                .equals("default")) {
1152:
1153:                    ConcreteTaskDescriptor ctd;
1154:                    TaskDescriptor td = new TaskDescriptor();
1155:
1156:                    if (this .selectedTaskDescriptorId.equals("no_task")) {
1157:                        td = null;
1158:                    } else {
1159:                        ctd = this .concreteTaskDescriptorService
1160:                                .getConcreteTaskDescriptor(this .selectedTaskDescriptorId);
1161:
1162:                        td = ctd.getTaskDescriptor();
1163:                    }
1164:                    ConcreteActivity cact = this .concreteActivityService
1165:                            .getConcreteActivity(this .selectedConcreteActivityForNewRoleId);
1166:
1167:                    if (this .projectService.createRole(this .newRoleName,
1168:                            this .newRoleDescription, project, td, cact)) {
1169:                        WebCommonService
1170:                                .addInfoMessage(WilosBundle
1171:                                        .getText("component.project.rolesinstanciation.roleCreated"));
1172:                    } else {
1173:                        WebCommonService
1174:                                .addInfoMessage(WilosBundle
1175:                                        .getText("component.project.rolesinstanciation.roleNotCreated"));
1176:                    }
1177:
1178:                    TreeBean treeBean = (TreeBean) WebCommonService
1179:                            .getBean("TreeBean");
1180:                    treeBean.rebuildProjectTree();
1181:
1182:                    this .newRoleDescription = "";
1183:                    this .newRoleName = "";
1184:                    this .selectedConcreteActivityForNewRoleId = "default";
1185:                    this .selectedTaskDescriptorId = "default";
1186:                    this .addRoleRendered = false;
1187:                    this .visibleTaskComboBox = false;
1188:
1189:                }
1190:                return "";
1191:            }
1192:
1193:            /**
1194:             * getter of addRoleRendered boolean attribute
1195:             * 
1196:             * @return boolean
1197:             */
1198:            public boolean getAddRoleRendered() {
1199:                return this .addRoleRendered;
1200:            }
1201:
1202:            /**
1203:             * setter of addRoleRendered boolean attribute
1204:             * 
1205:             * @param _addRoleRendered
1206:             */
1207:            public void setAddRoleRendered(boolean _addRoleRendered) {
1208:                this .addRoleRendered = _addRoleRendered;
1209:            }
1210:
1211:            /**
1212:             * getter of visibleTaskComboBox boolean attribute
1213:             * 
1214:             * @return the visibleTaskComboBox
1215:             */
1216:            public boolean isVisibleTaskComboBox() {
1217:                return visibleTaskComboBox;
1218:            }
1219:
1220:            /**
1221:             * setter of visibleTaskComboBox boolean attribute
1222:             * 
1223:             * @param _visibleTaskComboBox
1224:             *                the visibleTaskComboBox to set
1225:             */
1226:            public void setVisibleTaskComboBox(boolean _visibleTaskComboBox) {
1227:                visibleTaskComboBox = _visibleTaskComboBox;
1228:            }
1229:
1230:            /**
1231:             * getter of isVisibleNewTaskPanel boolean attribute
1232:             * 
1233:             * @return isVisibleNewTaskPanel
1234:             */
1235:
1236:            public boolean getIsVisibleNewTaskPanel() {
1237:                Project project = this .projectService
1238:                        .getProject((String) WebSessionService
1239:                                .getAttribute(WebSessionService.PROJECT_ID));
1240:                Process process = this .projectService
1241:                        .getProcessFromProject(project);
1242:                if (process != null) {
1243:                    this .isVisibleNewTaskPanel = true;
1244:                } else {
1245:                    this .isVisibleNewTaskPanel = false;
1246:                }
1247:                return this .isVisibleNewTaskPanel;
1248:            }
1249:
1250:            /**
1251:             * setter of isVisibleNewTaskPanel boolean attribute
1252:             * 
1253:             * @param _isVisibleNewTaskPanel
1254:             *                the isVisibleNewTaskPanel to set
1255:             */
1256:            public void setIsVisibleNewTaskPanel(boolean _isVisibleNewTask) {
1257:                this.isVisibleNewTaskPanel = _isVisibleNewTask;
1258:            }
1259:
1260:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.