@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,
Long milestoneId)
Deprecated.
|
protected OperationReport |
batchDeleteRequirement(List<Long> ids) |
protected OperationReport |
batchRemoveMilestoneVersion(List<Long> requirementIds,
Long milestoneId) |
protected OperationReport |
batchUnbindFromMilestone(List<Long> requirementIds,
Long milestoneId)
Will unbind the given nodes from the given milestone.
|
OperationReport |
deleteNodes(List<Long> targetIds,
Long milestoneId)
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,
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 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 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 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,
Long milestoneId)
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, Long milestoneId)
AbstractNodeDeletionHandlerGiven 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.
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, Long milestoneId)
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.milestoneId - if not null, the milestone mode will apply to the locked node detection.protected org.squashtest.tm.service.internal.deletion.RequirementDeletionHandlerImpl.TargetsSortedByAppropriatePunishment sortThatMess(List<Long> nodeIds, Long milestoneId)
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)org.squashtest.tm.service.internal.deletion.AbstractNodeDeletionHandler#deleteNodes(java.util.List)public OperationReport deleteNodes(List<Long> targetIds, Long milestoneId)
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.milestoneId - if non null, deletion will be performed in milestone modeorg.squashtest.tm.service.internal.deletion.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, Long milestoneId)
AbstractNodeDeletionHandlerbatchUnbindFromMilestone in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>@Deprecated protected OperationReport batchDeleteNodes(List<Long> ids, Long milestoneId)
AbstractNodeDeletionHandlerbatchDeleteNodes in class AbstractNodeDeletionHandler<org.squashtest.tm.domain.requirement.RequirementLibraryNode,org.squashtest.tm.domain.requirement.RequirementFolder>ids - the doomed node ids.milestoneId - if non null, the deletion will be peformed in milestone mode.Copyright © 2010-2016 Henix, henix.fr. All Rights Reserved.