/** delete user story */
  public void deleteUserStory() {
    try {
      boolean flag = true;
      Member owner = memberService.findProjectOwner(getProjectId());
      UserStory userStoryTemp = userStoryService.findUserStoryById(Long.parseLong(deleteId));
      userStoryService.delete(Long.parseLong(deleteId));
      Member member = utils.getLoggedInMember();

      String mailContent =
          "User story #"
              + userStoryTemp.getUserStoryId()
              + " has been removed by <b>"
              + member.getLastName()
              + " "
              + member.getFirstName()
              + "</b><br/>";
      mailContent += "<hr>";
      mailContent +=
          "<h3>User story #"
              + userStoryTemp.getUserStoryId()
              + ": "
              + userStoryTemp.getName()
              + "</h3>";
      mailContent += "<ul><li>Name: " + userStoryTemp.getName() + "</li>";
      mailContent += "<li>Description: " + userStoryTemp.getDescription() + "</li>";
      mailContent += "<li>Value: " + userStoryTemp.getValue() + "</li>";
      mailContent += "<li>Status: " + userStoryTemp.getStatus() + "</li></ul>";
      mailContent += "<hr>";
      mailContent +=
          "You have received this notification because you have either subscribed to it, or are involved in it.";

      List<Team> teamList = teamService.findTeamsByProjectId(getProjectId());

      for (int i = 0; i < teamList.size(); i++) {
        List<TeamMember> teamMemberList =
            memberService.findTeamMemberListByTeamId(teamList.get(i).getTeamId());
        for (int j = 0; j < teamMemberList.size(); j++) {
          if (teamMemberList.get(j).getMember().getUsername().equals(owner.getUsername())) {
            flag = false;
          }
          mailService.sendMail(
              "Inform about remove user story",
              mailContent,
              teamMemberList.get(j).getMember().getUsername());
        }
      }
      if (flag) {
        mailService.sendMail("Inform about remove user story", mailContent, owner.getUsername());
      }
      this.setValueForUsList();
      JSFUtils.resloveMethodExpression(
          "#{homeBean.setDefaultHistoryList}", Void.class, new Class<?>[0], new Object[0]);
    } catch (Exception e) {

    }
  }
Esempio n. 2
0
 public void selectProject(long selectedProjectId) {
   projectId = selectedProjectId;
   teams =
       teamService.findTeamsByProjectIdAndMemberId(projectId, getLoggedInMember().getMemberId());
   try {
     selectTeam(teams.get(0).getTeamId());
   } catch (Exception e) {
     LOGGER.warn(e);
     selectTeam(0);
   }
 }
Esempio n. 3
0
 public void verifyProjectId() {
   try {
     boolean isContain = false;
     for (Project p : projects) {
       if (p.getProjectId() == projectId) {
         isContain = true;
         break;
       }
     }
     if (!isContain) {
       selectProject(projects.get(0).getProjectId());
     } else {
       teams =
           teamService.findTeamsByProjectIdAndMemberId(
               projectId, getLoggedInMember().getMemberId());
     }
   } catch (Exception e) {
     LOGGER.warn(e);
     selectProject(0);
   }
 }