An user request the below requirement.
He want to change validation condition in specific attribute at Entity Object at runtime.
For example there is a maximum of employee salary which can be changed at runtime, therefore the user doesn't want the maximum salary of employee to be fixed.
So I will create a new method for setting Validation Expression at runtime using Groovy.
public void addExpressionValidator(AttributeDef attributeDef, String groovyExpression, String errorMessage) {
//create new ExpressionValidator
JboExpressionValidator jboExpressionValidator = new JboExpressionValidator(false, groovyExpression);
//Set an error message
jboExpressionValidator.setErrorMsgId(errorMessage);
//adding the validator to the attribute
((AttributeDefImpl)attributeDef).addValidator(jboExpressionValidator);
}