Class SkinModelDAO

All Implemented Interfaces:
LogEnabled, Component, Serviceable

public class SkinModelDAO extends AbstractLogEnabled implements Serviceable, Component
Component for interact with a skin model
  • Constructor Details

  • Method Details

    • service

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

      public Map<String,Object> getModel(String modelId)
      Retrieve informations on a skin
      Parameters:
      modelId - The skin id
      Returns:
      the informations of a skin
    • getSkinsAndModels

      public Map<String,Object> getSkinsAndModels(boolean includeAbstract)
      Retrieve the list of models and skins available
      Parameters:
      includeAbstract - Should include abstract skins
      Returns:
      a map of skins and models
    • modelExists

      public boolean modelExists(String modelId) throws ProcessingException
      Determines if a model exists
      Parameters:
      modelId - The model id
      Returns:
      true if model exists.
      Throws:
      ProcessingException - if something goes wrong when retrieving the list of models
    • importModel

      public String importModel(String modelName, String tmpDirPath) throws IOException
      Import a model from a zip file
      Parameters:
      modelName - The name of the new model
      tmpDirPath - the tmp dir path where the zip has been uploaded
      Returns:
      The model name
      Throws:
      IOException - if something goes wrong when manipulating files
    • generateSkin

      public String generateSkin(String skinId, String modelId) throws IOException, ProcessingException
      Generate a new skin from a model
      Parameters:
      skinId - The new skin id
      modelId - The model
      Returns:
      An error message, or null on success
      Throws:
      IOException - if an error occurs when manipulating files
      ProcessingException - if an exception occurred during the generation processs
    • applyModelToAll

      public Map<String,Object> applyModelToAll(String modelId) throws IOException
      Apply the model to all its skins
      Parameters:
      modelId - The model id
      Returns:
      The set of modified skins id
      Throws:
      IOException - if an error occurs when manipulating files
    • applyModel

      public boolean applyModel(String skinId, String modelId) throws IOException
      Apply model to the skin
      Parameters:
      skinId - The skin id
      modelId - The id of model
      Returns:
      true if the model was applyed successfully
      Throws:
      IOException - if an error occurs when manipulating files
    • applyModel

      protected boolean applyModel(Skin skin, String modelId) throws IOException
      Apply model to the skin
      Parameters:
      skin - The skin
      modelId - The id of model
      Returns:
      true if the model was applyed successfully
      Throws:
      IOException - if an error occurs when manipulating files
    • delete

      public void delete(String modelId) throws IOException
      Delete a model
      Parameters:
      modelId - The model id
      Throws:
      IOException - if an error occurs when manipulating files
    • unlinkModel

      public String unlinkModel(String skinId, String modelId) throws IOException
      Unlink the skin from its model
      Parameters:
      skinId - The id of the skin
      modelId - The id of the model
      Returns:
      An error code, or null on success
      Throws:
      IOException - If an error occurred while removing the link