Class AUniqueEntityFieldValidator<TEntity extends de.xima.cmn.dao.interfaces.IEntity<Long>, TField>
java.lang.Object
de.xima.fc.gui.common.validator.AUniqueBeanFieldValidator<TEntity,TField>
de.xima.fc.gui.common.validator.AUniqueEntityFieldValidator<TEntity,TField>
- Type Parameters:
TEntity- Type of the entity owning the field.TField- Type of the field to which the validator applies.
- All Implemented Interfaces:
Serializable, EventListener, javax.faces.validator.Validator
- Direct Known Subclasses:
AUniqueStringFieldValidator
public abstract class AUniqueEntityFieldValidator<TEntity extends de.xima.cmn.dao.interfaces.IEntity<Long>, TField>
extends AUniqueBeanFieldValidator<TEntity,TField>
Abstract base class for faces validators that check whether a certain field of an entity is unique amongst all
existing entities within a certain scope. This base class is independent of how the entities are stored or accessed,
you must implement the search for duplicates by implementing the
countEntities(Class, QueryCriteriaManager)
method.- Since:
- 8.4.0
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Field Summary
Fields inherited from class AUniqueBeanFieldValidator
ATTR_VALUE, beanClass, fieldClassFields inherited from interface javax.faces.validator.Validator
NOT_IN_RANGE_MESSAGE_ID -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAUniqueEntityFieldValidator(Class<TEntity> entityClass, Class<TField> fieldClass) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidUse this method to restrict the scope of entities considered for the duplicate search, such as to a certain client, version, project etc.protected abstract voidAdds the criteria an entity must match to be considered a duplicate.protected booleanhasDuplicates(TEntity entity, TField fieldValue) Checks if any duplicates exists for the given bean with the given field value.Methods inherited from class AUniqueBeanFieldValidator
convertValue, createError, createError, findBean, getValueExpressionBase, hasDuplicates, hasValue, validate
-
Constructor Details
-
AUniqueEntityFieldValidator
-
-
Method Details
-
addScope
Use this method to restrict the scope of entities considered for the duplicate search, such as to a certain client, version, project etc.By default, the client and project scope is set if the entity implements
IMandantDependentorIProjektDependent.- Parameters:
qcm- Query criteria manager that will be used to check for existing duplicates.entity- Entity that is validated.
-
addSearch
Adds the criteria an entity must match to be considered a duplicate.- Parameters:
qcm- Query criteria manager that will be used to check for existing duplicates.value- Field to search.
-
hasDuplicates
Description copied from class:AUniqueBeanFieldValidatorChecks if any duplicates exists for the given bean with the given field value.- Overrides:
hasDuplicatesin classAUniqueBeanFieldValidator<TEntity extends de.xima.cmn.dao.interfaces.IEntity<Long>, TField>- Parameters:
entity- Bean to check for existing duplicates.fieldValue- Field value to check for duplicates.
-