/**
  * @see
  *     org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageKey(java.lang.String,
  *     java.lang.String)
  */
 public String getAttributeValidatingErrorMessageKey(String entryName, String attributeName) {
   AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
   if (attributeDefinition != null) {
     if (attributeDefinition.hasValidationPattern()) {
       ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
       return validationPattern.getValidationErrorMessageKey();
     }
   }
   return null;
 }
 /**
  * @see
  *     org.kuali.rice.krad.service.DataDictionaryService#getAttributeValidatingErrorMessageParameters(java.lang.String,
  *     java.lang.String)
  */
 public String[] getAttributeValidatingErrorMessageParameters(
     String entryName, String attributeName) {
   AttributeDefinition attributeDefinition = getAttributeDefinition(entryName, attributeName);
   if (attributeDefinition != null) {
     if (attributeDefinition.hasValidationPattern()) {
       ValidationPattern validationPattern = attributeDefinition.getValidationPattern();
       String attributeLabel = getAttributeErrorLabel(entryName, attributeName);
       return validationPattern.getValidationErrorMessageParameters(attributeLabel);
     }
   }
   return null;
 }
  private boolean verifyProposaEditableColumnsDataType(MaintenanceDocument maintenanceDocument) {
    ProposalColumnsToAlter newEditableProposalField =
        (ProposalColumnsToAlter) maintenanceDocument.getNewMaintainableObject().getDataObject();
    KcPersistenceStructureService kraPersistenceStructureService =
        KcServiceLocator.getService(KcPersistenceStructureService.class);
    DataDictionaryService dataDictionaryService =
        (DataDictionaryService) KNSServiceLocator.getDataDictionaryService();
    Map<String, String> fieldMap =
        kraPersistenceStructureService.getDBColumnToObjectAttributeMap(ProposalOverview.class);
    DataDictionaryEntry entry =
        dataDictionaryService
            .getDataDictionary()
            .getDictionaryObjectEntry(ProposalDevelopmentDocument.class.getName());

    boolean returnFlag = true;
    String editableProposalField = "";
    Integer fieldMaxLength = -1;
    Integer inputDataLength = -1;
    String proposalFieldDataType = "";
    String inputDataType = "";
    ValidationPattern validatingPattern = null;

    if (newEditableProposalField != null
        && StringUtils.isNotEmpty(newEditableProposalField.getColumnName())) {
      editableProposalField = fieldMap.get(newEditableProposalField.getColumnName());
      if (StringUtils.isNotEmpty(editableProposalField)) {
        if (entry != null) {
          AttributeDefinition attributeDefinition =
              entry.getAttributeDefinition(editableProposalField);
          if (attributeDefinition != null && attributeDefinition.hasValidationPattern()) {
            validatingPattern = attributeDefinition.getValidationPattern();
            if (validatingPattern != null) {
              proposalFieldDataType =
                  validationClassesMap.get(validatingPattern.getClass().getName());
              inputDataType = newEditableProposalField.getDataType();
              if (!proposalFieldDataType.equalsIgnoreCase(inputDataType)) {
                // throw error
                GlobalVariables.getMessageMap()
                    .putError(
                        Constants.PROPOSAL_EDITABLECOLUMN_DATATYPE,
                        KeyConstants.PROPOSAL_EDITABLECOLUMN_DATATYPE_MISMATCH);
                returnFlag = false;
              }
            }
          }
        }

        inputDataLength = newEditableProposalField.getDataLength();
        fieldMaxLength =
            dataDictionaryService.getAttributeMaxLength(
                DevelopmentProposal.class, editableProposalField);
        if (fieldMaxLength > inputDataLength) {
          // throw error
          GlobalVariables.getMessageMap()
              .putError(
                  Constants.PROPOSAL_EDITABLECOLUMN_DATALENGTH,
                  KeyConstants.PROPOSAL_EDITABLECOLUMN_DATALENGTH_MISMATCH);
          returnFlag = false;
        }
      }
    }

    return returnFlag;
  }