super.validate(o, valCtx); // call to common validator first
if(o == null) {
return;
}
final String str = (String)o;
if(0 != maxLength && str.length() > maxLength) {
reportAttributeError(valCtx, "invalidStringLength",
"Attribute[{0}={1}] : String {2} length is greather than maximum length {3}",
new Object[] {valCtx.attrName, str, str, String.valueOf(maxLength)});
}
if(null != ee && !ee.contains(str) ){
reportAttributeError(valCtx, "strInvalidEnum",
"Attribute({0}={1}) : Invalid String - Required {2}",
new Object[] {valCtx.attrName, str, ee.toString()});
}
if(null != expr && !str.matches(expr))
{
String printOwnerName = GenericValidator.getConfigElementPrintName(
valCtx, getFutureXPathForValidatingAttribute(valCtx), false, false);
String generic_descr = valCtx.smh.getLocalString(
"default_pattern_description",
"Please refer to admin documentation." );
String descr = valCtx.smh.getLocalString(
"pattern_description_for_" + (expr.replaceAll("[\\\\=:]", "`")),
generic_descr );
reportAttributeError(valCtx, "regexpNotMatch",
"Value \"{1}\" is not valid for attribute \"{0}\" of {2}. {3}",
new Object[] {valCtx.attrName, str, printOwnerName, descr});
}