Class ThemeDAO
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.linkdirectory.theme.ThemeDAO
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class ThemeDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulatingTheme
-
-
Field Summary
Fields Modifier and Type Field Description private CurrentUserProvider
_currentUserProvider
private DirectoryHelper
_directoryHelper
private ObservationManager
_observationManager
private AmetysObjectResolver
_resolver
private SiteManager
_siteManager
static String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description ThemeDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Set<String>
_deleteThemeRefIntoLinks(String siteName, String lang, String themeId)
private Set<String>
_getReferencingLinks(String siteName, String lang, String themeId)
Map<String,Object>
createTheme(String siteName, String language, String originalLabel)
Create a new themeMap<String,Object>
deleteTheme(List<String> ids)
Delete themesMap<String,Object>
getTheme(String themeId)
Convert aTheme
to JSON objectMap<String,Object>
getThemes(List<String> ids)
Get themesvoid
service(ServiceManager manager)
protected boolean
themeExists(String label, String siteName, String language, String id)
Test if a link with the specified url exists in the directory.Map<String,Object>
updateTheme(String siteName, String language, String id, String label)
Update a theme-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_resolver
private AmetysObjectResolver _resolver
-
_observationManager
private ObservationManager _observationManager
-
_siteManager
private SiteManager _siteManager
-
_currentUserProvider
private CurrentUserProvider _currentUserProvider
-
_directoryHelper
private DirectoryHelper _directoryHelper
-
-
Constructor Detail
-
ThemeDAO
public ThemeDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getThemes
public Map<String,Object> getThemes(List<String> ids)
Get themes- Parameters:
ids
- the id of themes- Returns:
- the retrieving themes and the unknown themes
-
getTheme
public Map<String,Object> getTheme(String themeId) throws UnknownAmetysObjectException
Convert aTheme
to JSON object- Parameters:
themeId
- the theme's id- Returns:
- The theme data
- Throws:
UnknownAmetysObjectException
- if the theme does not exist.
-
createTheme
public Map<String,Object> createTheme(String siteName, String language, String originalLabel)
Create a new theme- Parameters:
siteName
- the site namelanguage
- the site languageoriginalLabel
- the label of the theme- Returns:
- the id of created theme
-
deleteTheme
public Map<String,Object> deleteTheme(List<String> ids)
Delete themes- Parameters:
ids
- the id of themes to delete- Returns:
- the list of modified links, or an error code
-
updateTheme
public Map<String,Object> updateTheme(String siteName, String language, String id, String label)
Update a theme- Parameters:
siteName
- the site namelanguage
- the site languageid
- the theme idlabel
- the new theme label- Returns:
- the list of modified links, or an error code
-
_getReferencingLinks
private Set<String> _getReferencingLinks(String siteName, String lang, String themeId)
-
_deleteThemeRefIntoLinks
private Set<String> _deleteThemeRefIntoLinks(String siteName, String lang, String themeId)
-
themeExists
protected boolean themeExists(String label, String siteName, String language, String id) throws AmetysRepositoryException
Test if a link with the specified url exists in the directory.- Parameters:
label
- the url to test.siteName
- the site name.language
- the language.id
- id of the current theme to avoid (null if no theme to avoid)- Returns:
- true if the link exists.
- Throws:
AmetysRepositoryException
- if a repository error occurs.
-
-