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
Component to interact with a skin
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaffectDesign
(String skinName, String designId) Affect a new design configurationchangeModel
(String modelName, String skinName, boolean useDefaults) Change the model of a skinDetermines the skin directory is locked.checkManualCloseCondition
(String skinId) Check the current save state of a skincheckOpenCondition
(String siteName) Check the conditions for opening the current skin of a siteGet the colors of a model and its theme for a site.getCssStyleItems
(String siteName) Get the css style items used by a sitegetGalleryImages
(String skinName, String paramId) Retrieve the list of images for the skin and parametergetGalleryVariants
(String skinName, String paramId) Retrieve the list of gallery variants available for the specified skin and parametergetLanguages
(String siteName) Get the languages available on a sitegetParametersValues
(String siteName, List<String> paramIds) Get the parameters of the skin of a sitegetSkinModelParameters
(String modelName) Get the skin model's parametersgetThemeColors
(String siteName) Retrieve the list of themes' colors for a siteOpen the skin of a site for editionrestoreDefaults
(String skinName) Restore the default parameters for a skinvoid
service
(ServiceManager manager) updateColorTheme
(String skinName, String themeId) Set the theme used by a skinupdateParameter
(String skinName, String lang, String parameterId, String value, boolean uploaded) Update a parameter of the skinuploadLocalImage
(String uploadId, String fileName, String skinName, String parameterId) Upload a local image and set it as value for a image parameterMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
SKIN_FACTORY_TOOL_ID
Constant for skin editor tool id- See Also:
-
-
Constructor Details
-
SkinDAO
public SkinDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkManualCloseCondition
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
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
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
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
Get the languages available on a site- Parameters:
siteName
- The site name- Returns:
- The languages informations
-
getColors
Get the colors of a model and its theme for a site.- Parameters:
siteName
- The site name- Returns:
- The colors and theme informations.
-
getCssStyleItems
Get the css style items used by a site- Parameters:
siteName
- The site name- Returns:
- The css style items.
-
getParametersValues
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
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
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
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
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
Get the skin model's parameters- Parameters:
modelName
- The model name- Returns:
- The parameters
-
getThemeColors
Retrieve the list of themes' colors for a site- Parameters:
siteName
- The site name- Returns:
- The model's themes colors
-