Class DefaultCMSSiteService

All Implemented Interfaces:
CMSSiteService, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
MarketplaceCMSSiteService

public class DefaultCMSSiteService extends AbstractCMSService implements CMSSiteService
Default implementation of CMSSiteService
See Also:
  • Constructor Details

    • DefaultCMSSiteService

      public DefaultCMSSiteService()
  • Method Details

    • containsCatalog

      public boolean containsCatalog(CMSSiteModel site, CatalogModel catalog, boolean contentOnly)
      checks if a given site contains the given catalog
      Specified by:
      containsCatalog in interface CMSSiteService
      Parameters:
      site - the cms site model
      catalog - the catalog model
      contentOnly - if true, returns content catalogs only
      Returns:
      true if there is a site
    • containsContentCatalogImpl

      protected boolean containsContentCatalogImpl(CMSSiteModel site, CatalogModel catalog)
    • containsProductsCatalogImpl

      protected boolean containsProductsCatalogImpl(CMSSiteModel site, CatalogModel catalog)
    • getAllCatalogs

      public Collection<CatalogModel> getAllCatalogs(CMSSiteModel site) throws IllegalArgumentException
      Returns all catalogs for the specified site site. This means all the content catalogs of the site as well as the product and classification system catalogs which belong to the stores associated with the site.
      Specified by:
      getAllCatalogs in interface CMSSiteService
      Parameters:
      site - the CMS site
      Returns:
      all content, product and classification system catalogs associated with the site
      Throws:
      IllegalArgumentException
    • getClassificationCatalogs

      public List<CatalogModel> getClassificationCatalogs(CMSSiteModel site)
      Gets the classification catalogs for CMSSiteModel object.
      Specified by:
      getClassificationCatalogs in interface CMSSiteService
      Parameters:
      site - the CMSSiteModel object for which catalogs will be obtained.
      Returns:
      the list of CatalogModel objects.
    • getSiteForURL

      public CMSSiteModel getSiteForURL(URL url) throws CMSItemNotFoundException
      Returns the site which is associated with the given url
      Specified by:
      getSiteForURL in interface CMSSiteService
      Parameters:
      url - the url
      Returns:
      the site which is associated with the given url
      Throws:
      CMSItemNotFoundException - if no site is associated with the given url
    • matchSiteForURL

      protected boolean matchSiteForURL(CMSSiteModel site, String strUrl)
    • getSites

      public Collection<CMSSiteModel> getSites()
      Specified by:
      getSites in interface CMSSiteService
      Returns:
      List of all sites defined in this system
    • getStartPageLabelOrId

      public String getStartPageLabelOrId(CMSSiteModel site)
      Gets the start page label or id.
      Specified by:
      getStartPageLabelOrId in interface CMSSiteService
      Parameters:
      site - he CMSSiteModel object
      Returns:
      the start page label or id
    • hasCurrentCatalogVersion

      public boolean hasCurrentCatalogVersion()
      Specified by:
      hasCurrentCatalogVersion in interface CMSSiteService
      Returns:
      true if a catalogversion is set to current, otherwise false
    • hasCurrentSite

      public boolean hasCurrentSite()
      Specified by:
      hasCurrentSite in interface CMSSiteService
      Returns:
      true if a site is set to current, otherwise false
    • lookupCmsPageService

      public CMSPageService lookupCmsPageService()
      Returns:
      a CMSPageService
      Throws:
      UnsupportedOperationException
    • getCatalogVersionService

      protected CatalogVersionService getCatalogVersionService()
    • setCatalogVersionService

      public void setCatalogVersionService(CatalogVersionService catalogVersionService)
    • getCmsSiteDao

      protected CMSSiteDao getCmsSiteDao()
    • setCmsSiteDao

      public void setCmsSiteDao(CMSSiteDao cmsSiteDao)
    • setCurrentCatalogVersion

      public void setCurrentCatalogVersion(CatalogVersionModel catalogVersion) throws CMSItemNotFoundException
      sets a catalogversion as current catalogversion
      Specified by:
      setCurrentCatalogVersion in interface CMSSiteService
      Parameters:
      catalogVersion - the catalogversion to be set as current
      Throws:
      CMSItemNotFoundException - if the current site does not contain the catalog (catalogversion)
    • setCurrentSite

      public void setCurrentSite(CMSSiteModel site)
      sets the given site as current
      Specified by:
      setCurrentSite in interface CMSSiteService
      Parameters:
      site - the cms site model
    • setCurrentSite

      public CMSSiteModel setCurrentSite(URL url, PreviewDataModel previewData) throws CMSItemNotFoundException
      Sets the site that is associated with the given url as current site. Also adds all catalogversions which are provided in the previewdata the session. If a catalog version in the previewdata is not part of that site, it will not be added to the session.
      Specified by:
      setCurrentSite in interface CMSSiteService
      Parameters:
      url - the url
      previewData - the preview data model
      Returns:
      the corresponding CMSSiteModel which was activated
      Throws:
      CMSItemNotFoundException - if no site is associated with the given url
    • setCurrentSiteAndCatalogVersions

      public void setCurrentSiteAndCatalogVersions(CMSSiteModel site, boolean setDefaultCatalog) throws CMSItemNotFoundException
      Activates the given site and all associated catalog versions. If setDefaultCatalog is set to true the default catalog will be activated as currentcatalog.
      Specified by:
      setCurrentSiteAndCatalogVersions in interface CMSSiteService
      Parameters:
      site - site to activate
      setDefaultCatalog - if set to true the default catalog will be activated as currentcatalog.
      Throws:
      CMSItemNotFoundException - if not site with the given id could be found, no active catalogversion could be found for the associated catalogs or if setDefaultCatalog is set to true and no default catalog is set
    • setCurrentSiteAndCatalogVersions

      public CMSSiteModel setCurrentSiteAndCatalogVersions(String siteId, boolean setDefaultCatalog) throws CMSItemNotFoundException
      Activates a CMSSite and all associated catalog versions. If setDefaultCatalog is set to true the default catalog will be activated as currentcatalog.
      Specified by:
      setCurrentSiteAndCatalogVersions in interface CMSSiteService
      Parameters:
      siteId - id of the site to activate
      setDefaultCatalog - if set to true the default catalog will be activated as currentcatalog.
      Returns:
      the corresponding CMSSiteModel which was activated
      Throws:
      CMSItemNotFoundException - if no site with the given id could be found, no active catalogversion could be found for the associated catalogs or if setDefaultCatalog is set to true and no default catalog is set
    • setCurrentSiteAndCatalogVersionsForURL

      public CMSSiteModel setCurrentSiteAndCatalogVersionsForURL(URL url, boolean setDefaultCatalog) throws CMSItemNotFoundException
      Sets the site that is associated with the given url as current site. Also adds all active catalogversions of the site to the session.
      Specified by:
      setCurrentSiteAndCatalogVersionsForURL in interface CMSSiteService
      Parameters:
      url - the url
      setDefaultCatalog - if set to true the default catalog (with the active version) will be set as current catalogversion. This is only done when the current catalogversion is null.
      Returns:
      the corresponding CMSSiteModel which was activated
      Throws:
      CMSItemNotFoundException - if no site is associated with the given url
    • getCurrentSiteDefaultContentCatalogActiveVersion

      public CatalogVersionModel getCurrentSiteDefaultContentCatalogActiveVersion()
      Get default content catalog active version of current sites
      Specified by:
      getCurrentSiteDefaultContentCatalogActiveVersion in interface CMSSiteService
      Returns:
      CatalogVersionModel
    • compilePatterns

      protected List<Pattern> compilePatterns(Collection<String> stringPatterns)
    • getCmsPageService

      protected CMSPageService getCmsPageService()
      Default getter for CMSPageService
      Returns:
      the cmsPageService instance.
    • matches

      protected boolean matches(String input, Collection<Pattern> patterns)