コード例 #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;
  }
コード例 #2
0
  public String addGroupProcess() throws Exception {
    if (isUserNotMaker()) {
      writeAuditLog("Cannot save new group. User is not a maker account.", form);

      return RESTRICTED_ERROR;
    }

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

      setType(FORM_ADD);

      logGroup(this.groupService.getLogString(this.group, "Added group."));
    } else {
      if (category != null) {
        groupService.addGroupWf(
            group,
            division,
            function,
            category,
            getNtName(),
            getVerifierCount(),
            getApproverCount(),
            getWfTeamUserOfMaker(),
            getWfTeamOfMaker(),
            isUserMakerAndVerifier());
      } else {
        groupService.addGroupWf(
            group,
            division,
            function,
            getNtName(),
            getVerifierCount(),
            getApproverCount(),
            getWfTeamUserOfMaker(),
            getWfTeamOfMaker(),
            isUserMakerAndVerifier());
      }

      setType(WORKFLOW_ADD);

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

      logGroup(getGroup(), "Submitted new group for verification and approval.");
    }

    return SUCCESS;
  }
コード例 #3
0
  public String deleteGroupProcess() throws Exception {
    if (isUserNotMaker()) {
      writeAuditLog("Cannot delete group. User is not a maker account.", form);

      return RESTRICTED_ERROR;
    }

    this.group = this.groupService.findGroup(getId());

    if (group.getGroupUsers().size() > 0) return GENERIC_ERROR;

    if (isUserSuperMaker()) {
      String str = this.groupService.getLogString(this.group, "Deleted group.");

      groupService.deleteGroup(getId());

      setType(FORM_DELETE);

      logGroup(str);
    } else {
      this.result =
          groupService.deleteGroupWf(
              getId(),
              getVerifierCount(),
              getApproverCount(),
              getWfTeamUserOfMaker(),
              getWfTeamOfMaker(),
              isUserMakerAndVerifier());

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

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

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

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

    return SUCCESS;
  }
コード例 #4
0
  public String searchGroup() throws Exception {
    this.groupList = groupService.searchGroup(getCr());

    writeAuditLog("Searching for group with criteria '" + getCr() + "'.", form);

    return LIST;
  }
コード例 #5
0
  // BEGIN ACTION
  public String listGroup() throws Exception {
    this.groupList = groupService.findAll();

    setCantDoCrud(isUserNotMaker());

    writeAuditLog("Viewed group list.", form);

    return LIST;
  }
コード例 #6
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;
  }
コード例 #7
0
  // BEGIN VALIDATION
  public void validate() {
    if (getValidate() != null) {
      boolean hasErrors = false;

      group.setCd(EscapeUtils.escape(group.getCd()));
      group.setName(EscapeUtils.escape(group.getName()));
      group.setDescription(EscapeUtils.escape(group.getDescription()));

      try {
        if (getValidate().equals(FORM_ADD)) {
          if (group.getCd().isEmpty()) {
            this.addFieldError("group.cd", Messages.REQUIRED);
            hasErrors = true;
          } else if (group.getCd().length() < 2) {
            this.addFieldError("group.cd", Messages.TOO_SHORT);
            hasErrors = true;
          } else if (group.getCd().length() > 2) {
            if (groupService.findGroupByCode(group.getCd()) != null) {
              this.addFieldError("group.cd", Messages.CODE_EXISTS);
              hasErrors = true;
            }
          }
        }

        if (group.getName().isEmpty()) {
          this.addFieldError("group.name", Messages.REQUIRED);
          hasErrors = true;
        } else if (group.getName().length() < 2) {
          this.addFieldError("group.name", Messages.TOO_SHORT);
          hasErrors = true;
        }

        if (group.getDescription().isEmpty()) {
          this.addFieldError("group.description", Messages.REQUIRED);
          hasErrors = true;
        } else if (group.getDescription().length() < 3) {
          this.addFieldError("group.description", Messages.TOO_SHORT);
          hasErrors = true;
        }

        if (function == null) {
          this.addFieldError("function", Messages.NO_FUNCTION);
          hasErrors = true;
        }

        if (getDivision() != null) {
          if (getDivision().equals("")) {
            this.addFieldError("division", Messages.NO_DIVISION);
            hasErrors = true;
          }
        }

        this.functionList = functionService.findAll();
        this.divisionList = divisionService.findAll();

        if (getValidate().equals("add")) {
          setFormStatus(FORM_ADD);
          setFormAction("add-group-process");
        } else if (getValidate().equals("edit")) {
          setFormStatus(FORM_EDIT);
          setFormAction("edit-group-process");

          this.assignedFunction = groupService.getFunctionGroupById(group.getId());
        }

        if (hasErrors) {
          writeAuditLog(
              "ERROR: Group form contained empty, invalid, or duplicate field values upon submission.",
              form);
        }
      } catch (Exception e) {
        log.error("Exception occured", e);
      }
    }
  }
コード例 #8
0
  public String populateGroups() throws Exception {
    this.groupList = groupService.findAll();

    return SUCCESS;
  }
コード例 #9
0
  public String populateGroup() throws Exception {
    this.groupList = groupService.findGroupByDivision(getCr());

    return SUCCESS;
  }
コード例 #10
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;
  }