Class SkinResourceDAO
java.lang.Object
org.ametys.plugins.skineditor.resources.SkinResourceDAO
- All Implemented Interfaces:
Component
,Serviceable
DAO for files and folders inside a skin directory
-
Field Summary
Modifier and TypeFieldDescriptionprotected FileHelper
The file helperprotected SkinLockManager
The lock managerprotected SkinEditionHelper
The skin edition helperprotected SourceResolver
The source resolverstatic final String
Constant for skin editor tool id -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreate a folderboolean
checkSourceExists
(String skinName, String parentRelPath, String fileName) checks if the resource already exists in the parentcopySource
(String skinName, String srcPath, String parentTargetPath) Copy a file or directorydeleteFile
(String skinName, String relPath) Delete a file or a directorymoveSource
(String skinName, String srcPath, String targetPath) Move a file or a directoryrenameSource
(String skinName, String relPath, String name) Rename a file or a directorySaves the text in filevoid
service
(ServiceManager manager)
-
Field Details
-
SKIN_EDITOR_TOOL_ID
Constant for skin editor tool id- See Also:
-
_lockManager
The lock manager -
_skinHelper
The skin edition helper -
_fileHelper
The file helper -
_srcResolver
The source resolver
-
-
Constructor Details
-
SkinResourceDAO
public SkinResourceDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
save
Saves the text in file- Parameters:
skinName
- The name of the skin containing the resourcerelPath
- the relative path of file under the skin directorytext
- the file content to save- Returns:
- The result map
- Throws:
IOException
- If an error occurred while saving
-
checkSourceExists
public boolean checkSourceExists(String skinName, String parentRelPath, String fileName) throws IOException checks if the resource already exists in the parent- Parameters:
skinName
- The name of the skin containing the resourceparentRelPath
- The parent pathfileName
- the file name to check- Returns:
- true if the file exists
- Throws:
IOException
- if something goes wrong while trying to retrieve a file
-
copySource
public Map<String,Object> copySource(String skinName, String srcPath, String parentTargetPath) throws IOException Copy a file or directory- Parameters:
skinName
- the name of the current skinsrcPath
- the path of the source file or directoryparentTargetPath
- the new path for the source file or directory- Returns:
- a map of data
- Throws:
IOException
- if something went wrong during the source copy processing
-
addFolder
public Map addFolder(String skinName, String parentRelPath, String originalName, boolean renameIfExists) throws IOException Create a folder- Parameters:
skinName
- the name of the current skinparentRelPath
- the path of the parent containing the folderoriginalName
- the name of the new folderrenameIfExists
- if true, will generate a valid name if "originalName" already exists.- Returns:
- a map of data
- Throws:
IOException
- if an error occurs while manipulating files
-
deleteFile
Delete a file or a directory- Parameters:
skinName
- the name of the current skinrelPath
- the path of the file or directory- Returns:
- a map of data
- Throws:
IOException
- if an error occurs while manipulating files
-
moveSource
public Map<String,Object> moveSource(String skinName, String srcPath, String targetPath) throws IOException Move a file or a directory- Parameters:
skinName
- the name of current skinsrcPath
- the path of the file or directorytargetPath
- the targeted path- Returns:
- a map of data
- Throws:
IOException
- if something goes wrong during the source moving process
-
renameSource
Rename a file or a directory- Parameters:
skinName
- the current skin namerelPath
- the path of the filename
- the new name- Returns:
- a map of data
- Throws:
IOException
- if something goes wrong when renaming the source
-