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

Nested Class Summary
protected  class AbstractLibraryNavigationService.SecurityCheckableObject
           
 
Field Summary
protected static String COPY_TOKEN
          token appended to the name of a copy
 
Constructor Summary
AbstractLibraryNavigationService()
           
 
Method Summary
 void addFolderToFolder(long destinationId, FOLDER newFolder)
           
 void addFolderToLibrary(long destinationId, FOLDER newFolder)
           
protected  void checkPermission(AbstractLibraryNavigationService.SecurityCheckableObject... checkableObjects)
           
 List<NODE> copyNodesToFolder(long destinationId, Long[] sourceNodesIds)
          will create a deep copy of the given LibraryNodes, paste them in the destination 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.
 LIBRARY findCreatableLibrary(long libraryId)
           
 FOLDER findFolder(long folderId)
           
 List<NODE> findFolderContent(long folderId)
          Returns the content of the folder designated by its id.
 LIBRARY findLibrary(long libraryId)
           
 LIBRARY findLibraryOfRootNodeIfExist(NODE node)
          That method should find the library of the root node
 List<NODE> findLibraryRootContent(long libraryId)
           
 FOLDER findParentIfExists(LibraryNode node)
          That method should find the parentFolder of the library Node if it has one
 int generateUniqueCopyNumber(List<String> copiesNames, String sourceName)
           
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
 

Field Detail

COPY_TOKEN

protected static final String COPY_TOKEN
token appended to the name of a copy

See Also:
Constant Field Values
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>

findCreatableLibrary

public final LIBRARY findCreatableLibrary(long libraryId)
Specified by:
findCreatableLibrary 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>

findParentIfExists

public FOLDER findParentIfExists(LibraryNode node)
Description copied from interface: LibraryNavigationService
That method should find the parentFolder of the library Node if it has one

Specified by:
findParentIfExists in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Returns:
the parent node or null if do not exists

findLibraryOfRootNodeIfExist

public LIBRARY findLibraryOfRootNodeIfExist(NODE node)
Description copied from interface: LibraryNavigationService
That method should find the library of the root node

Specified by:
findLibraryOfRootNodeIfExist in interface LibraryNavigationService<LIBRARY extends Library<NODE>,FOLDER extends Folder<NODE>,NODE extends LibraryNode>
Returns:
the library or null

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[] sourceNodesIds)
Description copied from interface: LibraryNavigationService
will create a deep copy of the given LibraryNodes, paste them in the destination 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.
sourceNodesIds - 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,
                                    String sourceName)

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:

checkPermission

protected void checkPermission(AbstractLibraryNavigationService.SecurityCheckableObject... checkableObjects)

createPastableCopy

protected NODE createPastableCopy(NODE node)


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