Exemplo n.º 1
0
 public void isSelectedIssueEmpty() {
   if ((getSelectedIssues() == null) || (getSelectedIssues().size() == 0)) {
     JSFUtils.addCallBackParam("isEmpty", true);
   } else {
     JSFUtils.addCallBackParam("exportType", JSFUtils.getRequestParameter("exportType"));
   }
 }
Exemplo n.º 2
0
 /**
  * Update estimate point if an issue
  *
  * @param issueId - Issue ID, Long number format
  */
 public void updateEstimatePoint(Long issueId) {
   Issue issue = issueService.findIssueById(issueId);
   issueService.updateEstimatePoint(issue, this.pointEstimateFormat.trim());
   issueService.updatePointRemain(this.pointEstimateFormat.trim(), issueId);
   issueService.updateStatusOfIssueParent(issue.getParent());
   JSFUtils.resetForm("list-form");
   JSFUtils.addCallBackParam("update", true);
   loadIssues();
 }
Exemplo n.º 3
0
 /** Update estimate point of parent issue */
 public void updateParentPoint() {
   String issueIdString = JSFUtils.getRequestParameter("issueId");
   String newPointString = JSFUtils.getRequestParameter("newPoint");
   Issue issue = issueService.findIssueById(Long.parseLong(issueIdString));
   issue.setEstimate(newPointString);
   issueService.updateStatusOfIssueParent(issue);
   resetListIssueForm();
   loadIssues();
 }
  /**
   * 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) {

    }
  }
Exemplo n.º 5
0
 public void redirectToMeetingPage() {
   String issueIdString = JSFUtils.getRequestParameter("issueId");
   Project project =
       projectService.findProjectOfIssue(
           issueService.findIssueById(Long.parseLong(issueIdString)));
   this.projectId = project.getProjectId();
   this.teamId = Long.parseLong(JSFUtils.getRequestParameter("teamId"));
   this.sprintId = Long.parseLong(JSFUtils.getRequestParameter("sprintId"));
   this.setSelectedParentIssueId(issueIdString);
   try {
     FacesContext.getCurrentInstance().getExternalContext().redirect("meeting");
   } catch (IOException e) {
   }
 }
Exemplo n.º 6
0
  /** Redirect to view issue detail page */
  public void toViewIssuePage() {
    this.viewProject = projectService.findProjectOfIssue(this.viewIssue);
    Issue viewedIssue = getViewIssue();
    this.attachmentListByIssue = attachmentService.findAttachmentByIssue(viewedIssue);
    // list all attachment file of User Story
    if (viewedIssue != null && viewedIssue.getUserStory() != null) {
      this.attachmentListByIssue.addAll(
          attachmentService.findAttachmentByUserStory(viewedIssue.getUserStory()));
    }

    JSFUtils.setManagedBeanValue("historyBean.issueId", this.viewIssue.getIssueId());
    String contextPath =
        FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath()
            + "/issue/view";
    JSFUtils.redirect(contextPath);
  }
Exemplo n.º 7
0
 public void syncBeanData() {
   if (JSFUtils.isPostbackRequired()) {
     projects = projectService.findByMemberAndOwner(getLoggedInMember().getMemberId());
     verifyProjectId();
     verifyTeamId();
     verifySprintId();
     loadIssues();
   }
 }
  /** 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) {

    }
  }
Exemplo n.º 9
0
 /**
  * Get format of estimate point
  *
  * @return '1' for DT format and '2' for only number format
  */
 public String getPointEstimateFormat() {
   try {
     Long issueId = (Long) JSFUtils.resolveExpression("#{issue.issueId}");
     Issue issue = issueService.findIssueById(issueId);
     this.pointEstimateFormat = pointRemainService.getPointEstimateByFormat(issue);
     return this.pointEstimateFormat;
   } catch (Exception e) {
     return null;
   }
 }
Exemplo n.º 10
0
  /** when user press f5 */
  public void refreshViewIssuePage() {
    if (viewIssue != null && viewIssue.getIssueId() != null) {
      this.viewIssue = issueService.findIssueById(viewIssue.getIssueId());
      this.viewProject = this.projectService.findProjectOfIssue(this.viewIssue);
      Issue viewedIssue = getViewIssue();
      this.attachmentListByIssue = this.attachmentService.findAttachmentByIssue(viewedIssue);
      // list all attachment file of User Story
      if (viewedIssue != null && viewedIssue.getUserStory() != null) {
        this.attachmentListByIssue.addAll(
            attachmentService.findAttachmentByUserStory(viewedIssue.getUserStory()));
      }

      JSFUtils.setManagedBeanValue("historyBean.issueId", this.viewIssue.getIssueId());
    }
  }
  /** 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);
    }
  }
 private boolean saveAttachment() {
   String filename = JSFUtils.getRequestParameter("filename");
   String diskFileName =
       this.attachmentService.fileNameProcess(FilenameUtils.removeExtension(filename));
   diskFileName = this.attachmentService.replaceFile(filename, diskFileName);
   this.attachment.setFilename(filename);
   this.attachment.setDiskFilename(diskFileName);
   this.attachment.setContainerId(this.userStory.getUserStoryId());
   this.attachment.setContainerType(Attachment.USERSTORY_ATTACHMENT);
   if (this.attachment.getContainerId() == null) {
     this.attachment.setTemp(true);
   } else {
     this.attachment.setTemp(false);
   }
   this.attachment.setCreatedOn(new Date());
   this.attachment.setAuthor(this.utils.getLoggedInMember());
   return this.attachmentService.save(this.attachment);
 }
  public void updateUserStory() {
    RequestContext context = RequestContext.getCurrentInstance();
    if (userStory == null) {
      context.addCallbackParam("userStoryId", userStory.getUserStoryId());
      context.addCallbackParam("error", EXCEPTION);
      return;
    }

    if (userStory.getName().equals("")) {
      context.addCallbackParam("userStoryId", userStory.getUserStoryId());
      context.addCallbackParam("error", EMPTY_ERROR);
      return;
    }

    if (userStoryService.checkExistUserStory(
                Utils.standardizeString(userStory.getName()), getProjectId())
            != null
        && !(userStory.getName().equals(Utils.standardizeString(userStory.getName())))) {
      context.addCallbackParam("userStoryId", userStory.getUserStoryId());
      context.addCallbackParam("error", DUPPLICATE_ERROR);
      return;
    }

    if (userStory.getValue() > MAX_BUSSINESS_VALUE || userStory.getValue() < 0) {
      context.addCallbackParam("userStoryId", userStory.getUserStoryId());
      context.addCallbackParam("error", VALUE_ERROR);
      return;
    }

    userStory.setName(userStory.getName().replaceAll("\\p{Cntrl}", ""));
    userStory.setDescription(userStory.getDescription().replaceAll("\\p{Cntrl}", ""));

    if (userStoryService.update(userStory)) {
      userStoryService.updateAllIssueOfUserStoryHaveTheSameContent(userStory);
      setValueForUsList();
      context.addCallbackParam("error", NO_ERROR);
      context.addCallbackParam("userStoryId", userStory.getUserStoryId());
      JSFUtils.resloveMethodExpression(
          "#{homeBean.setDefaultHistoryList}", Void.class, new Class<?>[0], new Object[0]);
    } else {
      context.addCallbackParam("userStoryId", userStory.getUserStoryId());
      context.addCallbackParam("error", EXCEPTION);
    }
  }
  private boolean addAttachment() {
    try {
      this.attachment = new Attachment();

      String filename = JSFUtils.getRequestParameter("filename");
      String diskFileName =
          this.attachmentService.fileNameProcess(FilenameUtils.removeExtension(filename));
      diskFileName = this.attachmentService.replaceFile(filename, diskFileName);

      this.attachment.setFilename(filename);
      this.attachment.setDiskFilename(diskFileName);
      this.attachment.setContainerType(Attachment.USERSTORY_ATTACHMENT);
      this.attachment.setTemp(true);
      this.attachment.setCreatedOn(new Date());
      this.attachment.setAuthor(this.utils.getLoggedInMember());
      return true;
    } catch (Exception exception) {
      LOGGER.error("addAttachment at sprintBacklog " + exception);
      return false;
    }
  }
Exemplo n.º 15
0
  /** Upload attachment file for issue */
  public void uploadFile() {
    String filename = JSFUtils.getRequestParameter("filename");
    String diskFileName =
        this.attachmentService.fileNameProcess(FilenameUtils.removeExtension(filename));
    diskFileName = this.attachmentService.replaceFile(filename, diskFileName);
    attachment = new Attachment();
    attachment.setFilename(filename);
    attachment.setDiskFilename(diskFileName);
    attachment.setContainerId(issue.getIssueId());
    attachment.setContainerType(Attachment.ISSUE_ATTACHMENT);
    // add files of Issue in user story for easy to handle.
    if (issue.getUserStory() != null) {
      attachment.setContainerId(issue.getUserStory().getUserStoryId());
      attachment.setContainerType(Attachment.USERSTORY_ATTACHMENT);
    }

    attachment.setTemp(false);
    attachment.setCreatedOn(new Date());
    attachment.setAuthor(utils.getLoggedInMember());
    attachmentService.save(attachment);
    Attachment newAttachment = attachmentService.findAttachmentById(attachment.getAttachmentId());

    if (attachmentNotAddList == null) {
      attachmentNotAddList = new ArrayList<Attachment>();
    }

    if (newAttachment.getContainerId() != null) {
      attachment.setTemp(false);
      attachmentService.moveAttachmentFile(attachment, projectId);
    } else {
      attachment.setTemp(true);
      attachmentNotAddList.add(newAttachment);
    }

    attachmentListByIssue = attachmentService.findAttachmentByIssue(issue);
    if (issue.getUserStory() != null) {
      attachmentListByIssue.addAll(
          attachmentService.findAttachmentByUserStory(issue.getUserStory()));
    }
  }
Exemplo n.º 16
0
  public void backToAddIssuePage() {
    this.issue = this.viewIssue;
    List<Issue> issues = issueService.findIssueByParent(issue);
    if (!issues.isEmpty()) {
      this.issue.setIsParent(true);
    }
    this.viewProject = this.projectService.findProjectOfIssue(this.viewIssue);
    this.projectId = this.viewProject.getProjectId();
    this.teamId = this.issue.getSprint().getTeam().getTeamId();
    this.sprint = this.issue.getSprint();
    refreshDropDownList();
    this.attachmentListByIssue = this.attachmentService.findAttachmentByIssue(this.issue);
    // list all attachment file of User Story
    if (this.issue != null && this.issue.getUserStory() != null) {
      this.attachmentListByIssue.addAll(
          attachmentService.findAttachmentByUserStory(this.issue.getUserStory()));
    }

    String contextPath =
        FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath() + "/issue";
    JSFUtils.redirect(contextPath);
  }
  /** Create new user story with information entered in view, then save it into database */
  public void addUserStory() {
    RequestContext requestContext = RequestContext.getCurrentInstance();

    if (getProjectId() == 0) {
      requestContext.addCallbackParam("success", false);
      return;
    }
    try {
      UserStory us = new UserStory();

      // Remove Control Characters
      us.setName(Utils.standardizeString(userStory.getName()).replaceAll("\\p{Cntrl}", ""));
      us.setDescription(userStory.getDescription().replaceAll("\\p{Cntrl}", ""));

      us.setStatus(UserStory.StatusType.TODO);
      us.setValue(userStory.getValue());
      us.setProject(projectService.findProjectById(getProjectId()));
      us.setRisk(0);
      us.setPriority(UserStory.PriorityType.NONE);
      if (userStoryService.create(us)) {
        saveAttachmentsToDatabase(us);

        resetUserStoryValue();
        setValueForUsList();
        setCreateMode(false);
        requestContext.addCallbackParam("success", true);
        JSFUtils.resloveMethodExpression(
            "#{homeBean.setDefaultHistoryList}", Void.class, new Class<?>[0], new Object[0]);
      } else {
        throw new Exception();
      }
    } catch (Exception e) {
      requestContext.addCallbackParam("success", false);
      LOGGER.error("HomePage addUserStory: " + e);
    }
  }
 public void resetForm() {
   resetUserStoryValue();
   JSFUtils.resetForm("addNewForm");
 }
Exemplo n.º 19
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));
    }
  }
Exemplo n.º 20
0
 public String getRemainPointByFormat() {
   Issue issueTemp = (Issue) JSFUtils.resolveExpression("#{issue}");
   return this.issueService.getPointByFormat(issueTemp.getRemain(), issueTemp.getPointFormat());
 }
Exemplo n.º 21
0
 public void resetListIssueForm() {
   JSFUtils.resetForm("list-form");
 }
 public void resetEditForm() {
   JSFUtils.resetForm("frmEditUs");
 }
Exemplo n.º 23
0
 public void resetIssueForm() {
   JSFUtils.resetForm("issueForm");
 }
Exemplo n.º 24
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));
    }
  }
Exemplo n.º 25
0
 public void initPreview() {
   if (JSFUtils.isPostbackRequired()) {
     defautLazyLoading();
     refreshDropDownList();
   }
 }
Exemplo n.º 26
0
 public void handleCreateIssue() {
   resetIssueValue();
   resetIssueForm();
   resetAttachmentList();
   JSFUtils.addCallBackParam("create", true);
 }