use of org.kuali.kfs.core.api.uif.AttributeError in project cu-kfs by CU-CommunityApps.
the class FinancialSystemSearchableAttribute method validateDocumentAttributeCriteria.
@Override
public List<AttributeError> validateDocumentAttributeCriteria(RuleAttribute ruleAttribute, DocumentSearchCriteria documentSearchCriteria) {
if (LOG.isDebugEnabled()) {
LOG.debug("validateDocumentAttributeCriteria( " + ruleAttribute + ", " + documentSearchCriteria + " )");
}
// this list is irrelevant. the validation errors are put on the stack in the validationService.
List<AttributeError> errors = super.validateDocumentAttributeCriteria(ruleAttribute, documentSearchCriteria);
DictionaryValidationService validationService = SpringContext.getBean(DictionaryValidationService.class);
Map<String, List<String>> paramMap = documentSearchCriteria.getDocumentAttributeValues();
for (String key : paramMap.keySet()) {
List<String> values = paramMap.get(key);
if (values != null && !values.isEmpty()) {
for (String value : values) {
if (StringUtils.isNotEmpty(value)) {
if (magicFields.containsKey(key)) {
validationService.validateAttributeFormat(magicFields.get(key), key, value, key);
}
}
}
}
}
retrieveValidationErrorsFromGlobalVariables(errors);
return errors;
}
use of org.kuali.kfs.core.api.uif.AttributeError in project cu-kfs by CU-CommunityApps.
the class SecurityRequestDocumentRule method validateQualification.
protected boolean validateQualification(KimType typeInfo, SecurityRequestRoleQualification requestRoleQualification, String fieldKeyPrefix) {
boolean success = true;
KimTypeService kimTypeService = KimFrameworkServiceLocator.getKimTypeService(typeInfo);
try {
List<AttributeError> attributeErrors = kimTypeService.validateAttributes(typeInfo.getId(), requestRoleQualification.buildQualificationAttributeSet());
if (!attributeErrors.isEmpty()) {
success = false;
}
for (AttributeError entry : attributeErrors) {
String attributeName = entry.getAttributeName();
int qualificationDetailIndex = findQualificationRecordForAttribute(requestRoleQualification.getRoleQualificationDetails(), attributeName);
String fieldKey = fieldKeyPrefix + KSRPropertyConstants.SECURITY_REQUEST_DOC_ROLE_QUAL_DETAILS + "[" + qualificationDetailIndex + "]." + KSRPropertyConstants.SECURITY_REQUEST_DOC_ROLE_ATTR_VALUE;
String attributeError = entry.getMessage();
String messageKey = StringUtils.substringBefore(attributeError, ":");
String messageParameter = StringUtils.substringAfter(attributeError, ":");
GlobalVariables.getMessageMap().putError(fieldKey, messageKey, messageParameter);
}
} catch (Exception e) {
String input = KRADConstants.DOCUMENT_PROPERTY_NAME + "." + KRADConstants.DOCUMENT_HEADER_PROPERTY_NAME;
GlobalVariables.getMessageMap().putInfo(input, KSRKeyConstants.ERROR_SECURITY_REQUEST_DOC_SERVICE_EXCEPTION, new String[] { "SOME FILLER TEXT" });
}
return success;
}
use of org.kuali.kfs.core.api.uif.AttributeError in project cu-kfs by CU-CommunityApps.
the class AttributeValidationHelper method convertErrorsForMappedFields.
public List<AttributeError> convertErrorsForMappedFields(String errorPath, List<AttributeError> localErrors) {
List<AttributeError> errors = new ArrayList<>();
if (errorPath == null) {
errorPath = KFSConstants.EMPTY_STRING;
} else if (StringUtils.isNotEmpty(errorPath)) {
errorPath = errorPath + ".";
}
for (AttributeError error : localErrors) {
KimAttribute attribute = getAttributeDefinitionByName(error.getAttributeName());
String attributeDefnId = attribute == null ? "" : attribute.getId();
errors.add(AttributeError.Builder.create(errorPath + "qualifier(" + attributeDefnId + ").attrVal", error.getErrors()).build());
}
return errors;
}
Aggregations