Package org.ametys.web.skin
Class SkinDAO
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.web.skin.SkinDAO
- All Implemented Interfaces:
 Component,Contextualizable,LogEnabled,Serviceable
DAO for manipulating skins
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ServiceManagerThe service manager instancestatic final StringThe avalon role - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionconfigureSkin(String skinName, Map<String, Object> values) Configure a skinvoidcontextualize(Context context) Duplicate an existing skindeleteSkin(String skinId) Delete a skinRetrieve informations on a skingetSkins(boolean includeAbstract) Retrieve the list of available skinsThis action receive a form with the "importfile" zip file as an exported skin.booleanDetermines if a skin is currently used by one or more sitesreadValues(Path skinDir, Collection<ElementDefinition> skinParameterDefinitions) Parse the values file and make a liaison with the definitions, to return a collection ofDefinitionAndValuevoidservice(ServiceManager manager) booleanskinExists(String skinId) Determines if a skin existsMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger 
- 
Field Details
- 
ROLE
The avalon role - 
_manager
The service manager instance 
 - 
 - 
Constructor Details
- 
SkinDAO
public SkinDAO() 
 - 
 - 
Method Details
- 
service
- Specified by:
 servicein interfaceServiceable- Throws:
 ServiceException
 - 
contextualize
- Specified by:
 contextualizein interfaceContextualizable- Throws:
 ContextException
 - 
getSkin
Retrieve informations on a skin- Parameters:
 skinId- The skin id- Returns:
 - the informations of a skin
 
 - 
skinExists
Determines if a skin exists- Parameters:
 skinId- The skin id- Returns:
 - true if skin exists.
 - Throws:
 ProcessingException- if an error occurs
 - 
isInUse
Determines if a skin is currently used by one or more sites- Parameters:
 skinId- The skin id- Returns:
 - true if skin is currently in use
 
 - 
getSkins
Retrieve the list of available skins- Parameters:
 includeAbstract- Should include abstract skins- Returns:
 - a map of skins
 
 - 
importSkin
public Map<String,Object> importSkin(String skinName, String tmpDirPath, Map<String, Object> values) throws TransformerConfigurationException, IOException, SAXException, ProcessingExceptionThis action receive a form with the "importfile" zip file as an exported skin. Replace existing skin- Parameters:
 skinName- The skin nametmpDirPath- The directory where the zip was uploadedvalues- the configuration's values. Can be empty.- Returns:
 - The skin name
 - Throws:
 SAXException- if an error occurs during configuration file creationIOException- if an error occurs while manipulating filesTransformerConfigurationException- if an error occurs during configuration file creationProcessingException- error while parsing model
 - 
configureSkin
public Map<String,Object> configureSkin(String skinName, Map<String, Object> values) throws TransformerConfigurationException, IOException, SAXException, ProcessingExceptionConfigure a skin- Parameters:
 skinName- the skin namevalues- the configuration's values- Returns:
 - A map with "errors" key that is a map <errorName> <errorMessage>
 - Throws:
 SAXException- if an error occurs during configuration file creationIOException- if an error occurs during configuration file creationTransformerConfigurationException- if an error occurs during configuration file creationProcessingException- error while parsing model
 - 
copySkin
Duplicate an existing skin- Parameters:
 skinId- The new skin idoriginalSkinId- The original skin id- Returns:
 - An error message, or null if successful
 - Throws:
 IOException- if an I/O exception occurs during copy
 - 
deleteSkin
Delete a skin- Parameters:
 skinId- The skin id- Returns:
 - the skin id
 - Throws:
 IOException- if an I/O exception occurs during deletion
 - 
readValues
public Collection<DefinitionAndValue> readValues(Path skinDir, Collection<ElementDefinition> skinParameterDefinitions) throws Exception Parse the values file and make a liaison with the definitions, to return a collection ofDefinitionAndValue- Parameters:
 skinDir- folder of the skinskinParameterDefinitions- the skin parameter definitions- Returns:
 - a 
CollectionofDefinitionAndValueusing flatDefinitions and the values found in skinDir - Throws:
 Exception- Impossible to read the file
 
 -