/** Set status Destroy VOID for current user story */ public void destroyVoid() { UserStory usTemp = userStoryService.findUserStoryById(selectedUserStoryId); usTemp.setStatus(usTemp.getPreviousStatus()); userStoryService.update(usTemp); setValueForUsList(); issueService.destroyVoidAllUnexpiredIssuesWhenDestroyVoidUserStory(usTemp.getUserStoryId()); kanbanIssueService.destroyVoidAllKanbanIssueWhenDestroyVoidUserStory(usTemp.getUserStoryId()); }
/** 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) { } }
/** * update user story on menu backlog (sprint backlog) * * @param userStoryId * @param name * @param value */ public void updatePBLOnBacklogPage() { try { RequestContext requestContext = RequestContext.getCurrentInstance(); String id = JSFUtils.getRequestParameter("Id"); String name = JSFUtils.getRequestParameter("name"); String description = JSFUtils.getRequestParameter("description"); String value = JSFUtils.getRequestParameter("value"); String risk = JSFUtils.getRequestParameter("risk"); UserStory current = userStoryService.findUserStoryById(Long.parseLong(id.trim())); if (current == null) { requestContext.addCallbackParam("userStoryId", id); requestContext.addCallbackParam("error", EXCEPTION); return; } if (name.equals("")) { requestContext.addCallbackParam("userStoryId", id); requestContext.addCallbackParam("error", EMPTY_ERROR); return; } if ((userStoryService.checkExistUserStory( Utils.standardizeString(name), current.getProject().getProjectId()) != null) && !(current.getName().equals(Utils.standardizeString(name)))) { requestContext.addCallbackParam("userStoryId", id); requestContext.addCallbackParam("error", DUPPLICATE_ERROR); return; } if (Integer.parseInt(value) > MAX_BUSSINESS_VALUE || Integer.parseInt(value) < 0) { requestContext.addCallbackParam("userStoryId", id); requestContext.addCallbackParam("error", VALUE_ERROR); return; } if (Integer.parseInt(risk) > MAX_RISK_VALUE || Integer.parseInt(risk) < 0) { requestContext.addCallbackParam("userStoryId", id); requestContext.addCallbackParam("error", RISK_ERROR); return; } current.setName(name.replaceAll("\\p{Cntrl}", "")); current.setValue(Integer.parseInt(value)); current.setRisk(Integer.parseInt(risk)); current.setDescription(description.replaceAll("\\p{Cntrl}", "")); if (userStoryService.update(current)) { userStoryService.updateAllIssueOfUserStoryHaveTheSameContent(current); } requestContext.execute("PrimeFaces.ab({source:'',update:'form2'});"); } catch (Exception e) { } }
/** Set status VOID for current user story */ public void setVoid() { try { UserStory usTemp = userStoryService.findUserStoryById(selectedUserStoryId); usTemp.setPreviousStatus(usTemp.getStatus()); usTemp.setStatus(UserStory.StatusType.VOID); // kanbanIssueService.deleteAllKanbanIssueByUserStoryID(usTemp.getUserStoryId()); issueService.setVoidAllUnexpiredIssuesWhenSetUserStoryVoid(usTemp.getUserStoryId()); kanbanIssueService.setVoidAllKanbanIssueWhenSetVoidUserStory(usTemp.getUserStoryId()); userStoryService.update(usTemp); setValueForUsList(); JSFUtils.resloveMethodExpression( "#{homeBean.setDefaultHistoryList}", Void.class, new Class<?>[0], new Object[0]); } catch (Exception e) { LOGGER.error(e); } }