public class SkinDAO extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Modifier and Type | Field and Description |
---|---|
private static String |
__LICENCE |
private Context |
_context |
private I18nUtils |
_i18nUtils |
protected ServiceManager |
_manager
The service manager instance
|
private SkinModelsManager |
_modelsManager |
private SiteManager |
_siteManager |
private SkinParameterTypeExtensionPoint |
_skinParameterTypeEP |
private SkinsManager |
_skinsManager |
static String |
ROLE
The avalon role
|
Constructor and Description |
---|
SkinDAO() |
Modifier and Type | Method and Description |
---|---|
private void |
_createConfigFile(SkinParametersModel model,
File skinDir,
Map<String,Object> values) |
private Map<String,DefinitionAndValue> |
_getDefinitionAndValues(Map<String,Object> values,
Map<String,ElementDefinition> flatDefinitions) |
private Map<String,Object> |
_skin2JsonObject(String id,
List<Site> skinSites) |
private List<Object> |
_skins2JsonObject() |
Map<String,Object> |
configureSkin(String skinName,
Map<String,Object> values)
Configure a skin
|
void |
contextualize(Context context) |
String |
copySkin(String skinId,
String originalSkinId)
Duplicate an existing skin
|
String |
deleteSkin(String skinId)
Delete a skin
|
Map<String,Object> |
getSkin(String skinId)
Retrieve informations on a skin
|
Map<String,Object> |
getSkins()
Retrieve the list of available skins
|
Map<String,Object> |
importSkin(String skinName,
String tmpDirPath,
Map<String,Object> values)
This action receive a form with the "importfile" zip file as an exported skin.
|
boolean |
isInUse(String skinId)
Determines if a skin is currently used by one or more sites
|
Collection<DefinitionAndValue> |
readValues(File skinDir,
Map<String,ElementDefinition> flatDefinitions)
Parse the values file and make a liaison with the definitions, to return a collection of
DefinitionAndValue |
void |
service(ServiceManager manager) |
boolean |
skinExists(String skinId)
Determines if a skin exists
|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
private static final String __LICENCE
protected ServiceManager _manager
private SkinsManager _skinsManager
private SkinModelsManager _modelsManager
private SiteManager _siteManager
private I18nUtils _i18nUtils
private SkinParameterTypeExtensionPoint _skinParameterTypeEP
public SkinDAO()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public Map<String,Object> getSkin(String skinId)
skinId
- The skin idpublic boolean skinExists(String skinId) throws ProcessingException
skinId
- The skin idProcessingException
- if an error occurspublic boolean isInUse(String skinId)
skinId
- The skin idpublic Map<String,Object> getSkins() throws ProcessingException
ProcessingException
- if an error occursprivate List<Object> _skins2JsonObject()
public Map<String,Object> importSkin(String skinName, String tmpDirPath, Map<String,Object> values) throws TransformerConfigurationException, IOException, SAXException, ProcessingException
skinName
- The skin nametmpDirPath
- The directory where the zip was uploadedvalues
- the configuration's values. Can be empty.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 modelpublic Map<String,Object> configureSkin(String skinName, Map<String,Object> values) throws TransformerConfigurationException, IOException, SAXException, ProcessingException
skinName
- the skin namevalues
- the configuration's valuesSAXException
- 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 modelprivate Map<String,DefinitionAndValue> _getDefinitionAndValues(Map<String,Object> values, Map<String,ElementDefinition> flatDefinitions)
private void _createConfigFile(SkinParametersModel model, File skinDir, Map<String,Object> values) throws IOException, SAXException, TransformerConfigurationException, ProcessingException
public String copySkin(String skinId, String originalSkinId) throws IOException
skinId
- The new skin idoriginalSkinId
- The original skin idIOException
- if an I/O exception occurs during copypublic String deleteSkin(String skinId) throws IOException
skinId
- The skin idIOException
- if an I/O exception occurs during deletionpublic Collection<DefinitionAndValue> readValues(File skinDir, Map<String,ElementDefinition> flatDefinitions) throws Exception
DefinitionAndValue
skinDir
- folder of the skinflatDefinitions
- map of ElementDefinition
Collection
of DefinitionAndValue
using flatDefinitions and the values found in skinDirException
- Impossible to read the file