Package com.logicaldoc.core.automation
Class FolderTool
- java.lang.Object
- 
- com.logicaldoc.core.automation.FolderTool
 
- 
 public class FolderTool extends Object Utility methods to handle folders from within the Automation- Since:
- 7.3
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Constructor SummaryConstructors Constructor Description FolderTool()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Foldercopy(Folder source, String targetPath, boolean foldersOnly, boolean inheritSecurity, String username)Copies a folder into another folderFoldercreatePath(Folder folder, String targetPath, String username)Creates a path, all existing nodes in the specified path will be reusedvoiddelete(long folderId, String username)Delete a folderStringdisplayUrl(long tenantId, long folderId)Prints the URL to display the folder inside the User InterfaceStringdisplayUrl(Folder folder)Prints the URL to display the folder inside the User InterfaceStringdisplayUrl(FolderHistory history)Prints the URL to display the folder inside the User InterfaceFolderfindByPath(String path)Finds the folder by it's pathFolderfindByPath(String path, Long tenantId)Finds the folder by it's pathStringgetPath(Long folderId)Calculates the full path of a foldervoidinitialize(Folder folder)Initializes lazy loaded collectionsvoidmerge(Folder source, Folder target, String username)Merges a folder into another foldervoidmove(Folder folder, String targetPath, String username)Moves a folder into a target foldervoidstore(Folder folder)Saves / updates a folder into the databasevoidstore(Folder folder, String username)Saves / updates a folder into the database
 
- 
- 
- 
Method Detail- 
displayUrlpublic String displayUrl(long tenantId, long folderId) Prints the URL to display the folder inside the User Interface- Parameters:
- tenantId- identifier of the tenant
- folderId- identifier of the folder
- Returns:
- the display URL
 
 - 
displayUrlpublic String displayUrl(Folder folder) Prints the URL to display the folder inside the User Interface- Parameters:
- folder- the folder to display
- Returns:
- the display URL
 
 - 
displayUrlpublic String displayUrl(FolderHistory history) Prints the URL to display the folder inside the User Interface- Parameters:
- history- event from which to get the folder's to display
- Returns:
- the display URL
 
 - 
getPathpublic String getPath(Long folderId) Calculates the full path of a folder- Parameters:
- folderId- identifier of the folder
- Returns:
- the path
 
 - 
findByPathpublic Folder findByPath(String path) Finds the folder by it's path- Parameters:
- path- the path to process
- Returns:
- the found folder
 
 - 
findByPathpublic Folder findByPath(String path, Long tenantId) Finds the folder by it's path- Parameters:
- path- the path to process
- tenantId- identifier of the tenant
- Returns:
- the found folder
 
 - 
storepublic void store(Folder folder) Saves / updates a folder into the database- Parameters:
- folder- the folder to save
 
 - 
storepublic void store(Folder folder, String username) Saves / updates a folder into the database- Parameters:
- folder- the folder to save
- username- the user in whose name the method is run
 
 - 
initializepublic void initialize(Folder folder) Initializes lazy loaded collections- Parameters:
- folder- the folder to initialize
 
 - 
deletepublic void delete(long folderId, String username) throws ExceptionDelete a folder- Parameters:
- folderId- identifier of the folder
- username- the user in whose name the method is run
- Throws:
- Exception- a generic error happened
 
 - 
movepublic void move(Folder folder, String targetPath, String username) throws Exception Moves a folder into a target folder- Parameters:
- folder- the folder to move
- targetPath- the full path of the target folder(if it does not exist it will be created)
- username- the user in whose name the method is run
- Throws:
- Exception- a generic error happened
 
 - 
copypublic Folder copy(Folder source, String targetPath, boolean foldersOnly, boolean inheritSecurity, String username) throws Exception Copies a folder into another folder- Parameters:
- source- the folder to copy
- targetPath- the full path of the target folder(if it does not exist it will be created)
- foldersOnly- true if only the folders tree has to be copied; if false, the documents will also be copied
- inheritSecurity- if true the new folder will 'point' to the parent for the security policies.
- username- the user in whose name the method is run
- Returns:
- The new folder created
- Throws:
- Exception- a generic error happened
 
 - 
mergepublic void merge(Folder source, Folder target, String username) throws Exception Merges a folder into another folder- Parameters:
- source- the folder to merge into the target
- target- the final container
- username- the user in whose name the method is run
- Throws:
- Exception- a generic error happened
 
 - 
createPathpublic Folder createPath(Folder folder, String targetPath, String username) Creates a path, all existing nodes in the specified path will be reused- Parameters:
- folder- folder used to take the root folder in case the- targetPathrepresents a relative path
- targetPath- absolute or relative(in relation to the document's parent folder) path to be created
- username- the user in whose name the method is run
- Returns:
- the folder leaf of the path
 
 
- 
 
-