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 private static List<String>
__FORBIDDEN_SITE_NAMES
private CurrentUserProvider
_currentUserProvider
private GroupDirectoryContextHelper
_groupDirectoryContextHelper
private I18nUtils
_i18nUtils
private PageElementCache
_inputDataCache
private ObservationManager
_observationManager
private PopulationContextHelper
_populationContextHelper
private AmetysObjectResolver
_resolver
private SiteConfigurationManager
_siteConfigurationManager
private SiteManager
_siteManager
private SiteTypesExtensionPoint
_siteTypesEP
private PageElementCache
_zoneItemCache
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 private Collection<String>
_getChildrenSiteNames(Site site)
Get all children site's names of a siteprivate DefinitionAndValue
_getDefintionAndValue(Map<String,Object> jsonValues, ElementDefinition definition)
private List<I18nizableText>
_setParameterValue(ModifiableModelAwareDataHolder dataHolder, Map<String,DefinitionAndValue> definitionAndValues, String parameterName)
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)
-
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
-
__FORBIDDEN_SITE_NAMES
private static final List<String> __FORBIDDEN_SITE_NAMES
-
_siteManager
private SiteManager _siteManager
-
_resolver
private AmetysObjectResolver _resolver
-
_observationManager
private ObservationManager _observationManager
-
_currentUserProvider
private CurrentUserProvider _currentUserProvider
-
_inputDataCache
private PageElementCache _inputDataCache
-
_zoneItemCache
private PageElementCache _zoneItemCache
-
_siteConfigurationManager
private SiteConfigurationManager _siteConfigurationManager
-
_siteTypesEP
private SiteTypesExtensionPoint _siteTypesEP
-
_i18nUtils
private I18nUtils _i18nUtils
-
_populationContextHelper
private PopulationContextHelper _populationContextHelper
-
_groupDirectoryContextHelper
private GroupDirectoryContextHelper _groupDirectoryContextHelper
-
-
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
-
_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
-
_getDefintionAndValue
private DefinitionAndValue _getDefintionAndValue(Map<String,Object> jsonValues, ElementDefinition definition)
-
_setParameterValue
private List<I18nizableText> _setParameterValue(ModifiableModelAwareDataHolder dataHolder, Map<String,DefinitionAndValue> definitionAndValues, String parameterName)
-
_getChildrenSiteNames
private Collection<String> _getChildrenSiteNames(Site site)
Get all children site's names of a site- Parameters:
site
- The site- Returns:
- the children site's names.
-
-