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 Summary
Constructors Constructor Description FolderTool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Folder
copy(Folder source, String targetPath, boolean foldersOnly, String securityOption, String username)
Copies a folder into another folderFolder
createPath(Folder folder, String targetPath, String username)
Creates a path, all existing nodes in the specified path will be reusedvoid
delete(long folderId, String username)
Delete a folderString
displayUrl(long tenantId, long folderId)
Prints the URL to display the folder inside the User InterfaceString
displayUrl(Folder folder)
Prints the URL to display the folder inside the User InterfaceString
displayUrl(FolderHistory history)
Prints the URL to display the folder inside the User InterfaceFolder
findByPath(String path)
Finds the folder by it's pathFolder
findByPath(String path, Long tenantId)
Finds the folder by it's pathString
getPath(Long folderId)
Calculates the full path of a foldervoid
initialize(Folder folder)
Initializes lazy loaded collectionsvoid
merge(Folder source, Folder target, String username)
Merges a folder into another foldervoid
move(Folder folder, String targetPath, String username)
Moves a folder into a target foldervoid
store(Folder folder)
Saves / updates a folder into the databasevoid
store(Folder folder, String username)
Saves / updates a folder into the database
-
-
-
Method Detail
-
displayUrl
public String displayUrl(long tenantId, long folderId)
Prints the URL to display the folder inside the User Interface- Parameters:
tenantId
- identifier of the tenantfolderId
- identifier of the folder- Returns:
- the display URL
-
displayUrl
public 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
-
displayUrl
public 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
-
getPath
public String getPath(Long folderId) throws PersistenceException
Calculates the full path of a folder- Parameters:
folderId
- identifier of the folder- Returns:
- the path
- Throws:
PersistenceException
- error at database level
-
findByPath
public Folder findByPath(String path)
Finds the folder by it's path- Parameters:
path
- the path to process- Returns:
- the found folder
-
findByPath
public Folder findByPath(String path, Long tenantId)
Finds the folder by it's path- Parameters:
path
- the path to processtenantId
- identifier of the tenant- Returns:
- the found folder
-
store
public void store(Folder folder)
Saves / updates a folder into the database- Parameters:
folder
- the folder to save
-
store
public void store(Folder folder, String username)
Saves / updates a folder into the database- Parameters:
folder
- the folder to saveusername
- the user in whose name the method is run
-
initialize
public void initialize(Folder folder)
Initializes lazy loaded collections- Parameters:
folder
- the folder to initialize
-
delete
public void delete(long folderId, String username) throws Exception
Delete a folder- Parameters:
folderId
- identifier of the folderusername
- the user in whose name the method is run- Throws:
Exception
- a generic error happened
-
move
public void move(Folder folder, String targetPath, String username) throws Exception
Moves a folder into a target folder- Parameters:
folder
- the folder to movetargetPath
- 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
-
copy
public Folder copy(Folder source, String targetPath, boolean foldersOnly, String securityOption, String username) throws Exception
Copies a folder into another folder- Parameters:
source
- the folder to copytargetPath
- 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 copiedsecurityOption
- How to assign the security policies to the newly created folders:- null or none: empty security policies
- inherit: the new folder will point to the parent for the security policies
- replicate: the new folder will have a copy of the security policies of the source folder
username
- the user in whose name the method is run- Returns:
- The new folder created
- Throws:
Exception
- a generic error happened
-
merge
public void merge(Folder source, Folder target, String username) throws Exception
Merges a folder into another folder- Parameters:
source
- the folder to merge into the targettarget
- the final containerusername
- the user in whose name the method is run- Throws:
Exception
- a generic error happened
-
createPath
public 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 thetargetPath
represents a relative pathtargetPath
- absolute or relative(in relation to the document's parent folder) path to be createdusername
- the user in whose name the method is run- Returns:
- the folder leaf of the path
-
-