public void updateUserStoryWhenUpdateIssue() { if (this.issue.getIssueId() != null) { updateIssue(); UserStory userStoryOfIssue = this.issue.getUserStory(); if (userStoryOfIssue != null) { // Update status userstory boolean updateStatusUs = false; UserStory.StatusType status = userStoryService.findStatusOfUserStoryBySprintAndUserStory( userStoryOfIssue, this.sprint); if (userStoryOfIssue.getStatus().compareTo(status) != 0) { updateStatusUs = true; } userStoryOfIssue.setPriority(PriorityType.valueOf(issue.getPriority())); userStoryOfIssue.setStatus(status); userStoryOfIssue.setName(this.issue.getSubject()); userStoryOfIssue.setDescription(this.issue.getDescription()); userStoryOfIssue.setNote(this.issue.getNote()); if (userStoryService.update(userStoryOfIssue)) { userStoryService.updateAllIssueOfUserStoryHaveTheSameContent(userStoryOfIssue); // update kanbanissue status belong to userstory if (!sprintService.isPastSprint(issue.getSprint()) && updateStatusUs) { kanbanIssueService.updateAllKanbanIssueByUserStoryStatusOfTeam( userStoryOfIssue, sprint.getTeam()); } } } } // Reset issueList and issue value resetIssueForm(); resetIssueValue(); resetAttachmentList(); refreshIssueListTable(); }
/** 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()); }
/** 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); } }
/** Delete an issue and delete its all attachment */ public void deleteIssue() { Issue issueTemp = this.issue; try { this.attachmentListByIssue = this.attachmentService.findAttachmentByIssue(this.issue); if (this.attachmentListByIssue != null) { for (Attachment att : this.attachmentListByIssue) { this.attachmentService.deleteFile( att.getDiskFilename(), this.projectService.findProjectOfIssue(this.issue).getProjectId()); this.attachmentService.delete(att); } } List<History> historyOfIssue = new ArrayList<History>(); historyOfIssue = historyService.findHistoryByContainer("Issue", this.issue.getIssueId()); for (History history : historyOfIssue) { historyService.delete(history); } Issue issueParent = issueTemp.getParent(); this.issueService.deleteIssue(this.issue); // delete kanban issue if has the same subject with issue // check exist kanban issue by content and userstory // check last sprint of team Sprint lastSprint = sprintService.findLastSprintByTeamId(teamId); if (lastSprint != null && lastSprint.getSprintId().compareTo(issueTemp.getSprint().getSprintId()) == 0) { kanbanIssueService.deleteKanbanIssueByIssueId(issueTemp.getIssueId()); } if (issueParent != null) { issueService.updateStatusOfIssueParent(issueParent); } resetIssueForm(); resetIssueValue(); this.issueList.remove(issueTemp); this.filteredIssues = new ArrayList<Issue>(this.issueList); this.selectedIssues = new ArrayList<Issue>(); resetAttachmentList(); } catch (Exception a) { a.printStackTrace(); logger.error("delete issue unsuccessful", a); } }
public void setRelatedIssueForSelectedUserStory(Long userStoryId) { selectedUserStoryId = userStoryId; relatedIssues = issueService.findAllUnexpiredChildrenIssuesByUserStory(userStoryId); relatedKanbanIssues = kanbanIssueService.findKanbanIssuesByUserStory(userStoryId); }
@SuppressWarnings("static-access") public void updateIssue() { try { // String typeFormatPoint = ""; TODO Knight check to use or delete // typeFormatPoint = this.issueService.checkingPointFormat(estimatePoint); TODO Knight check // to use or delete String remainPoint = this.issue.getRemain(); String estimatePoint = this.issue.getEstimate(); estimatePoint = this.issueService.checkingEstimatePoint(estimatePoint); remainPoint = this.issueService.checkingRemainPoint(remainPoint); if ((this.issue.getStatus() != null) && (this.issue.getStatus().getType() == Status.StatusType.START)) { remainPoint = estimatePoint; } issueService.updatePointRemain(remainPoint, this.issue.getIssueId()); this.issue.setRemain(remainPoint); this.issue.setEstimate(estimatePoint); this.issue.setPointFormat("1"); // alway set default format is DT // Remove Control Characters this.issue.setSubject(this.issue.getSubject().replaceAll("\\p{Cntrl}", "")); this.issue.setNote(this.issue.getNote().replaceAll("\\p{Cntrl}", "")); this.issue.setDescription(this.issue.getDescription().trim().replaceAll("\\p{Cntrl}", "")); this.issueService.updateIssue(this.issue); // check last sprint of team Sprint lastSprint = sprintService.findLastSprintByTeamId(teamId); if (lastSprint != null && lastSprint.getSprintId().compareTo(issue.getSprint().getSprintId()) == 0) { // update kanban issue if exist kanbanIssueService.updateKanbanIssueByIssueId(issue.getIssueId()); } if (this.issue.getParent() != null) { issueService.updateStatusOfIssueParent(this.issue.getParent()); // check update status us when sprint is valid time if (!sprintService.isPastSprint(issue.getSprint())) { // Update status userstory UserStory userStory = userStoryService.findUserStoryByIssue(this.issue); UserStory.StatusType status = userStoryService.findStatusOfUserStoryBySprintAndUserStory(userStory, this.sprint); if (userStory.getStatus().compareTo(status) != 0) { userStory.setStatus(status); userStoryService.update(userStory); // update kanbanissue status belong to userstory kanbanIssueService.updateAllKanbanIssueByUserStoryStatusOfTeam( userStory, sprint.getTeam()); } } } updateRemainPointPerDay(this.issue); JSFUtils.addCallBackParam("edited", true); JSFUtils.addSuccessMessage("msgs", this.utils.getMessage("myagile.UpdateSuccess", null)); } catch (Exception e) { JSFUtils.addWarningMessage("msgs", this.utils.getMessage("myagile.UpdateUnsuccess", null)); } }
@SuppressWarnings("static-access") public void saveIssue() { // update userstory try { String estimatePoint = this.issue.getEstimate().trim(); // this.issue.setPointFormat(this.issueService.checkingPointFormat(estimatePoint)); this.issue.setPointFormat("1"); // default DT format estimatePoint = this.issueService.checkingEstimatePoint(estimatePoint); this.issue.setEstimate(estimatePoint); this.issue.setRemain(estimatePoint); // Remove Control Characters this.issue.setSubject(this.issue.getSubject().replaceAll("\\p{Cntrl}", "")); this.issue.setNote(this.issue.getNote().replaceAll("\\p{Cntrl}", "")); this.issue.setDescription(this.issue.getDescription().trim().replaceAll("\\p{Cntrl}", "")); if (this.issueService.saveIssue(this.issue)) { // check last sprint of team Sprint lastSprint = sprintService.findLastSprintByTeamId(teamId); if (lastSprint != null && lastSprint.getSprintId().compareTo(issue.getSprint().getSprintId()) == 0) { // check exist kanban issue by content and userstory if (!kanbanIssueService.existKanbanIssueByUserStoryAndSubject( this.issue.getParent().getUserStory(), this.issue.getSubject())) { // add new kanban issue KanbanIssue addKanbanIssue = new KanbanIssue(); addKanbanIssue.setUserStory(this.issue.getParent().getUserStory()); addKanbanIssue.setSubject(this.issue.getSubject()); addKanbanIssue.setDescription(this.issue.getDescription()); addKanbanIssue.setNote(this.issue.getNote()); addKanbanIssue.setColumnDone(false); addKanbanIssue.setRemain(this.issue.getRemain()); addKanbanIssue.setEstimate(this.issue.getEstimate()); addKanbanIssue.setPointFormat("1"); addKanbanIssue.setType("Task"); addKanbanIssue.setIsSubIssue(false); addKanbanIssue.setTeam(issue.getSprint().getTeam()); addKanbanIssue.setIssueOfLastSprint(issue.getIssueId()); kanbanIssueService.saveKanbanIssue(addKanbanIssue); } } } issueService.updateStatusOfIssueParent(this.issue.getParent()); // check update status us when sprint is valid time if (!sprintService.isPastSprint(issue.getSprint())) { // Update status userstory UserStory userStory = this.userStoryService.findUserStoryByIssue(this.issue); UserStory.StatusType status = this.userStoryService.findStatusOfUserStory(userStory); if (userStory.getStatus().compareTo(status) != 0) { userStory.setStatus(status); this.userStoryService.update(userStory); // update kanbanissue status belong to userstory kanbanIssueService.updateAllKanbanIssueByUserStoryStatusOfTeam( userStory, sprint.getTeam()); } } addAttachment(); // insert into point remain updateRemainPointPerDay(this.issue); JSFUtils.addCallBackParam("save", true); JSFUtils.addSuccessMessage("msgs", this.utils.getMessage("myagile.SaveSuccess", null)); } catch (Exception e) { JSFUtils.addWarningMessage("msgs", this.utils.getMessage("myagile.SaveUnsucces", null)); } }