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
DAO for manipulating sites
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Map<String,
List<I18nizableText>> _setParameterValues
(Site site, Map<String, Object> values) Set the site parametersClear cache of all sites.void
clearCache
(String siteName) Clear site's cachevoid
clearCache
(Site site) Clear cache of a siteconfigureSite
(String siteName, Map<String, Object> values) Configure siteCreate a site by copy of another.createSite
(String parentId, String name, String type, boolean renameIfExists) Creates a new sitevoid
deleteSite
(String siteId) Delete a siteGet the root idgetSiteInfos
(String name) Get the site's propertiesgetSiteInfos
(Site site) Get the site's propertiesgetSitesInfos
(List<String> names) Get the properties of given sitesMove sitesvoid
service
(ServiceManager smanager) void
setLanguages
(Site site, List<String> codes) Set the languages of a siteMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
DEFAULT_SITE_TYPE_ID
Id of the default site type- See Also:
-
-
Constructor Details
-
SiteDAO
public SiteDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getRootId
Get the root id- Returns:
- the root id
-
getSitesInfos
Get the properties of given sites- Parameters:
names
- the site names- Returns:
- the properties of the sites in a result map
-
getSiteInfos
Get the site's properties- Parameters:
name
- the site name- Returns:
- the properties
-
getSiteInfos
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
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
Delete a site- Parameters:
siteId
- The id of site to delete- Throws:
javax.jcr.RepositoryException
- if an error occurred during deletion
-
moveSite
public Map<String,Object> moveSite(String targetId, List<String> ids) throws AmetysRepositoryException, javax.jcr.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 occursjavax.jcr.RepositoryException
- if an error occurs
-
clearCache
Clear site's cache- Parameters:
siteName
- The site name- Throws:
Exception
- if an error occurred during cache deletion
-
clearAllCaches
Clear cache of all sites.- Returns:
- The list of sites which failed
-
clearCache
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 ExceptionConfigure 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
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
-