Package org.ametys.skinfactory.skins
Class SkinDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.skincommons.AbstractCommonSkinDAO
org.ametys.skinfactory.skins.SkinDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Component to interact with a skin
-
Field Summary
FieldsFields inherited from class org.ametys.plugins.skincommons.AbstractCommonSkinDAO
_lockManager, _siteManager, _skinHelper, _skinsManager, _userManager, _userProvider
-
Constructor Summary
Constructors -
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.protected void
checkUserRight
(String skinName) Check user rights and throwsAccessDeniedException
if it is not authorizedGet 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 sitegetThemeColors
(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.ametys.plugins.skincommons.AbstractCommonSkinDAO
cancelChanges, checkUnsaveModifications, clearModifications, commitChanges, getLock, getPreviewURI, getSkinModel, saveChanges
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
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
- Overrides:
service
in classAbstractCommonSkinDAO
- Throws:
ServiceException
-
checkUserRight
Description copied from class:AbstractCommonSkinDAO
Check user rights and throwsAccessDeniedException
if it is not authorized- Specified by:
checkUserRight
in classAbstractCommonSkinDAO
- Parameters:
skinName
- the skin name
-
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
-
getThemeColors
Retrieve the list of themes' colors for a site- Parameters:
siteName
- The site name- Returns:
- The model's themes colors
-