/** * The main execution, get all the user's projects. * * @throws Exception if error. */ @Override protected void executeAction() throws Exception { HttpServletRequest request = DirectUtils.getServletRequest(); SessionData sessionData = new SessionData(request.getSession()); TCSubject currentUser = getCurrentUser(); // Set projects data List<ProjectBriefDTO> projects = DataProvider.getUserProjects(currentUser.getUserId()); UserProjectsDTO userProjectsDTO = new UserProjectsDTO(); userProjectsDTO.setProjects(projects); getViewData().setUserProjects(userProjectsDTO); // Set current project contests ProjectBriefDTO currentProject = sessionData.getCurrentProjectContext(); if (currentProject != null) { List<TypedContestBriefDTO> contests = DataProvider.getProjectTypedContests(currentUser.getUserId(), currentProject.getId()); sessionData.setCurrentProjectContests(contests); } viewData.setProjects(DataProvider.searchUserProjects(currentUser, "")); }
/** * Main execution for the action, prepare different set of data according to the view type. * * @throws Exception if there is any error. */ @Override protected void executeAction() throws Exception { // set responsible person data final List<ResponsiblePerson> allResponsiblePeople = getMilestoneResponsiblePersonService() .getAllResponsiblePeople(getFormData().getProjectId()); getViewData().setResponsiblePersons(allResponsiblePeople); // right side bar data List<ProjectBriefDTO> projects = DataProvider.getUserProjects(getSessionData().getCurrentUserId()); List<TypedContestBriefDTO> contests = DataProvider.getProjectTypedContests( getSessionData().getCurrentUserId(), formData.getProjectId()); UserProjectsDTO userProjectsDTO = new UserProjectsDTO(); userProjectsDTO.setProjects(projects); viewData.setUserProjects(userProjectsDTO); // put project into the session if (contests.size() > 0) { getSessionData().setCurrentProjectContext(contests.get(0).getProject()); } else { for (ProjectBriefDTO p : projects) { if (p.getId() == getFormData().getProjectId()) { getSessionData().setCurrentProjectContext(p); break; } } } getSessionData().setCurrentSelectDirectProjectID(getFormData().getProjectId()); // set project contests getSessionData().setCurrentProjectContests(contests); }