public boolean validateProperty(BaseProperty property, XWikiContext context)
{
String regexp = getValidationRegExp();
if ((regexp == null) || (regexp.trim().equals(""))) {
return true;
}
String value = ((property == null) || (property.getValue() == null)) ? "" : property.getValue().toString();
try {
if (context.getUtil().match(regexp, value)) {
return true;
}
XWikiValidationStatus.addErrorToContext((getObject() == null) ? "" : getObject().getName(), getName(),
getTranslatedPrettyName(context), getValidationMessage(), context);
return false;
} catch (Exception e) {
XWikiValidationStatus.addExceptionToContext((getObject() == null) ? "" : getObject().getName(), getName(),
e, context);
return false;
}
}