コード例 #1
0
  @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));
    }
  }
コード例 #2
0
  @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));
    }
  }