cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Dynamic Constraint - Validation engine returns random Dynamic Constraint

0 Kudos
405

Hello All,

We are observing a strange behaviour for Custom Dynamic Constraints, where validation engine is picking the first available dynamic constraint from Iterator for given annotation class and not the one return by ConstraintViolation, which caused constraint violations to display in the Backoffice ( Product Cockpit ) incorrectly.

We have created the dynamic constraints through impex and used below annotation for all the constraints.

de.hybris.platform.validation.annotations.Dynamic

But as per the OOTB logic , It looks like Hybris is expecting unique annotation class for each new Dynamic constraint.

Did anyone came across this kind of scenarios ? and if yes , what should be the suitable solution?

Currently we are using Hybris1808.

Looking for your help if you have any view or experience on this topic. Thanks in advance 🙂

OOTB class to build the constraints models.

DefaultHybrisConstraintViolation.class


private AbstractConstraintModel buildConstraintModel(ConstraintViolation constraintViolation) {
    AbstractConstraintModel result = null;
    Object model = constraintViolation.getLeafBean();
    if (model instanceof ItemModel) {
        String type = this.modelService.getModelType(model);
        TypeModel typeModel = this.typeService.getType(type);

.......

while(var14.hasNext()) {
    AbstractConstraintModel attribConstraintModel = (AbstractConstraintModel)var14.next();
    if (attribConstraintModel.getAnnotation().equals(annotationClass)) {
        result = attribConstraintModel;
        break;
    }
}

<br>

Accepted Solutions (0)

Answers (0)