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

java.lang.Object
  extended by org.squashtest.tm.service.internal.library.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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>
extends Object
implements LibraryNavigationService<LIBRARY,FOLDER,NODE>

Generic implementation of a library navigation service.

Author:
Gregory Fouquet

Field Summary
protected static String COPY_TOKEN
          token appended to the name of a copy
protected  PermissionEvaluationService permissionService
           
 
Constructor Summary
AbstractLibraryNavigationService()
           
 
Method Summary
 void addFolderToFolder(long destinationId, FOLDER newFolder)
           
 void addFolderToLibrary(long destinationId, FOLDER newFolder)
           
protected  void checkPermission(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[] targetIds)
          same, when the destination is a Library.
protected  void createCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)
           
protected  void createCustomFieldValues(Collection<? extends org.squashtest.tm.domain.customfield.BoundEntity> entities)
           
 OperationReport 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(org.squashtest.tm.domain.library.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()
           
protected abstract  PasteStrategy<FOLDER,NODE> getPasteToFolderStrategy()
           
protected abstract  PasteStrategy<LIBRARY,NODE> getPasteToLibraryStrategy()
           
protected  void initCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity, Map<Long,String> initialCustomFieldValues)
           
protected  void makeCopierStrategy(PasteStrategy<?,?> pasteStrategy)
           
protected  void makeMoverStrategy(PasteStrategy<?,?> pasteStrategy)
           
 void moveNodesToFolder(long destinationId, Long[] targetIds)
           
 void moveNodesToLibrary(long destinationId, Long[] targetIds)
           
 void renameFolder(long folderId, String newName)
          Deprecated. 
protected  List<? extends org.squashtest.tm.domain.library.ExportData> setFullFolderPath(List<? extends org.squashtest.tm.domain.library.ExportData> dataset)
           
 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

permissionService

@Inject
protected PermissionEvaluationService permissionService
Constructor Detail

AbstractLibraryNavigationService

public AbstractLibraryNavigationService()
Method Detail

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()

getPasteToFolderStrategy

protected abstract PasteStrategy<FOLDER,NODE> getPasteToFolderStrategy()

getPasteToLibraryStrategy

protected abstract PasteStrategy<LIBRARY,NODE> getPasteToLibraryStrategy()

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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>
Returns:

findLibrary

public final LIBRARY findLibrary(long libraryId)
Specified by:
findLibrary in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>

findCreatableLibrary

public final LIBRARY findCreatableLibrary(long libraryId)
Specified by:
findCreatableLibrary in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>

findFolder

public final FOLDER findFolder(long folderId)
Specified by:
findFolder in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>

renameFolder

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

Specified by:
renameFolder in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>

addFolderToLibrary

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

addFolderToFolder

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

findParentIfExists

public FOLDER findParentIfExists(org.squashtest.tm.domain.library.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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>
Returns:
the library or null

createCustomFieldValues

protected void createCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity)

createCustomFieldValues

protected void createCustomFieldValues(Collection<? extends org.squashtest.tm.domain.customfield.BoundEntity> entities)

initCustomFieldValues

protected void initCustomFieldValues(org.squashtest.tm.domain.customfield.BoundEntity entity,
                                     Map<Long,String> initialCustomFieldValues)

moveNodesToFolder

public void moveNodesToFolder(long destinationId,
                              Long[] targetIds)
Specified by:
moveNodesToFolder in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>

moveNodesToLibrary

public void moveNodesToLibrary(long destinationId,
                               Long[] targetIds)
Specified by:
moveNodesToLibrary in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.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[] targetIds)
Description copied from interface: LibraryNavigationService
same, when the destination is a Library.

Specified by:
copyNodesToLibrary in interface LibraryNavigationService<LIBRARY extends org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>
Parameters:
destinationId - the id of the library where you need to copy to.
targetIds - 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)

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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>
Returns:

deleteNodes

public OperationReport 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 org.squashtest.tm.domain.library.Library<NODE>,FOLDER extends org.squashtest.tm.domain.library.Folder<NODE>,NODE extends org.squashtest.tm.domain.library.LibraryNode>
Returns:

makeCopierStrategy

protected void makeCopierStrategy(PasteStrategy<?,?> pasteStrategy)

makeMoverStrategy

protected void makeMoverStrategy(PasteStrategy<?,?> pasteStrategy)

checkPermission

protected void checkPermission(SecurityCheckableObject... checkableObjects)

setFullFolderPath

protected List<? extends org.squashtest.tm.domain.library.ExportData> setFullFolderPath(List<? extends org.squashtest.tm.domain.library.ExportData> dataset)


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