Esempio n. 1
0
  public String viewGroup() throws Exception {
    this.group = groupService.findGroup(getId());
    this.functionList = groupService.getFunctionGroup(getId());
    this.categoryList = categoryService.findCategoriesByGroup(getId());

    logGroup(getGroup(), "Viewed group.");

    return VIEW;
  }
Esempio n. 2
0
  public String editGroup() throws Exception {
    if (isUserNotMaker()) {
      writeAuditLog("Cannot access edit group page. User is not a maker account.", form);

      return RESTRICTED_ERROR;
    }

    setFormStatus(FORM_EDIT);
    setFormAction("edit-group-process");

    this.group = groupService.findGroup(getId());
    this.functionList = functionService.findAll();
    this.assignedFunction = groupService.getFunctionGroupById(getId());
    this.divisionList = divisionService.findAll();
    this.categoryList = categoryService.findCategoriesByGroup(getId());

    logGroup(getGroup(), "Viewed edit group of");

    return INPUT_EDIT;
  }
Esempio n. 3
0
  public String editGroupProcess() throws Exception {
    if (isUserNotMaker()) {
      writeAuditLog("Cannot save group changes. User is not a maker account.", form);

      return RESTRICTED_ERROR;
    }

    Group prev = groupService.findGroup(getGroup().getId());
    List<Function> prevFunc = groupService.getFunctionGroup(getGroup().getId());
    List<WfCat> prevWf = categoryService.findCategoriesByGroup(getGroup().getId());
    Division prevDiv = prev.getDivision();

    if (isUserSuperMaker()) {
      if (category != null) {
        groupService.updateGroup(
            group,
            division,
            function,
            groupService.getFunctionGroupById(group.getId()),
            category,
            getNtName());
      } else if (category == null) {
        groupService.updateGroup(
            group, function, groupService.getFunctionGroupById(group.getId()), getNtName());
      }

      setType(FORM_EDIT);

      logGroup(getGroup(), prev, prevFunc, prevWf, prevDiv, "Updated group.");
    } else {
      if (category != null) {
        this.result =
            groupService.updateGroupWf(
                group,
                division,
                function,
                groupService.getFunctionGroupById(group.getId()),
                category,
                getNtName(),
                getVerifierCount(),
                getApproverCount(),
                getWfTeamUserOfMaker(),
                getWfTeamOfMaker(),
                isUserMakerAndVerifier());
      } else if (category == null) {
        if (division == null) {
          this.result =
              groupService.updateGroupWf(
                  group,
                  function,
                  groupService.getFunctionGroupById(group.getId()),
                  getNtName(),
                  getVerifierCount(),
                  getApproverCount(),
                  getWfTeamUserOfMaker(),
                  getWfTeamOfMaker(),
                  isUserMakerAndVerifier());
        } else {
          this.result =
              groupService.updateGroupWf(
                  group,
                  division,
                  function,
                  groupService.getFunctionGroupById(group.getId()),
                  getNtName(),
                  getVerifierCount(),
                  getApproverCount(),
                  getWfTeamUserOfMaker(),
                  getWfTeamOfMaker(),
                  isUserMakerAndVerifier());
        }
      }

      if (this.result.equals(Outcomes.NEW_TRANSACTION)) {
        setType(WORKFLOW_EDIT);

        getMailSender()
            .sendMail(
                UserInfo.getReceipientsOfMaker(),
                EMAIL_TRANSACTION_FOR_REVIEW,
                UserInfo.getUserCompleteName());

        logGroup(getGroup(), prev, "Submitted group changes for verification and approval.");
      } else if (this.result.equals(Outcomes.PENDING_TRANSACTION)) {
        setType(Outcomes.PENDING_TRANSACTION);

        logGroup(getGroup(), "Pending update transaction for this group.");
      }
    }

    return SUCCESS;
  }