Package org.ametys.skinfactory.skins
Class SkinDAO
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.skinfactory.skins.SkinDAO
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class SkinDAO extends AbstractLogEnabled implements Serviceable, Component
Component to interact with a skin
-
-
Field Summary
Fields Modifier and Type Field Description static String
SKIN_FACTORY_TOOL_ID
Constant for skin editor tool id
-
Constructor Summary
Constructors Constructor Description SkinDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
affectDesign(String skinName, String designId)
Affect a new design configurationMap<String,Object>
changeModel(String modelName, String skinName, boolean useDefaults)
Change the model of a skinprotected Map<String,Object>
checkLock(Path skinDir)
Determines the skin directory is locked.String
checkManualCloseCondition(String skinId)
Check the current save state of a skinMap<String,String>
checkOpenCondition(String siteName)
Check the conditions for opening the current skin of a siteMap<String,Object>
getColors(String siteName)
Get the colors of a model and its theme for a site.Map<String,Object>
getCssStyleItems(String siteName)
Get the css style items used by a siteMap<String,Object>
getGalleryImages(String skinName, String paramId)
Retrieve the list of images for the skin and parameterList<Object>
getGalleryVariants(String skinName, String paramId)
Retrieve the list of gallery variants available for the specified skin and parameterMap<String,Object>
getLanguages(String siteName)
Get the languages available on a siteMap<String,Object>
getParametersValues(String siteName, List<String> paramIds)
Get the parameters of the skin of a siteMap<String,Object>
getSkinModelParameters(String modelName)
Get the skin model's parametersList<Object>
getThemeColors(String siteName)
Retrieve the list of themes' colors for a siteMap<String,String>
openSkin(String siteName, String mode)
Open the skin of a site for editionMap<String,Object>
restoreDefaults(String skinName)
Restore the default parameters for a skinvoid
service(ServiceManager manager)
Map<String,Object>
updateColorTheme(String skinName, String themeId)
Set the theme used by a skinMap<String,Object>
updateParameter(String skinName, String lang, String parameterId, String value, boolean uploaded)
Update a parameter of the skinMap<String,Object>
uploadLocalImage(String uploadId, String fileName, String skinName, String parameterId)
Upload a local image and set it as value for a image parameter-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
SKIN_FACTORY_TOOL_ID
public static final String SKIN_FACTORY_TOOL_ID
Constant for skin editor tool id- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SkinDAO
public SkinDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkManualCloseCondition
public String checkManualCloseCondition(String skinId) throws IOException
Check the current save state of a skin- Parameters:
skinId
- The skin id- Returns:
- The state message.
- Throws:
IOException
- if an error occurs when manipulating files
-
checkOpenCondition
public Map<String,String> checkOpenCondition(String siteName) throws IOException
Check the conditions for opening the current skin of a site- Parameters:
siteName
- The name of the site- Returns:
- The informations on the state of the site's skin
- Throws:
IOException
- if an error occurs when manipulating files
-
checkLock
protected Map<String,Object> checkLock(Path skinDir) throws IOException
Determines the skin directory is locked. If no, the lock owner is set in JSON map request attribute- Parameters:
skinDir
- The skin directory- Returns:
- information about the lock, or null if not locked
- Throws:
IOException
- if an error occurs when manipulating files
-
affectDesign
public Map<String,Object> affectDesign(String skinName, String designId) throws IOException
Affect a new design configuration- Parameters:
skinName
- The skin namedesignId
- The design id- Returns:
- the information on the design, or the error.
- Throws:
IOException
- if an error occurs when manipulating files
-
changeModel
public Map<String,Object> changeModel(String modelName, String skinName, boolean useDefaults) throws IOException, TransformerConfigurationException, SAXException
Change the model of a skin- Parameters:
modelName
- The model nameskinName
- The skin nameuseDefaults
-true
to use default model parameters- Returns:
- The skin parameters, or the error informations.
- Throws:
IOException
- if an error occurs when manipulating filesTransformerConfigurationException
- if something goes wrong when generating the model fileSAXException
- if an error occurs while saxing
-
getLanguages
public Map<String,Object> getLanguages(String siteName)
Get the languages available on a site- Parameters:
siteName
- The site name- Returns:
- The languages informations
-
getColors
public Map<String,Object> getColors(String siteName)
Get the colors of a model and its theme for a site.- Parameters:
siteName
- The site name- Returns:
- The colors and theme informations.
-
getCssStyleItems
public Map<String,Object> getCssStyleItems(String siteName)
Get the css style items used by a site- Parameters:
siteName
- The site name- Returns:
- The css style items.
-
getParametersValues
public Map<String,Object> getParametersValues(String siteName, List<String> paramIds)
Get the parameters of the skin of a site- Parameters:
siteName
- The site nameparamIds
- If not null, specify the ids of the parameters to retrieve- Returns:
- The parameters
-
openSkin
public Map<String,String> openSkin(String siteName, String mode) throws IOException
Open the skin of a site for edition- Parameters:
siteName
- The site namemode
- The open mode- Returns:
- The skin id, or an error message.
- Throws:
IOException
- if an error occurs when manipulating files
-
restoreDefaults
public Map<String,Object> restoreDefaults(String skinName) throws IOException, TransformerConfigurationException, SAXException
Restore the default parameters for a skin- Parameters:
skinName
- The skin name- Returns:
- The skin informations, or an error code.
- Throws:
IOException
- if an error occurs when manipulating filesTransformerConfigurationException
- if something goes wrong when generating the model fileSAXException
- if an error occurs while saxing
-
updateColorTheme
public Map<String,Object> updateColorTheme(String skinName, String themeId) throws IOException
Set the theme used by a skin- Parameters:
skinName
- The skin namethemeId
- The theme id- Returns:
- The theme informations, or an error code.
- Throws:
IOException
- if an error occurs when manipulating files
-
updateParameter
public Map<String,Object> updateParameter(String skinName, String lang, String parameterId, String value, boolean uploaded) throws IOException
Update a parameter of the skin- Parameters:
skinName
- The skin namelang
- The current languageparameterId
- The parameter id to updatevalue
- The new value for the parameteruploaded
-true
if the file was uploaded- Returns:
- The skin parameters updated, or an error code.
- Throws:
IOException
- if an error occurs when manipulating files
-
uploadLocalImage
public Map<String,Object> uploadLocalImage(String uploadId, String fileName, String skinName, String parameterId) throws IOException
Upload a local image and set it as value for a image parameter- Parameters:
uploadId
- The upload identifierfileName
- The name of uploaded fileskinName
- The skin nameparameterId
- The parameter id to update- Returns:
- The skin parameters updated, or an error code.
- Throws:
IOException
- if an error occurs when manipulating files
-
getGalleryImages
public Map<String,Object> getGalleryImages(String skinName, String paramId) throws IOException
Retrieve the list of images for the skin and parameter- Parameters:
skinName
- The skin nameparamId
- The parameter id- Returns:
- The map of images informations
- Throws:
IOException
- if an error occurs when manipulating files
-
getGalleryVariants
public List<Object> getGalleryVariants(String skinName, String paramId) throws IOException
Retrieve the list of gallery variants available for the specified skin and parameter- Parameters:
skinName
- The skin nameparamId
- The parameter id- Returns:
- The list of gallery variants
- Throws:
IOException
- if an error occurs when manipulating files
-
getSkinModelParameters
public Map<String,Object> getSkinModelParameters(String modelName)
Get the skin model's parameters- Parameters:
modelName
- The model name- Returns:
- The parameters
-
getThemeColors
public List<Object> getThemeColors(String siteName)
Retrieve the list of themes' colors for a site- Parameters:
siteName
- The site name- Returns:
- The model's themes colors
-
-