Class SiteDAO

All Implemented Interfaces:
LogEnabled, Component, Serviceable

public class SiteDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulating sites
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • getRootId

      public String 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

      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 name
      type - The site's type
      renameIfExists - 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 create
      id - 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 javax.jcr.RepositoryException
      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 target
      ids - the ids of sites to move
      Returns:
      The result with the ids of moved sites
      Throws:
      AmetysRepositoryException - if an error occurs
      javax.jcr.RepositoryException - 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

      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 edit
      codes - The list of new codes. Such as "fr", "en".
    • _setParameterValues

      Set the site parameters
      Parameters:
      site - the site
      values - the parameters' values
      Returns:
      the parameters' errors