Package org.ametys.web.repository.site
Class SiteDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.web.repository.site.SiteDAO
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class SiteDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulating sites
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SITE_TYPE_ID
Id of the default site typestatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description SiteDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,List<I18nizableText>>
_setParameterValues(Site site, Map<String,Object> values)
Set the site parametersList<String>
clearAllCaches()
Clear cache of all sites.void
clearCache(String siteName)
Clear site's cachevoid
clearCache(Site site)
Clear cache of a siteMap<String,Object>
configureSite(String siteName, Map<String,Object> values)
Configure siteMap<String,Object>
copySite(String parentId, String name, String id)
Create a site by copy of another.Map<String,Object>
createSite(String parentId, String name, String type, boolean renameIfExists)
Creates a new sitevoid
deleteSite(String siteId)
Delete a siteString
getRootId()
Get the root idMap<String,Object>
getSiteInfos(String name)
Get the site's propertiesMap<String,Object>
getSiteInfos(Site site)
Get the site's propertiesMap<String,Object>
getSitesInfos(List<String> names)
Get the properties of given sitesMap<String,Object>
moveSite(String targetId, List<String> ids)
Move sitesvoid
service(ServiceManager smanager)
void
setLanguages(Site site, List<String> codes)
Set the languages of a site-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
DEFAULT_SITE_TYPE_ID
public static final String DEFAULT_SITE_TYPE_ID
Id of the default site type- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SiteDAO
public SiteDAO()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getSitesInfos
public Map<String,Object> getSitesInfos(List<String> names)
Get the properties of given sites- Parameters:
names
- the site names- Returns:
- the properties of the sites in a result map
-
getSiteInfos
public Map<String,Object> getSiteInfos(String name)
Get the site's properties- Parameters:
name
- the site name- Returns:
- the properties
-
getSiteInfos
public Map<String,Object> getSiteInfos(Site site)
Get the site's properties- Parameters:
site
- the site- Returns:
- the properties
-
createSite
public Map<String,Object> createSite(String parentId, String name, String type, boolean renameIfExists)
Creates a new site- Parameters:
parentId
- The id of parent site. Can be null to create a root site.name
- The site's nametype
- The site's typerenameIfExists
- Set to true to automatically rename the site if already exists- Returns:
- The result map with id of created site
-
copySite
public Map<String,Object> copySite(String parentId, String name, String id) throws Exception
Create a site by copy of another.- Parameters:
parentId
- The id of parent site. Can be null to create a root site.name
- the name of site to createid
- the id of site to copy- Returns:
- The result map with id of created site
- Throws:
Exception
- if an error ocurred while populating new site
-
deleteSite
public void deleteSite(String siteId) throws RepositoryException
Delete a site- Parameters:
siteId
- The id of site to delete- Throws:
RepositoryException
- if an error occurred during deletion
-
moveSite
public Map<String,Object> moveSite(String targetId, List<String> ids) throws AmetysRepositoryException, RepositoryException
Move sites- Parameters:
targetId
- The targetids
- the ids of sites to move- Returns:
- The result with the ids of moved sites
- Throws:
AmetysRepositoryException
- if an error occursRepositoryException
- if an error occurs
-
clearCache
public void clearCache(String siteName) throws Exception
Clear site's cache- Parameters:
siteName
- The site name- Throws:
Exception
- if an error occurred during cache deletion
-
clearAllCaches
public List<String> clearAllCaches()
Clear cache of all sites.- Returns:
- The list of sites which failed
-
clearCache
public void clearCache(Site site) throws Exception
Clear cache of a site- Parameters:
site
- the site- Throws:
Exception
- if an error occurred
-
configureSite
public Map<String,Object> configureSite(String siteName, Map<String,Object> values) throws Exception
Configure site- Parameters:
siteName
- The site name.values
- the configuration's values- Returns:
- The result map. Contains the possible errors
- Throws:
Exception
- if an error occurred
-
setLanguages
public void setLanguages(Site site, List<String> codes)
Set the languages of a site- Parameters:
site
- The site to editcodes
- The list of new codes. Such as "fr", "en".
-
_setParameterValues
protected Map<String,List<I18nizableText>> _setParameterValues(Site site, Map<String,Object> values)
Set the site parameters- Parameters:
site
- the sitevalues
- the parameters' values- Returns:
- the parameters' errors
-
-