@Component(value="squashtest.tm.service.deletion.RequirementNodeDeletionHandler") public class RequirementDeletionHandlerImpl extends AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder> implements RequirementNodeDeletionHandler
| Constructor and Description |
|---|
RequirementDeletionHandlerImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected OperationReport |
batchDeleteFolders(List<Long> folderIds) |
protected OperationReport |
batchDeleteNodes(List<Long> ids)
Removing a list of RequirementLibraryNodes means : - find all the attachment lists, - remove them, - remove the
nodes themselves
NOOP notice
This method is deprecated because it is no longer called by the super class : the method #deleteNodes has
been overridden in the present subclass, that now calls more specific methods.
|
protected OperationReport |
batchDeleteRequirement(List<Long> ids) |
protected OperationReport |
batchRemoveMilestoneVersion(List<Long> requirementIds,
Long milestoneId) |
protected OperationReport |
batchUnbindFromMilestone(List<Long> requirementIds)
Will unbind the given nodes from the given milestone.
|
OperationReport |
deleteNodes(List<Long> targetIds)
The following method is overridden from the abstract class because the business rule is special :
for each node selected by the user :
a/ if it is a folder : proceed as usual,
b/ if it is a requirement : delete it and bind its children to its parent.
|
protected List<Long> |
detectLockedNodes(List<Long> nodeIds)
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 List<SuppressionPreviewReport> |
diagnoseSuppression(List<Long> nodeIds)
Given their ids, that method should check the nodes and actually report the informations as specified in
NodeDeletionHandler.simulateDeletion(List). |
protected FolderDao<org.squashtest.tm.domain.requirement.RequirementFolder,org.squashtest.tm.domain.requirement.RequirementLibraryNode> |
getFolderDao()
The implemention should return which FolderDao to use depending on the end domain object.
|
protected boolean |
isMilestoneMode() |
protected void |
reportLocksByMilestone(List<Long> nodeIds,
List<SuppressionPreviewReport> preview) |
protected void |
reportMultipleMilestoneBinding(List<Long> targetVersionIds,
List<SuppressionPreviewReport> preview) |
protected void |
reportNoFoldersAllowed(List<Long> folderIds,
List<SuppressionPreviewReport> preview) |
protected void |
reportVersionLocksByMilestone(List<Long> versionIds,
List<SuppressionPreviewReport> preview) |
protected org.squashtest.tm.service.internal.deletion.RequirementDeletionHandlerImpl.TargetsSortedByAppropriatePunishment |
sortThatMess(List<Long> nodeIds)
Because nowaday deleting requirements is highly toxic for brain cells here is a method that will help out with
deciding if a node should :
be deleted as a folder (which is simpler)
be deleted totally as a requirement (with all its versions).
|
createLockedFileInferenceTree, findNodeHierarchy, findPairedNodeHierarchy, simulateDeletionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsimulateDeletionprotected FolderDao<org.squashtest.tm.domain.requirement.RequirementFolder,org.squashtest.tm.domain.requirement.RequirementLibraryNode> getFolderDao()
AbstractNodeDeletionHandlergetFolderDao in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>protected List<SuppressionPreviewReport> diagnoseSuppression(List<Long> nodeIds)
AbstractNodeDeletionHandler
Given their ids, that method should check the nodes and actually report the informations as specified in
NodeDeletionHandler.simulateDeletion(List). See AbstractNodeDeletionHandler.detectLockedNodes(List) for details regarding
the input list.
diagnoseSuppression in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>nodeIds - the complete list of the nodes involved in that report.protected void reportMultipleMilestoneBinding(List<Long> targetVersionIds, List<SuppressionPreviewReport> preview)
protected void reportVersionLocksByMilestone(List<Long> versionIds, List<SuppressionPreviewReport> preview)
protected void reportNoFoldersAllowed(List<Long> folderIds, List<SuppressionPreviewReport> preview)
protected void reportLocksByMilestone(List<Long> nodeIds, List<SuppressionPreviewReport> preview)
protected List<Long> detectLockedNodes(List<Long> nodeIds)
AbstractNodeDeletionHandlerGiven 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.
detectLockedNodes in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>nodeIds - all the node ids.protected org.squashtest.tm.service.internal.deletion.RequirementDeletionHandlerImpl.TargetsSortedByAppropriatePunishment sortThatMess(List<Long> nodeIds)
Because nowaday deleting requirements is highly toxic for brain cells here is a method that will help out with deciding if a node should :
The generic name for those different situations is contextual-deletion. Nodes that fall under one of those situations are thus referred to as contextually-deleted.
Another concern now : the fate of the selected nodes depend on what the user specifically picked. For each node picked by the user :
rule D1 : if it is a folder : contextual-delete the whole subtree
rule D2 : if it is a requirement : contextual-delete that requirement alone
Then, we can safely proceed with peace in mind knowing which node requires which treatment.
(non-Javadoc)public OperationReport deleteNodes(List<Long> targetIds)
The following method is overridden from the abstract class because the business rule is special : for each node selected by the user :
Another concern is the milestone mode. When regular entities such as test cases are deleted, they are either deleted, either spared because of business or sec rules. For requirements the problem is a bit more complex because of their versions. A version can be deleted, and also if that deleted version was the only one in a requirement then only that requirement can be deleted.
All of this is is handled for a good part by the logic in #sortThatMess(List, Long)
deleteNodes in interface NodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>deleteNodes in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>targetIds - the list of node ids selected by the user.AbstractNodeDeletionHandler.deleteNodes(java.util.List)protected OperationReport batchDeleteFolders(List<Long> folderIds)
protected OperationReport batchDeleteRequirement(List<Long> ids)
protected OperationReport batchRemoveMilestoneVersion(List<Long> requirementIds, Long milestoneId)
protected OperationReport batchUnbindFromMilestone(List<Long> requirementIds)
AbstractNodeDeletionHandlerbatchUnbindFromMilestone in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>protected OperationReport batchDeleteNodes(List<Long> ids)
batchDeleteNodes in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>ids - the doomed node ids.protected boolean isMilestoneMode()
isMilestoneMode in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>Copyright © 2010–2017 Henix, henix.fr. All rights reserved.