Class SkinResourceDAO

java.lang.Object
org.ametys.plugins.skineditor.resources.SkinResourceDAO
All Implemented Interfaces:
Component, Serviceable

public class SkinResourceDAO extends Object implements Serviceable, Component
DAO for files and folders inside a skin directory
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • save

      public Map<String,Object> save(String skinName, String relPath, String text) throws IOException
      Saves the text in file
      Parameters:
      skinName - The name of the skin containing the resource
      relPath - the relative path of file under the skin directory
      text - 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 resource
      parentRelPath - The parent path
      fileName - 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 skin
      srcPath - the path of the source file or directory
      parentTargetPath - 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 skin
      parentRelPath - the path of the parent containing the folder
      originalName - the name of the new folder
      renameIfExists - 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

      public Map deleteFile(String skinName, String relPath) throws IOException
      Delete a file or a directory
      Parameters:
      skinName - the name of the current skin
      relPath - 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 skin
      srcPath - the path of the file or directory
      targetPath - the targeted path
      Returns:
      a map of data
      Throws:
      IOException - if something goes wrong during the source moving process
    • renameSource

      public Map renameSource(String skinName, String relPath, String name) throws IOException
      Rename a file or a directory
      Parameters:
      skinName - the current skin name
      relPath - the path of the file
      name - the new name
      Returns:
      a map of data
      Throws:
      IOException - if something goes wrong when renaming the source