Class EntityReferenceDaoListener<TReferenced extends de.xima.cmn.dao.interfaces.IEntity<Long>,TReferencing extends de.xima.cmn.dao.interfaces.IEntity<Long>>
- java.lang.Object
-
- de.xima.fc.workflow.designer.listener.PreCommitDaoListener<TReferenced>
-
- de.xima.fc.workflow.designer.listener.EntityReferenceDaoListener<TReferenced,TReferencing>
-
- Type Parameters:
TReferenced
- Type of the entity being referenced by another entity.TReferencing
- Type of the entity referencing another entity.
- All Implemented Interfaces:
de.xima.cmn.dao.interfaces.IDaoActionListener<TReferenced,IEntityContext>
public abstract class EntityReferenceDaoListener<TReferenced extends de.xima.cmn.dao.interfaces.IEntity<Long>,TReferencing extends de.xima.cmn.dao.interfaces.IEntity<Long>> extends PreCommitDaoListener<TReferenced>
AIDaoActionListener
for checking whether an entity is still referenced by another entity, and preventing the deletion of said entity if it is.This class delays the check just before the transaction is committed. This allows several entities to be deleted in one transaction. Otherwise, the check could find referencing entities that are scheduled to be deleted later during the transaction.
- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EntityReferenceDaoListener(Class<TReferencing> referencedEntityClass)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkPrecondition(TReferenced entity, IEntityContext ec)
If thecreateEntityRefsFilter(IEntity, IEntityContext)
is complex, you can use this method to check whether the query for referencing entities should be performed.protected abstract de.xima.cmn.criteria.FilterCriterion
createEntityRefsFilter(TReferenced entity, IEntityContext ec)
protected void
handleBeforeCommit(TReferenced entity, IEntityContext ec)
-
Methods inherited from class de.xima.fc.workflow.designer.listener.PreCommitDaoListener
handleNotification
-
-
-
-
Constructor Detail
-
EntityReferenceDaoListener
protected EntityReferenceDaoListener(Class<TReferencing> referencedEntityClass)
-
-
Method Detail
-
handleBeforeCommit
protected void handleBeforeCommit(TReferenced entity, IEntityContext ec)
- Specified by:
handleBeforeCommit
in classPreCommitDaoListener<TReferenced extends de.xima.cmn.dao.interfaces.IEntity<Long>>
-
checkPrecondition
protected boolean checkPrecondition(TReferenced entity, IEntityContext ec)
If thecreateEntityRefsFilter(IEntity, IEntityContext)
is complex, you can use this method to check whether the query for referencing entities should be performed.- Parameters:
entity
- The entity that is scheduled to be deleted.ec
- The current entity context.- Returns:
- When
false
, the check for referencing entities is skipped and the deletion of the entity is allowed.
-
createEntityRefsFilter
protected abstract de.xima.cmn.criteria.FilterCriterion createEntityRefsFilter(TReferenced entity, IEntityContext ec)
-
-