|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfri.util.database.jpa.tree.AbstractTreeDao<ClosureTableTreeNode>
fri.util.database.jpa.tree.closuretable.ClosureTableTreeDao
fri.util.database.jpa.tree.closuretable.TemporalClosureTableTreeDao
public class TemporalClosureTableTreeDao
DAO extension that allows to historicize entities instead of deleting them.
Following methods must be overridden for another historization-mechanism than the default validFrom and validTo properties:
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface fri.util.database.jpa.tree.TreeDao |
---|
TreeDao.CopiedNodeRenamer<N extends TreeNode> |
Field Summary |
---|
Fields inherited from class fri.util.database.jpa.tree.AbstractTreeDao |
---|
session |
Fields inherited from interface fri.util.database.jpa.tree.TreeDao |
---|
UNDEFINED_POSITION |
Constructor Summary | |
---|---|
TemporalClosureTableTreeDao(java.lang.Class<? extends ClosureTableTreeNode> treeNodeEntityClass,
java.lang.Class<? extends TreePath> treePathsEntityClass,
boolean positionMatters,
java.lang.String validFromPropertyName,
java.lang.String validToPropertyName,
DbSession session)
|
|
TemporalClosureTableTreeDao(java.lang.Class<? extends ClosureTableTreeNode> treeNodeEntityClass,
java.lang.String treeNodeEntity,
java.lang.Class<? extends TreePath> treePathEntityClass,
java.lang.String treePathEntity,
boolean positionMatters,
java.lang.String validFromPropertyName,
java.lang.String validToPropertyName,
DbSession session)
|
Method Summary | |
---|---|
protected void |
assignInvalidity(TreePath path)
Called when removing paths. |
protected void |
assignValidity(TreePath path)
Called when unremoving paths. |
protected void |
beforeFindQuery(java.lang.String tableAlias,
java.lang.StringBuilder queryText,
java.util.List<java.lang.Object> parameters,
boolean whereWasAppended)
Overridden to append temporal conditions. |
java.util.List<ClosureTableTreeNode> |
findRemoved(ClosureTableTreeNode parent,
java.util.Map<java.lang.String,java.lang.Object> criteria)
|
java.util.List<ClosureTableTreeNode> |
findValidDirectChildren(java.util.List<ClosureTableTreeNode> subNodes)
Use this to retrieve children lists that do not contain removed nodes from trees returned by getFullTreeCacheable() . |
java.util.List<ClosureTableTreeNode> |
getAllRoots()
|
java.util.List<ClosureTableTreeNode> |
getFullTreeCacheable(ClosureTableTreeNode node)
|
protected java.lang.String |
getValidFromPropertyName()
Temporal extension. |
protected java.lang.String |
getValidToPropertyName()
Temporal extension. |
protected fri.util.database.jpa.tree.closuretable.CacheableTreeList |
newCacheableTreeList(ClosureTableTreeNode parent,
java.util.List<TreePath> breadthFirstTree)
Factory method for new CacheableTreeList. |
void |
removeAll()
Removes all roots, including the nodes below them. |
void |
removeAllPhysically()
Physically deletes everything, all roots and the trees below them. |
void |
removeHistoricizedTreesPhysically()
Physically deletes all historicized tree nodes in all roots, including their sub-nodes. |
protected void |
removeNode(ClosureTableTreeNode nodeToRemove)
Overridden to do nothing as related paths are historicized. |
protected void |
removePath(TreePath path)
Overridden to historicize path, using the historicizing date. |
void |
removePhysically(ClosureTableTreeNode node)
Physically deletes the tree under given node, including the node itself. |
protected void |
removeTree(ClosureTableTreeNode parent)
Overridden to set the historicizing date by calling validToOnRemove(). |
protected boolean |
shouldCloseGapOnRemove()
Overridden to return false to prevent closing a gap on remove and reordering siblings after historization. |
void |
unremove(ClosureTableTreeNode node)
Recovers the given removed (historicized) node, including all sub-nodes. |
Methods inherited from class fri.util.database.jpa.tree.closuretable.ClosureTableTreeDao |
---|
addChild, addChildAt, addChildBefore, copy, copyBefore, copyTo, copyToBeRoot, createRoot, find, find, findDirectChildren, findSubTree, getChildCount, getChildren, getLevel, getParent, getPath, getPathsToRemove, getRoot, getRoots, getTree, getTreeCacheable, getTreePathEntity, isChildOf, isEqualToOrChildOf, isLeaf, isRemoveReferencedNodes, isRoot, move, moveBefore, moveTo, moveToBeRoot, newTreePathInstance, pathEntityName, remove, save, setRemoveReferencedNodes, size, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface fri.util.database.jpa.tree.TreeDao |
---|
addChild, addChildAt, addChildBefore, checkUniqueConstraint, copy, copyBefore, copyTo, copyToBeRoot, createRoot, find, find, findDirectChildren, findSubTree, getChildCount, getChildren, getLevel, getParent, getPath, getRoot, getRoots, getTree, getTreeCacheable, isChildOf, isEqualToOrChildOf, isLeaf, isPersistent, isRoot, move, moveBefore, moveTo, moveToBeRoot, remove, setCheckUniqueConstraintOnUpdate, setCopiedNodeRenamer, setUniqueTreeConstraint, size, update |
Constructor Detail |
---|
public TemporalClosureTableTreeDao(java.lang.Class<? extends ClosureTableTreeNode> treeNodeEntityClass, java.lang.Class<? extends TreePath> treePathsEntityClass, boolean positionMatters, java.lang.String validFromPropertyName, java.lang.String validToPropertyName, DbSession session)
validFromPropertyName
- the name of the temporal valid-from property in TreePath, can be null.validToPropertyName
- the name of the temporal valid-to property in TreePath, can be null when append* and assign* are overridden.public TemporalClosureTableTreeDao(java.lang.Class<? extends ClosureTableTreeNode> treeNodeEntityClass, java.lang.String treeNodeEntity, java.lang.Class<? extends TreePath> treePathEntityClass, java.lang.String treePathEntity, boolean positionMatters, java.lang.String validFromPropertyName, java.lang.String validToPropertyName, DbSession session)
validFromPropertyName
- the name of the temporal valid-from property in TreePath, can be null.validToPropertyName
- the name of the temporal valid-to property in TreePath, can be null when append* and assign* are overridden.Method Detail |
---|
public java.util.List<ClosureTableTreeNode> getAllRoots()
getAllRoots
in interface TemporalTreeDao<ClosureTableTreeNode>
public java.util.List<ClosureTableTreeNode> findRemoved(ClosureTableTreeNode parent, java.util.Map<java.lang.String,java.lang.Object> criteria)
findRemoved
in interface TemporalTreeDao<ClosureTableTreeNode>
public java.util.List<ClosureTableTreeNode> getFullTreeCacheable(ClosureTableTreeNode node)
getFullTreeCacheable
in interface TemporalTreeDao<ClosureTableTreeNode>
public java.util.List<ClosureTableTreeNode> findValidDirectChildren(java.util.List<ClosureTableTreeNode> subNodes)
getFullTreeCacheable()
.
Use findDirectChildren()
on a fullTreeCacheable to retrieve children lists that
also contain removed nodes. The difference of both would be the removed children.
findValidDirectChildren
in interface TemporalTreeDao<ClosureTableTreeNode>
subNodes
- the sub-tree to retrieve children from, containing parent at first position.
public void removeAll()
removeAll
in interface TreeDao<ClosureTableTreeNode>
removeAll
in class ClosureTableTreeDao
public void unremove(ClosureTableTreeNode node)
unremove
in interface TemporalTreeDao<ClosureTableTreeNode>
public void removeAllPhysically()
removeAllPhysically
in interface TemporalTreeDao<ClosureTableTreeNode>
public void removePhysically(ClosureTableTreeNode node)
removePhysically
in interface TemporalTreeDao<ClosureTableTreeNode>
public void removeHistoricizedTreesPhysically()
removeHistoricizedTreesPhysically
in interface TemporalTreeDao<ClosureTableTreeNode>
protected fri.util.database.jpa.tree.closuretable.CacheableTreeList newCacheableTreeList(ClosureTableTreeNode parent, java.util.List<TreePath> breadthFirstTree)
newCacheableTreeList
in class ClosureTableTreeDao
protected void assignInvalidity(TreePath path)
path
- the tree-path to historicize.protected void assignValidity(TreePath path)
path
- the tree-path to unremove.protected final void beforeFindQuery(java.lang.String tableAlias, java.lang.StringBuilder queryText, java.util.List<java.lang.Object> parameters, boolean whereWasAppended)
beforeFindQuery
in class ClosureTableTreeDao
protected boolean shouldCloseGapOnRemove()
shouldCloseGapOnRemove
in class ClosureTableTreeDao
protected void removeTree(ClosureTableTreeNode parent)
removeTree
in class ClosureTableTreeDao
protected final void removeNode(ClosureTableTreeNode nodeToRemove)
removeNode
in class ClosureTableTreeDao
protected final void removePath(TreePath path)
removePath
in class ClosureTableTreeDao
protected final java.lang.String getValidFromPropertyName()
AbstractTreeDao
getValidFromPropertyName
in class AbstractTreeDao<ClosureTableTreeNode>
protected final java.lang.String getValidToPropertyName()
AbstractTreeDao
getValidToPropertyName
in class AbstractTreeDao<ClosureTableTreeNode>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |