fri.util.database.jpa.tree.uniqueconstraints
Class AbstractWholeTreeUniqueConstraintImpl<N extends TreeNode>

java.lang.Object
  extended by fri.util.database.jpa.tree.uniqueconstraints.AbstractUniqueTreeConstraintImpl<N>
      extended by fri.util.database.jpa.tree.uniqueconstraints.AbstractWholeTreeUniqueConstraintImpl<N>
All Implemented Interfaces:
UniqueTreeConstraint<N>
Direct Known Subclasses:
UniqueWholeTreeConstraintImpl, UniqueWholeTreeConstraintImpl

public abstract class AbstractWholeTreeUniqueConstraintImpl<N extends TreeNode>
extends AbstractUniqueTreeConstraintImpl<N>

Checks if the values of a a property set is unique within a specific tree. That means that property values set can appear just once in one tree, but can appear in other trees in the same database table.

Author:
Fritz Ritzberger, 20.10.2011

Field Summary
 
Fields inherited from class fri.util.database.jpa.tree.uniqueconstraints.AbstractUniqueTreeConstraintImpl
shouldCheckRootsForUniqueness, uniquePropertyNames
 
Constructor Summary
protected AbstractWholeTreeUniqueConstraintImpl(java.lang.String[][] uniquePropertyNames, boolean shouldCheckRootsForUniqueness)
          See super-class constructor.
 
Method Summary
 boolean checkUniqueConstraint(java.util.List<N> nodes, TreeActionLocation<N> location)
          The implementation of this is expected to check the uniqueness of passed node(s).
 
Methods inherited from class fri.util.database.jpa.tree.uniqueconstraints.AbstractUniqueTreeConstraintImpl
appendNodeCheckingCondition, appendRootCheckingCondition, appendUniquenessConditions, appendUpdateCondition, beforeCheckUniqueness, checkUniqueChildrenConstraint, checkUniqueWholeTreeConstraint, equal, fromClause, getDao, getNodeTableAlias, getNodeValueForProperty, getSession, isDifferent, isRootsCheck, nodeEntityName, pathEntityName, setContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractWholeTreeUniqueConstraintImpl

protected AbstractWholeTreeUniqueConstraintImpl(java.lang.String[][] uniquePropertyNames,
                                                boolean shouldCheckRootsForUniqueness)
See super-class constructor.

Method Detail

checkUniqueConstraint

public boolean checkUniqueConstraint(java.util.List<N> nodes,
                                     TreeActionLocation<N> location)
The implementation of this is expected to check the uniqueness of passed node(s). Called by the DAO when addChild(), move() or copy() is performed. Mind that you must call treeDao.checkUniqueConstraint() explicitly when updating a node property, see explanation in header comment!.

Parameters:
nodes - one (default) or more (copy/move only) entities that hold values to check for uniqueness at location, when list, the copied node will be first, then its sub-nodes.
location - the information where the pending modification is going to happen.
Returns:
false when unique constraint would be violated, else true.