org.squashtest.tm.service.internal.library
Class TreeNodeCopier

java.lang.Object
  extended by org.squashtest.tm.service.internal.library.TreeNodeCopier
All Implemented Interfaces:
org.squashtest.tm.domain.library.NodeVisitor, PasteOperation

@Component
@Scope(value="prototype")
public class TreeNodeCopier
extends Object
implements org.squashtest.tm.domain.library.NodeVisitor, PasteOperation


Constructor Summary
TreeNodeCopier()
           
 
Method Summary
 boolean isOkToGoDeeper()
          will say if the operation allows to go process node's childrens after operation.
 org.squashtest.tm.domain.library.TreeNode performOperation(org.squashtest.tm.domain.library.TreeNode source, org.squashtest.tm.domain.library.NodeContainer<org.squashtest.tm.domain.library.TreeNode> destination)
          Some operation involving a node and another node will happen, ie the source will be copied or moved to the destination.
 void visit(org.squashtest.tm.domain.campaign.Campaign source)
           
 void visit(org.squashtest.tm.domain.campaign.CampaignFolder campaignFolder)
           
 void visit(org.squashtest.tm.domain.library.Folder source, FolderDao dao)
           
 void visit(org.squashtest.tm.domain.campaign.Iteration source)
          Will copy paste the iteration with it's test-suites.
 void visit(org.squashtest.tm.domain.requirement.Requirement source)
           
 void visit(org.squashtest.tm.domain.requirement.RequirementFolder requirementFolder)
           
 void visit(org.squashtest.tm.domain.testcase.TestCase source)
           
 void visit(org.squashtest.tm.domain.testcase.TestCaseFolder testCaseFolder)
           
 void visit(org.squashtest.tm.domain.campaign.TestSuite source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeNodeCopier

public TreeNodeCopier()
Method Detail

performOperation

public org.squashtest.tm.domain.library.TreeNode performOperation(org.squashtest.tm.domain.library.TreeNode source,
                                                                  org.squashtest.tm.domain.library.NodeContainer<org.squashtest.tm.domain.library.TreeNode> destination)
Description copied from interface: PasteOperation
Some operation involving a node and another node will happen, ie the source will be copied or moved to the destination. Also returns a TreeNode resulting from this operation, that will be either the copy of the source or the source itself.

Specified by:
performOperation in interface PasteOperation

visit

public void visit(org.squashtest.tm.domain.library.Folder source,
                  FolderDao dao)

visit

public void visit(org.squashtest.tm.domain.campaign.Campaign source)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.campaign.Iteration source)
Will copy paste the iteration with it's test-suites.
Hence it is not ok to go deeper with the paste strategy : we don't want the test-suites to be copied twice.

Why don't we use the paste strategy to go through the test-suites ?

Because of functional rules : the requirements for "copying an test-suite alone" and "copying test-suites of a copied iteration" are different.
  1. When copying a test-suite alone all test-plan item of the concerned test-suite will be added to the iteration even if there were already contained by the iteration.
  2. When copying an interaction, it's copied test-suite should be bound to the already copied iteration-test-plan-items.

Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.campaign.TestSuite source)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.requirement.Requirement source)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.testcase.TestCase source)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.campaign.CampaignFolder campaignFolder)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.requirement.RequirementFolder requirementFolder)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

visit

public void visit(org.squashtest.tm.domain.testcase.TestCaseFolder testCaseFolder)
Specified by:
visit in interface org.squashtest.tm.domain.library.NodeVisitor

isOkToGoDeeper

public boolean isOkToGoDeeper()
Description copied from interface: PasteOperation
will say if the operation allows to go process node's childrens after operation. see visit(org.squashtest.tm.domain.campaign.Iteration) for an example of when it is not ok.

Specified by:
isOkToGoDeeper in interface PasteOperation
Returns:


Copyright © 2010-2013 Henix, henix.fr. All Rights Reserved.