Esempio n. 1
0
  /** 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();
  }
Esempio n. 2
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));
    }
  }