org.squashtest.tm.service.internal.testcase
Class CustomTestCaseModificationServiceImpl

java.lang.Object
  extended by org.squashtest.tm.service.internal.testcase.CustomTestCaseModificationServiceImpl
All Implemented Interfaces:
CustomTestCaseFinder, CustomTestCaseModificationService

@Service(value="CustomTestCaseModificationService")
@Transactional
public class CustomTestCaseModificationServiceImpl
extends Object
implements CustomTestCaseModificationService

Author:
Gregory Fouquet

Field Summary
protected  PrivateCustomFieldValueService customFieldValuesService
           
 
Constructor Summary
CustomTestCaseModificationServiceImpl()
           
 
Method Summary
 org.squashtest.tm.domain.testcase.ActionTestStep addActionTestStep(long parentTestCaseId, org.squashtest.tm.domain.testcase.ActionTestStep newTestStep)
           
 org.squashtest.tm.domain.testcase.ActionTestStep addActionTestStep(long parentTestCaseId, org.squashtest.tm.domain.testcase.ActionTestStep newTestStep, Map<Long,String> customFieldValues)
          Adds an action test step to a test case, and its initial custom field values.
 org.squashtest.tm.domain.testautomation.AutomatedTest bindAutomatedTest(Long testCaseId, Long taProjectId, String testName)
           
 void changeImportanceAuto(long testCaseId, boolean auto)
          will change the test case importance too if auto is true.
 void changeTestStepPosition(long testCaseId, long testStepId, int newStepPosition)
          Deprecated. 
 void changeTestStepsPosition(long testCaseId, int newPosition, List<Long> stepIds)
          Will move a list of steps to a new position.
 List<org.squashtest.tm.domain.testcase.TestCase> findAllByAncestorIds(Collection<Long> folderIds)
          Fetches all the test cases which have at least one ancestor from the given list.
 List<org.squashtest.tm.domain.testcase.TestCase> findAllCallingTestCases(long calleeId)
          Fetches all the test cases calling the one matching the given id param.
 Collection<TestAutomationProjectContent> findAssignableAutomationTests(long testCaseId)
           
 org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.testcase.TestCase>> findCallingTestCases(long testCaseId, org.squashtest.tm.core.foundation.collection.PagingAndSorting sorting)
          That method returns the list of test cases having at least one CallTestStep directly calling the test case identified by testCaseId.
 List<org.squashtest.tm.domain.testcase.TestStep> findStepsByTestCaseId(long testCaseId)
           
 org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.testcase.TestStep>> findStepsByTestCaseIdFiltered(long testCaseId, org.squashtest.tm.core.foundation.collection.Paging paging)
           
 org.squashtest.tm.domain.testcase.TestCase findTestCaseFromStep(long testStepId)
           
 org.squashtest.tm.domain.testcase.TestCase findTestCaseWithSteps(long testCaseId)
           
protected  void initCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity, Map<Long,String> initialCustomFieldValues)
          initialCustomFieldValues maps the id of a CustomField to the value of the corresponding CustomFieldValues for that BoundEntity. read it again until it makes sense. it assumes that the CustomFieldValues instances already exists.
 void pasteCopiedTestStep(long testCaseId, long idToCopyAfter, long copiedTestStepId)
          will insert a test step into a test case script, possibly after a step (the position), given their Ids.
 void pasteCopiedTestStepToLastIndex(long testCaseId, long copiedTestStepId)
          will insert a test step into a test case script at the last position
 void removeAutomation(long testCaseId)
          Will delete the link
 void removeListOfSteps(long testCaseId, List<Long> testStepIds)
           
 void removeStepFromTestCase(long testCaseId, long testStepId)
           
 void rename(long testCaseId, String newName)
           
 void updateTestStepAction(long testStepId, String newAction)
           
 void updateTestStepExpectedResult(long testStepId, String newExpectedResult)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

customFieldValuesService

@Inject
protected PrivateCustomFieldValueService customFieldValuesService
Constructor Detail

CustomTestCaseModificationServiceImpl

public CustomTestCaseModificationServiceImpl()
Method Detail

rename

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void rename(long testCaseId,
                                String newName)
            throws org.squashtest.tm.exception.DuplicateNameException
Specified by:
rename in interface CustomTestCaseModificationService
Throws:
org.squashtest.tm.exception.DuplicateNameException

findStepsByTestCaseId

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'READ\') or hasRole(\'ROLE_ADMIN\')")
@Transactional(readOnly=true)
public List<org.squashtest.tm.domain.testcase.TestStep> findStepsByTestCaseId(long testCaseId)
Specified by:
findStepsByTestCaseId in interface CustomTestCaseFinder

addActionTestStep

@PreAuthorize(value="hasPermission(#parentTestCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public org.squashtest.tm.domain.testcase.ActionTestStep addActionTestStep(long parentTestCaseId,
                                                                                       org.squashtest.tm.domain.testcase.ActionTestStep newTestStep)
Specified by:
addActionTestStep in interface CustomTestCaseModificationService

addActionTestStep

@PreAuthorize(value="hasPermission(#parentTestCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public org.squashtest.tm.domain.testcase.ActionTestStep addActionTestStep(long parentTestCaseId,
                                                                                       org.squashtest.tm.domain.testcase.ActionTestStep newTestStep,
                                                                                       Map<Long,String> customFieldValues)
Description copied from interface: CustomTestCaseModificationService
Adds an action test step to a test case, and its initial custom field values. The initial custom field values are passed as a Map, that maps the id of the CustomField to the values of the corresponding CustomFieldValue. Read that last sentence again.

Specified by:
addActionTestStep in interface CustomTestCaseModificationService

updateTestStepAction

@PreAuthorize(value="hasPermission(#testStepId, \'org.squashtest.tm.domain.testcase.TestStep\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void updateTestStepAction(long testStepId,
                                              String newAction)
Specified by:
updateTestStepAction in interface CustomTestCaseModificationService

updateTestStepExpectedResult

@PreAuthorize(value="hasPermission(#testStepId, \'org.squashtest.tm.domain.testcase.TestStep\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void updateTestStepExpectedResult(long testStepId,
                                                      String newExpectedResult)
Specified by:
updateTestStepExpectedResult in interface CustomTestCaseModificationService

changeTestStepPosition

@Deprecated
@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void changeTestStepPosition(long testCaseId,
                                                           long testStepId,
                                                           int newStepPosition)
Deprecated. 

Specified by:
changeTestStepPosition in interface CustomTestCaseModificationService

changeTestStepsPosition

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void changeTestStepsPosition(long testCaseId,
                                                 int newPosition,
                                                 List<Long> stepIds)
Description copied from interface: CustomTestCaseModificationService
Will move a list of steps to a new position.

Specified by:
changeTestStepsPosition in interface CustomTestCaseModificationService
Parameters:
testCaseId - the id of the test case
newPosition - the position we want the first element of movedSteps to be once the operation is complete

removeStepFromTestCase

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void removeStepFromTestCase(long testCaseId,
                                                long testStepId)
Specified by:
removeStepFromTestCase in interface CustomTestCaseModificationService

findTestCaseWithSteps

@PostAuthorize(value="hasPermission(returnObject, \'READ\') or hasRole(\'ROLE_ADMIN\')")
@Transactional(readOnly=true)
public org.squashtest.tm.domain.testcase.TestCase findTestCaseWithSteps(long testCaseId)
Specified by:
findTestCaseWithSteps in interface CustomTestCaseFinder

removeListOfSteps

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void removeListOfSteps(long testCaseId,
                                           List<Long> testStepIds)
Specified by:
removeListOfSteps in interface CustomTestCaseModificationService

findStepsByTestCaseIdFiltered

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'READ\') or hasRole(\'ROLE_ADMIN\')")
@Transactional(readOnly=true)
public org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.testcase.TestStep>> findStepsByTestCaseIdFiltered(long testCaseId,
                                                                                                                                                                                     org.squashtest.tm.core.foundation.collection.Paging paging)
Specified by:
findStepsByTestCaseIdFiltered in interface CustomTestCaseFinder

pasteCopiedTestStep

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void pasteCopiedTestStep(long testCaseId,
                                             long idToCopyAfter,
                                             long copiedTestStepId)
Description copied from interface: CustomTestCaseModificationService
will insert a test step into a test case script, possibly after a step (the position), given their Ids.

Specified by:
pasteCopiedTestStep in interface CustomTestCaseModificationService
Parameters:
testCaseId - the id of the test case.
idToCopyAfter - the id of the step after which we'll insert the copy of a step, may be null.
copiedTestStepId - the id of the testStep to copy.

pasteCopiedTestStepToLastIndex

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void pasteCopiedTestStepToLastIndex(long testCaseId,
                                                        long copiedTestStepId)
Description copied from interface: CustomTestCaseModificationService
will insert a test step into a test case script at the last position

Specified by:
pasteCopiedTestStepToLastIndex in interface CustomTestCaseModificationService
Parameters:
testCaseId - the id of the test case.
copiedTestStepId - the id of the testStep to copy.

findCallingTestCases

@Transactional(readOnly=true)
public org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.testcase.TestCase>> findCallingTestCases(long testCaseId,
                                                                                                                                                               org.squashtest.tm.core.foundation.collection.PagingAndSorting sorting)
Description copied from interface: CustomTestCaseFinder
That method returns the list of test cases having at least one CallTestStep directly calling the test case identified by testCaseId. The list is wrapped in a PagedCollectionHolder, that contains meta informations regarding the filtering, as usual.

Specified by:
findCallingTestCases in interface CustomTestCaseFinder
Parameters:
testCaseId - the Id of the called test case.
sorting - the sorting parameters.
Returns:
a non null but possibly empty PagedCollectionHolder wrapping the list of first-level calling test cases.

changeImportanceAuto

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public void changeImportanceAuto(long testCaseId,
                                              boolean auto)
Description copied from interface: CustomTestCaseModificationService
will change the test case importance too if auto is true.

Specified by:
changeImportanceAuto in interface CustomTestCaseModificationService

findAssignableAutomationTests

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
@Transactional(readOnly=true)
public Collection<TestAutomationProjectContent> findAssignableAutomationTests(long testCaseId)
Specified by:
findAssignableAutomationTests in interface CustomTestCaseModificationService

bindAutomatedTest

@PreAuthorize(value="hasPermission(#testCaseId, \'org.squashtest.tm.domain.testcase.TestCase\' , \'WRITE\') or hasRole(\'ROLE_ADMIN\')")
public org.squashtest.tm.domain.testautomation.AutomatedTest bindAutomatedTest(Long testCaseId,
                                                                                            Long taProjectId,
                                                                                            String testName)
Specified by:
bindAutomatedTest in interface CustomTestCaseModificationService

removeAutomation

public void removeAutomation(long testCaseId)
Description copied from interface: CustomTestCaseModificationService
Will delete the link

Specified by:
removeAutomation in interface CustomTestCaseModificationService

initCustomFieldValues

protected void initCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity,
                                     Map<Long,String> initialCustomFieldValues)
initialCustomFieldValues maps the id of a CustomField to the value of the corresponding CustomFieldValues for that BoundEntity. read it again until it makes sense. it assumes that the CustomFieldValues instances already exists.

Parameters:
entity -
initialCustomFieldValues -

findAllByAncestorIds

@PostFilter(value="hasPermission(filterObject , \'READ\') or hasRole(\'ROLE_ADMIN\')")
public List<org.squashtest.tm.domain.testcase.TestCase> findAllByAncestorIds(Collection<Long> folderIds)
Description copied from interface: CustomTestCaseFinder
Fetches all the test cases which have at least one ancestor from the given list. If ancestorID is a folder id, fetches all its descendant test cases. If it is a test cases id, fetches the given test case.

Specified by:
findAllByAncestorIds in interface CustomTestCaseFinder
Returns:
See Also:
org.squashtest.tm.service.testcase.CustomTestCaseFinder#findAllByAncestorIds(java.util.List)

findAllCallingTestCases

@PostFilter(value="hasPermission(filterObject , \'READ\') or hasRole(\'ROLE_ADMIN\')")
public List<org.squashtest.tm.domain.testcase.TestCase> findAllCallingTestCases(long calleeId)
Description copied from interface: CustomTestCaseFinder
Fetches all the test cases calling the one matching the given id param.

Specified by:
findAllCallingTestCases in interface CustomTestCaseFinder
Returns:
all calling test cases
See Also:
CustomTestCaseFinder.findAllCallingTestCases(long)

findTestCaseFromStep

public org.squashtest.tm.domain.testcase.TestCase findTestCaseFromStep(long testStepId)
Specified by:
findTestCaseFromStep in interface CustomTestCaseFinder


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