Ejemplo n.º 1
0
  public List<SelectItem> getProjects() {
    List<SelectItem> projectsList = new ArrayList<SelectItem>();

    String wilosUserId =
        (String) this.webSessionService.getAttribute(WebSessionService.WILOS_USER_ID);
    Participant participant = this.participantService.getParticipant(wilosUserId);

    if (participant != null) {
      HashMap<Project, Boolean> projects =
          this.participantService.getProjectsForAParticipant(participant);
      for (Project project : projects.keySet()) {
        if (projects.get(project)) {
          this.addSelectItemToList(
              projectsList, new SelectItem(project.getId(), project.getConcreteName()));
        }
      }
    }

    ResourceBundle bundle =
        ResourceBundle.getBundle(
            "wilos.resources.messages",
            FacesContext.getCurrentInstance().getApplication().getDefaultLocale());
    projectsList.add(
        0,
        new SelectItem(
            DEFAULT_PROJECT_ID, bundle.getString("navigation.tree.defaulttreenodetext")));
    return projectsList;
  }
Ejemplo n.º 2
0
 @Test
 public void testDeleteProject() {
   Project p1 = new Project();
   p1.setConcreteName("testProjectToDelete");
   p1.setDescription("testDesc");
   this.pDao.saveOrUpdateProject(p1);
   this.pDao.deleteProject(p1);
   Project pTmp = this.pDao.getProject(p1.getId());
   assertNull(pTmp);
 }
Ejemplo n.º 3
0
  public void changeTreeActionListener(ValueChangeEvent evt) {
    String nodeTypeToShow = DEFAULT_PROJECT_ID;

    this.projectId = (String) evt.getNewValue();
    // Put into the session the current project used.
    this.webSessionService.setAttribute(WebSessionService.PROJECT_ID, this.projectId);

    if (!this.projectId.equals(DEFAULT_PROJECT_ID)) {

      // Retrieve the entire project.
      this.project = this.projectService.getProject(this.projectId);

      nodeTypeToShow = WilosObjectNode.PROJECTNODE;

      // masquage de la exptable d'instanciation
      String projectId = (String) this.webSessionService.getAttribute(WebSessionService.PROJECT_ID);
      Project project = this.projectService.getProject(projectId);

      FacesContext context = FacesContext.getCurrentInstance();

      ProcessBean processBean =
          (ProcessBean)
              context
                  .getApplication()
                  .getVariableResolver()
                  .resolveVariable(context, "Woops2ProcessBean");

      ExpTableBean expTableBean =
          (ExpTableBean)
              context
                  .getApplication()
                  .getVariableResolver()
                  .resolveVariable(context, "ExpTableBean");

      if (project.getProcess() == null) {
        processBean.setSelectedProcessGuid("default");
        expTableBean.setSelectedProcessGuid("default");
        processBean.setIsVisibleExpTable(false);
        expTableBean.setIsInstanciedProject(false);
        expTableBean.getExpTableContent().clear();
      } else {
        processBean.setSelectedProcessGuid(project.getProcess().getGuid());
        expTableBean.setSelectedProcessGuid(project.getProcess().getGuid());
        processBean.setIsVisibleExpTable(true);
        expTableBean.setIsInstanciedProject(true);
      }
    }

    this.buildTreeModel();

    if (this.projectId.length() > 0) this.selectNodeToShow(this.projectId, nodeTypeToShow);
  }
Ejemplo n.º 4
0
  public ProjectTO(Project _myproject) {
    this.setProcess(new ProcessTO(_myproject.getProcess()));

    this.setDescription(_myproject.getDescription());
    this.setCreationDate(_myproject.getCreationDate());
    this.setLaunchingDate(_myproject.getLaunchingDate());
    this.setIsFinished(_myproject.getIsFinished());
    this.setId(_myproject.getId());
    this.setConcreteName(_myproject.getConcreteName());
    this.setPlannedStartingDate(_myproject.getPlannedStartingDate());
    this.setPlannedFinishingDate(_myproject.getPlannedFinishingDate());
    this.setPlannedTime(_myproject.getPlannedTime());
  }
Ejemplo n.º 5
0
 @Test
 public void testSaveOrUpdateProject() {
   Project pTmp = new Project();
   this.pDao.saveOrUpdateProject(pTmp);
   assertNotNull(this.pDao.getProject(pTmp.getId()));
 }