@SuppressWarnings("deprecation")
 private boolean isSignatureIdValid(MaintenanceDocument document) {
   boolean isValid = true;
   PersonSignatureModule personSignatureModule =
       (PersonSignatureModule) document.getNewMaintainableObject().getDataObject();
   Map<String, Long> keyMap = new HashMap<String, Long>();
   keyMap.put("personSignatureId", personSignatureModule.getPersonSignatureId());
   isValid =
       checkExistenceFromTable(
           PersonSignature.class, keyMap, "personSignatureId", "Person Signature Id");
   return isValid;
 }
 /**
  * This method is to check the record is identical on update if record does not exist then return
  * true to perform update
  *
  * @param fieldValues
  * @param mdocPersonSignatureModule
  * @return
  */
 @SuppressWarnings("deprecation")
 private boolean isRecordUpdateValid(
     Map<String, Object> fieldValues, PersonSignatureModule mdocPersonSignatureModule) {
   boolean isRecordUpdateValid = false;
   List<PersonSignatureModule> authorizedSignatures =
       (List<PersonSignatureModule>)
           getBoService().findMatching(PersonSignatureModule.class, fieldValues);
   if (authorizedSignatures.isEmpty()) {
     isRecordUpdateValid = true;
   } else {
     PersonSignatureModule dbPersonSignatureModule = authorizedSignatures.get(0);
     Long dbPersonSignatureModuleId = dbPersonSignatureModule.getPersonSignatureModuleId();
     if (mdocPersonSignatureModule
         .getPersonSignatureModuleId()
         .equals(dbPersonSignatureModuleId)) {
       isRecordUpdateValid = true;
     }
   }
   return isRecordUpdateValid;
 }
 @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 = KcServiceLocator.getService(ErrorReporter.class);
     errorReporter.reportError(
         "document.newMaintainableObject.personSignatureId",
         PERSON_SIGNATURE_ID_INVALID_ERROR_KEY,
         new String[] {});
   }
   return isValid;
 }