org.broadleafcommerce.cms.page.service
Class PageServiceImpl

java.lang.Object
  extended by org.broadleafcommerce.cms.page.service.PageServiceImpl
All Implemented Interfaces:
PageService

@Service(value="blPageService")
public class PageServiceImpl
extends Object
implements PageService

Created by bpolster.


Field Summary
protected static String AND
           
protected  LocaleService localeService
           
protected static org.apache.commons.logging.Log LOG
           
protected  PageDTO NULL_PAGE
           
protected  net.sf.ehcache.Cache pageCache
           
protected  PageDao pageDao
           
protected  List<RuleProcessor<PageDTO>> pageRuleProcessors
           
protected  StaticAssetPathService staticAssetPathService
           
protected  StaticAssetService staticAssetService
           
protected  StatisticsService statisticsService
           
 
Constructor Summary
PageServiceImpl()
           
 
Method Summary
protected  void addPageListToCache(List<PageDTO> pageList, String key)
           
protected  List<ItemCriteriaDTO> buildItemCriteriaDTOList(Page page)
           
protected  String buildKey(SandBox currentSandBox, Locale locale, String uri)
           
protected  String buildKey(SandBox sandBox, Page page)
           
protected  PageDTO buildPageDTOInternal(Page page, boolean secure)
           
protected  List<PageDTO> buildPageDTOList(List<Page> pageList, boolean secure)
          Converts a list of pages to a list of pageDTOs.
Internally calls buildPageDTO(...).
protected  String buildRuleExpression(Page page)
           
protected  PageDTO evaluatePageRules(List<PageDTO> pageDTOList, Locale locale, Map<String,Object> ruleDTOs)
           
protected  Locale findLanguageOnlyLocale(Locale locale)
           
 Page findPageById(Long pageId)
          Returns the page with the passed in id.
 PageDTO findPageByURI(Locale locale, String uri, Map<String,Object> ruleDTOs, boolean secure)
          Retrieve the page if one is available for the passed in uri.
 PageTemplate findPageTemplateById(Long id)
          Returns the page template with the passed in id.
 net.sf.ehcache.Cache getPageCache()
           
protected  List<PageDTO> getPageListFromCache(String key)
           
protected  boolean passesPageRules(PageDTO page, Map<String,Object> ruleDTOs)
           
 List<Page> readAllPages()
          Returns all pages, regardless of any sandbox they are apart of
 List<PageTemplate> readAllPageTemplates()
          Returns all page templates, regardless of any sandbox they are apart of
 void removePageFromCache(SandBox sandBox, Page p)
          Call to evict a page for a sandbox
 void removePageFromCache(String baseKey)
          Call to evict both secure and non-secure pages matching the passed in key.
 PageTemplate savePageTemplate(PageTemplate template)
          Saves the given PageTemplate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG

AND

protected static String AND

pageDao

protected PageDao pageDao

pageRuleProcessors

protected List<RuleProcessor<PageDTO>> pageRuleProcessors

localeService

protected LocaleService localeService

staticAssetService

protected StaticAssetService staticAssetService

staticAssetPathService

protected StaticAssetPathService staticAssetPathService

statisticsService

protected StatisticsService statisticsService

pageCache

protected net.sf.ehcache.Cache pageCache

NULL_PAGE

protected final PageDTO NULL_PAGE
Constructor Detail

PageServiceImpl

public PageServiceImpl()
Method Detail

findPageById

public Page findPageById(Long pageId)
Returns the page with the passed in id.

Specified by:
findPageById in interface PageService
Parameters:
pageId - - The id of the page.
Returns:
The associated page.

findPageTemplateById

public PageTemplate findPageTemplateById(Long id)
Description copied from interface: PageService
Returns the page template with the passed in id.

Specified by:
findPageTemplateById in interface PageService
Parameters:
id - - the id of the page template
Returns:
The associated page template.

savePageTemplate

@Transactional(value="blTransactionManager")
public PageTemplate savePageTemplate(PageTemplate template)
Description copied from interface: PageService
Saves the given PageTemplate

Specified by:
savePageTemplate in interface PageService
Parameters:
template - the PageTemplate to save
Returns:
the database-saved PageTemplate

findPageByURI

public PageDTO findPageByURI(Locale locale,
                             String uri,
                             Map<String,Object> ruleDTOs,
                             boolean secure)
Retrieve the page if one is available for the passed in uri.

Specified by:
findPageByURI in interface PageService
Parameters:
locale - - current locale
uri - - the URI to return a page for
ruleDTOs - - ruleDTOs that are used as the data to process page rules
secure - - set to true if current request is over HTTPS
Returns:

readAllPages

public List<Page> readAllPages()
Description copied from interface: PageService
Returns all pages, regardless of any sandbox they are apart of

Specified by:
readAllPages in interface PageService
Returns:
all Pages configured in the system

readAllPageTemplates

public List<PageTemplate> readAllPageTemplates()
Description copied from interface: PageService
Returns all page templates, regardless of any sandbox they are apart of

Specified by:
readAllPageTemplates in interface PageService
Returns:
all PageTemplates configured in the system

removePageFromCache

public void removePageFromCache(SandBox sandBox,
                                Page p)
Description copied from interface: PageService
Call to evict a page for a sandbox

Specified by:
removePageFromCache in interface PageService
Parameters:
sandBox - The sandbox in which the page resides
p - The page instance to evict from cache

removePageFromCache

public void removePageFromCache(String baseKey)
Description copied from interface: PageService
Call to evict both secure and non-secure pages matching the passed in key.

Specified by:
removePageFromCache in interface PageService

buildPageDTOList

protected List<PageDTO> buildPageDTOList(List<Page> pageList,
                                         boolean secure)
Converts a list of pages to a list of pageDTOs.
Internally calls buildPageDTO(...).

Parameters:
pageList -
secure -
Returns:

buildPageDTOInternal

protected PageDTO buildPageDTOInternal(Page page,
                                       boolean secure)

buildRuleExpression

protected String buildRuleExpression(Page page)

buildItemCriteriaDTOList

protected List<ItemCriteriaDTO> buildItemCriteriaDTOList(Page page)

evaluatePageRules

protected PageDTO evaluatePageRules(List<PageDTO> pageDTOList,
                                    Locale locale,
                                    Map<String,Object> ruleDTOs)

passesPageRules

protected boolean passesPageRules(PageDTO page,
                                  Map<String,Object> ruleDTOs)

findLanguageOnlyLocale

protected Locale findLanguageOnlyLocale(Locale locale)

buildKey

protected String buildKey(SandBox currentSandBox,
                          Locale locale,
                          String uri)

getPageCache

public net.sf.ehcache.Cache getPageCache()
Specified by:
getPageCache in interface PageService

buildKey

protected String buildKey(SandBox sandBox,
                          Page page)

addPageListToCache

protected void addPageListToCache(List<PageDTO> pageList,
                                  String key)

getPageListFromCache

protected List<PageDTO> getPageListFromCache(String key)


Copyright © 2013. All Rights Reserved.