@SuppressWarnings("deprecation")
 private boolean isNotDuplicateSignatureId(MaintenanceDocument document) {
   boolean isValid = true;
   PersonSignatureModule personSignatureModule =
       (PersonSignatureModule) document.getNewMaintainableObject().getDataObject();
   Map<String, Object> fieldValues = new HashMap<String, Object>();
   fieldValues.put("personSignatureId", personSignatureModule.getPersonSignatureId());
   fieldValues.put("moduleCode", personSignatureModule.getModuleCode());
   if (document.isNew()) {
     isValid = getBoService().countMatching(PersonSignatureModule.class, fieldValues) == 0;
   } else if (document.isEdit()) {
     isValid = isRecordUpdateValid(fieldValues, personSignatureModule);
   }
   if (!isValid) {
     ErrorReporter errorReporter = new ErrorReporter();
     errorReporter.reportError(
         "document.newMaintainableObject.personSignatureId",
         PERSON_SIGNATURE_ID_INVALID_ERROR_KEY,
         new String[] {});
   }
   return isValid;
 }
  /**
   * This method is to validate that the member absent is not an alternate for. This will be called
   * by action 'presentVoting & 'presentOther'
   *
   * @param event
   * @return
   */
  public boolean processRules(MeetingPresentOtherOrVotingEvent event) {
    boolean rulePassed = true;
    errorReporter = new ErrorReporter();
    for (MemberPresentBean memberPresentBean : event.getMeetingHelper().getMemberPresentBeans()) {
      if (isAlternateFor(memberPresentBean, event.getMemberAbsentBean())) {
        errorReporter.reportError(
            "meetingHelper.memberAbsentBean.attendance.personId",
            KeyConstants.ERROR_PRESENT_MEMBER_ABSENT,
            event.getMemberAbsentBean().getAttendance().getPersonName());
        rulePassed = false;
      }
    }

    return rulePassed;
  }
Exemple #3
0
  /**
   * Adds an audit error to the {@link KNSGlobalVariables.getAuditErrorMap()
   * KNSGlobalVariables.getAuditErrorMap()}.
   *
   * @param error the error to add.
   * @param errorKey the error map key
   * @param clusterLabel the cluster label
   * @param clusterCategory the cluster category
   * @throws IllegalArgumentException if error, errorKey, clusterLabel, or clusterCategory are null
   *     or if errorKey, clusterLabel, or clusterCategory are whitespace
   */
  public void reportAuditError(
      AuditError error, String errorKey, String clusterLabel, String clusterCategory) {
    if (error == null
        || StringUtils.isBlank(errorKey)
        || StringUtils.isBlank(clusterLabel)
        || StringUtils.isBlank(clusterCategory)) {
      throw new IllegalArgumentException(
          new StringBuilder("null argument error: ")
              .append(error)
              .append(" errorkey: ")
              .append(errorKey)
              .append(" clusterLabel: ")
              .append(clusterLabel)
              .append(" clusterCategory: ")
              .append(clusterCategory)
              .toString());
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
    }

    @SuppressWarnings("unchecked")
    final Map<String, AuditCluster> errorMap = KNSGlobalVariables.getAuditErrorMap();

    AuditCluster cluster = errorMap.get(errorKey);

    if (cluster == null) {
      cluster = new AuditCluster(clusterLabel, new ArrayList<AuditError>(), clusterCategory);
      errorMap.put(errorKey, cluster);
    }

    @SuppressWarnings("unchecked")
    final Collection<AuditError> errors = cluster.getAuditErrorList();
    errors.add(error);
  }
Exemple #4
0
 /**
  * Wrapper around global errorMap.put call, to allow better logging.
  *
  * @param propertyName
  * @param errorKey
  * @param errorParams
  */
 public void reportError(String propertyName, String errorKey, String... errorParams) {
   GlobalVariables.getMessageMap().putError(propertyName, errorKey, errorParams);
   if (LOG.isDebugEnabled()) {
     LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
   }
 }
Exemple #5
0
 /**
  * Wrapper around global errorMap.put call, to allow better logging.
  *
  * @param propertyName
  * @param errorKey
  * @param errorParams
  */
 public void reportWarning(String propertyName, String errorKey, String... errorParams) {
   GlobalVariables.getMessageMap().putWarning(propertyName, errorKey, errorParams);
   if (LOG.isDebugEnabled()) {
     LOG.debug(String.format("rule warning at ", ErrorReporter.getMethodPath(1, 2)));
   }
 }
Exemple #6
0
 public void reportSoftError(String propertyName, String errorKey, String... errorParams) {
   addSoftError(propertyName, errorKey, errorParams);
   if (LOG.isDebugEnabled()) {
     LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
   }
 }