NODE - a kind of LibraryNodeFOLDER - the corresponding Folderpublic abstract class AbstractNodeDeletionHandler<NODE extends org.squashtest.tm.domain.library.LibraryNode,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>> extends Object implements NodeDeletionHandler<NODE,FOLDER>
This class is a abstract and generic implementation of NodeDeletionHandler that implements a few basic rules. Regardless of the end domain object (TestCase, Campaign etc) the common rules are :
#diagnoseSuppression(List) and #detectLockedNodes(List), which nodes are locked for other reasons. See the documentations of the subclasses
for more informations.
| Constructor and Description |
|---|
AbstractNodeDeletionHandler() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract OperationReport |
batchDeleteNodes(List<Long> ids,
Long milestoneId)
Will delete the nodes identified by the ids parameter.
|
protected abstract OperationReport |
batchUnbindFromMilestone(List<Long> ids,
Long milestoneId)
Will unbind the given nodes from the given milestone.
|
protected org.squashtest.tm.service.internal.deletion.LockedFolderInferenceTree |
createLockedFileInferenceTree(List<Long> targetIds,
Long milestoneId) |
OperationReport |
deleteNodes(List<Long> targetIds,
Long milestoneId)
NodeDeletionHandler#deleteNodes(List) |
protected abstract List<Long> |
detectLockedNodes(List<Long> nodeIds,
Long milestoneId)
Given a list of node ids, returns a sublist corresponding to the ids of the nodes which cannot be deleted according to the specs.
|
protected abstract List<SuppressionPreviewReport> |
diagnoseSuppression(List<Long> nodeIds,
Long milestoneId)
Given their ids, that method should check the nodes and actually report the informations as specified in
NodeDeletionHandler#simulateDeletion(List). |
protected List<Long> |
findNodeHierarchy(List<Long> rootNodeIds)
Accepts a list of node ids and returns themselves and their children as a flat list.
|
protected List<Long[]> |
findPairedNodeHierarchy(List<Long> rootNodeIds)
Accepts a list of ids and returns themselves and their children as a list of pairs, each pair being an array of long (node ids) such as [ parent.id, child.id ].
|
protected abstract FolderDao<FOLDER,NODE> |
getFolderDao()
The implemention should return which FolderDao to use depending on the end domain object.
|
List<SuppressionPreviewReport> |
simulateDeletion(List<Long> targetIds,
Long milestoneId)
NodeDeletionHandler#simulateDeletion(List) |
protected abstract FolderDao<FOLDER,NODE> getFolderDao()
public List<SuppressionPreviewReport> simulateDeletion(List<Long> targetIds, Long milestoneId)
NodeDeletionHandler#simulateDeletion(List)simulateDeletion in interface NodeDeletionHandler<NODE extends org.squashtest.tm.domain.library.LibraryNode,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>>targetIds - the ids of the input node.milestoneId - if non null, will carry on the simulation on milestone mode.public OperationReport deleteNodes(List<Long> targetIds, Long milestoneId)
NodeDeletionHandler#deleteNodes(List)deleteNodes in interface NodeDeletionHandler<NODE extends org.squashtest.tm.domain.library.LibraryNode,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>>targetIds - the list of node ids selected by the user.milestoneId - if non null, deletion will be performed in milestone modeprotected org.squashtest.tm.service.internal.deletion.LockedFolderInferenceTree createLockedFileInferenceTree(List<Long> targetIds, Long milestoneId)
protected List<Long[]> findPairedNodeHierarchy(List<Long> rootNodeIds)
Accepts a list of ids and returns themselves and their children as a list of pairs, each pair being an array of long (node ids) such as [ parent.id, child.id ].
see FolderDao.findPairedContentForList(List) for details. The nodes input nodes will be paired with null (no parents), and the leaves will be be paired with null (for children).
rootNodesIds - the ids defining the upper level of the hierarchy.protected List<Long> findNodeHierarchy(List<Long> rootNodeIds)
Accepts a list of node ids and returns themselves and their children as a flat list.
rootNodeIds - rootNodesIds the ids defining the upper level of the hierarchy.protected abstract List<Long> detectLockedNodes(List<Long> nodeIds, Long milestoneId)
Given a list of node ids, returns a sublist corresponding to the ids of the nodes which cannot be deleted according to the specs. The input list includes all the nodes and their children in the directory structure. The implementation is responsible to fetch any other dependencies needed for the completion of its task. The implementation is not required to resolve which folders are locked : this abstract class will handle that on the basis of the returned value.
nodeIds - all the node ids.milestoneId - if not null, the milestone mode will apply to the locked node detection.protected abstract List<SuppressionPreviewReport> diagnoseSuppression(List<Long> nodeIds, Long milestoneId)
Given their ids, that method should check the nodes and actually report the informations as specified in NodeDeletionHandler#simulateDeletion(List).
See #detectLockedNodes(List) for details regarding the input list.
nodeIds - the complete list of the nodes involved in that report.protected abstract OperationReport batchDeleteNodes(List<Long> ids, Long milestoneId)
ids - the doomed node ids.milestoneId - if non null, the deletion will be peformed in milestone mode.protected abstract OperationReport batchUnbindFromMilestone(List<Long> ids, Long milestoneId)
ids - milestoneId - Copyright © 2010-2015 Henix, henix.fr. All Rights Reserved.