/** Create a new Issue by information entered in view and save into database */ public void addIssue() { // Remove Control Characters newIssue.setSubject(newIssue.getSubject().replaceAll("\\p{Cntrl}", "")); newIssue.setDescription(newIssue.getDescription().replaceAll("\\p{Cntrl}", "")); newIssue.setNote(newIssue.getNote().replaceAll("\\p{Cntrl}", "")); newIssue.setParent(selectedIssue); newIssue.setSprint(selectedIssue.getSprint()); newIssue.setStatus( statusService.findStatusStartBySprintId(selectedIssue.getSprint().getSprintId())); newIssue.setEstimate("D0T0"); newIssue.setRemain("D0T0"); newIssue.setType("Task"); newIssue.setPointFormat("1"); newIssue.setPriority("MUST"); newIssue.setOldId(null); newIssue.setCreatedDate(new Date()); issueService.saveIssue(newIssue); // Update status userstory UserStory userStory = userStoryService.findUserStoryByIssue(newIssue); UserStory.StatusType status = userStoryService.findStatusOfUserStory(userStory); userStory.setStatus(status); userStoryService.update(userStory); resetForm(); RequestContext.getCurrentInstance().addCallbackParam("save", true); loadIssues(); }
public UserStory.StatusType loadStatusOfUserStory(UserStory userStory) { if (userStory.getStatus() == UserStory.StatusType.VOID) { return UserStory.StatusType.VOID; } return userStoryService.findStatusOfUserStory(userStory); }