All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kenshoo.pl.entity.spi.ParentConditionValidator Maven / Gradle / Ivy

package com.kenshoo.pl.entity.spi;

import com.kenshoo.pl.entity.EntityField;
import com.kenshoo.pl.entity.ValidationError;

/**
 * A validator that checks something that relates to the state of one of the parent entities, not the entity itself.
 * For example, a security validator checks that the current user is allowed to access the profile this entity belongs to.
 *
 * @param  entity type
 */
public interface ParentConditionValidator {

    /**
     * @return the field of one of the parent entities whose value is required for the validation
     */
    EntityField parentIdField();

    /**
     * Validates that the modification or creation of a child entity is allowed for the parent entity specified.
     *
     * @param parentId the value of the field returned by {@link #parentIdField()}
     * @return validation error or null if allowed
     */
    ValidationError validate(T parentId);

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy