org.squashtest.csp.tm.internal.service
Class AbstractLibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

java.lang.Object
  extended by org.squashtest.csp.tm.internal.service.AbstractLibraryNavigationService<LIBRARY,FOLDER,NODE>
Type Parameters:
LIBRARY -
FOLDER -
NODE -
All Implemented Interfaces:
LibraryNavigationService<LIBRARY,FOLDER,NODE>
Direct Known Subclasses:
CampaignLibraryNavigationServiceImpl, RequirementLibraryNavigationServiceImpl, TestCaseLibraryNavigationServiceImpl

@Transactional
public abstract class AbstractLibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
extends Object
implements LibraryNavigationService<LIBRARY,FOLDER,NODE>

Generic implementation of a library navigation service.

Author:
Gregory Fouquet

Constructor Summary
AbstractLibraryNavigationService()
           
 
Method Summary
 void addFolderToFolder(long destinationId, FOLDER newFolder)
           
 void addFolderToLibrary(long destinationId, FOLDER newFolder)
           
 List<NODE> copyNodesToFolder(long destinationId, Long[] targetId)
          will create a deep copy of the given LibraryNodes, paste them in the target folder, and return the copies.
 List<NODE> copyNodesToLibrary(long destinationId, Long[] targetId)
          same, when the destination is a Library.
 FOLDER createCopyFolder(long folderId)
           
protected  NODE createPastableCopy(NODE node)
           
 List<Long> deleteNodes(List<Long> targetIds)
          that method should delete the nodes.
 FOLDER findFolder(long folderId)
           
 List<NODE> findFolderContent(long folderId)
          Returns the content of the folder designated by its id.
 LIBRARY findLibrary(long libraryId)
           
 List<NODE> findLibraryRootContent(long libraryId)
           
 int generateUniqueCopyNumber(List<String> copiesNames)
           
protected abstract  NodeDeletionHandler<NODE,FOLDER> getDeletionHandler()
           
protected abstract  FolderDao<FOLDER,NODE> getFolderDao()
           
protected abstract  LibraryDao<LIBRARY,NODE> getLibraryDao()
           
protected abstract  LibraryNodeDao<NODE> getLibraryNodeDao()
           
 void modeNodesToFolder(long destinationId, Long[] targetIds)
           
 void moveNodesToLibrary(long destinationId, Long[] targetIds)
           
 void renameFolder(long folderId, String newName)
          Deprecated. 
 void setPermissionService(org.squashtest.csp.core.service.security.PermissionEvaluationService permissionService)
           
 List<SuppressionPreviewReport> simulateDeletion(List<Long> targetIds)
          that method should investigate the consequences of the deletion request, and return a report about what will happen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLibraryNavigationService

public AbstractLibraryNavigationService()
Method Detail

setPermissionService

@ServiceReference
public void setPermissionService(org.squashtest.csp.core.service.security.PermissionEvaluationService permissionService)

getFolderDao

protected abstract FolderDao<FOLDER,NODE> getFolderDao()

getLibraryDao

protected abstract LibraryDao<LIBRARY,NODE> getLibraryDao()

getLibraryNodeDao

protected abstract LibraryNodeDao<NODE> getLibraryNodeDao()

getDeletionHandler

protected abstract NodeDeletionHandler<NODE,FOLDER> getDeletionHandler()

findLibraryRootContent

@PostFilter(value="hasPermission(filterObject, \'READ\') or hasRole(\'ROLE_ADMIN\')")
public final List<NODE> findLibraryRootContent(long libraryId)
Specified by:
findLibraryRootContent in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

findFolderContent

@PostFilter(value="hasPermission(filterObject, \'READ\') or hasRole(\'ROLE_ADMIN\')")
public final List<NODE> findFolderContent(long folderId)
Description copied from interface: LibraryNavigationService
Returns the content of the folder designated by its id.

Specified by:
findFolderContent in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Returns:

findLibrary

public final LIBRARY findLibrary(long libraryId)
Specified by:
findLibrary in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

findFolder

public final FOLDER findFolder(long folderId)
Specified by:
findFolder in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

renameFolder

@Deprecated
public final void renameFolder(long folderId,
                                          String newName)
Deprecated. 

Specified by:
renameFolder in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

addFolderToLibrary

public final void addFolderToLibrary(long destinationId,
                                     FOLDER newFolder)
Specified by:
addFolderToLibrary in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

addFolderToFolder

public final void addFolderToFolder(long destinationId,
                                    FOLDER newFolder)
Specified by:
addFolderToFolder in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

modeNodesToFolder

public void modeNodesToFolder(long destinationId,
                              Long[] targetIds)
Specified by:
modeNodesToFolder in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

moveNodesToLibrary

public void moveNodesToLibrary(long destinationId,
                               Long[] targetIds)
Specified by:
moveNodesToLibrary in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>

copyNodesToFolder

public List<NODE> copyNodesToFolder(long destinationId,
                                    Long[] targetId)
Description copied from interface: LibraryNavigationService
will create a deep copy of the given LibraryNodes, paste them in the target folder, and return the copies.

Specified by:
copyNodesToFolder in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Parameters:
destinationId - the id of the folder where you need to copy to.
targetId - the list of the librarynodes we want copies of.
Returns:
the list of the copies themselves.

copyNodesToLibrary

public List<NODE> copyNodesToLibrary(long destinationId,
                                     Long[] targetId)
Description copied from interface: LibraryNavigationService
same, when the destination is a Library.

Specified by:
copyNodesToLibrary in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Parameters:
destinationId - the id of the library where you need to copy to.
targetId - the list of the librarynodes we want copies of.
Returns:
the list of the copies themselves.

generateUniqueCopyNumber

public int generateUniqueCopyNumber(List<String> copiesNames)

createCopyFolder

public FOLDER createCopyFolder(long folderId)

simulateDeletion

public List<SuppressionPreviewReport> simulateDeletion(List<Long> targetIds)
Description copied from interface: LibraryNavigationService
that method should investigate the consequences of the deletion request, and return a report about what will happen.

Specified by:
simulateDeletion in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Returns:

deleteNodes

public List<Long> deleteNodes(List<Long> targetIds)
Description copied from interface: LibraryNavigationService
that method should delete the nodes. It still takes care of non deletable nodes so the implementation should filter out the ids who can't be deleted.

Specified by:
deleteNodes in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Returns:

createPastableCopy

protected NODE createPastableCopy(NODE node)


Copyright © 2010-2012 Squashtest TM, Squashtest.org. All Rights Reserved.