Class TargetedContentStoreAdapterDecorator
java.lang.Object
org.craftercms.engine.targeting.impl.TargetedContentStoreAdapterDecorator
- All Implemented Interfaces:
org.craftercms.core.store.ContentStoreAdapter
,ContentStoreAdapterDecorator
public class TargetedContentStoreAdapterDecorator
extends Object
implements ContentStoreAdapterDecorator
ContentStoreAdapterDecorator
that uses a CandidateTargetedUrlsResolver
to generate candidate
URLs for targeted content lookup. For example, if an item at /site/website/es_CR/products/index.xml is requested,
the adapter might try to find the content first at that URL, then at /site/website/es/products/index.xml and
finally at /site/website/en/products/index.xml
The decorator is also capable of merging the items of folders that belong to the same family of targeted content, so for example, the tree of /site/website/es_CR can be the combination of all the items at /site/website/es_CR, /site/website/es and /site/website/en.
- Author:
- avasquez
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.craftercms.core.store.ContentStoreAdapter
protected CandidateTargetedUrlsResolver
static final org.apache.commons.logging.Log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
containsItem
(List<org.craftercms.core.service.Item> list, org.craftercms.core.service.Item item) org.craftercms.core.service.Context
createContext
(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles) void
destroyContext
(org.craftercms.core.service.Context context) boolean
exists
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.Content
findContent
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.Item
findItem
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path, boolean withDescriptor) List<org.craftercms.core.service.Item>
findItems
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) protected List<org.craftercms.core.service.Item>
mergeItems
(List<org.craftercms.core.service.Item> overriding, List<org.craftercms.core.service.Item> original) void
setActualStoreAdapter
(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Sets the store adapter to be decoratedvoid
setCandidateTargetedUrlsResolver
(CandidateTargetedUrlsResolver candidateTargetedUrlsResolver) boolean
validate
(org.craftercms.core.service.Context context)
-
Field Details
-
logger
public static final org.apache.commons.logging.Log logger -
actualStoreAdapter
protected org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter -
candidateTargetedUrlsResolver
-
-
Constructor Details
-
TargetedContentStoreAdapterDecorator
public TargetedContentStoreAdapterDecorator()
-
-
Method Details
-
setActualStoreAdapter
public void setActualStoreAdapter(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Description copied from interface:ContentStoreAdapterDecorator
Sets the store adapter to be decorated- Specified by:
setActualStoreAdapter
in interfaceContentStoreAdapterDecorator
- Parameters:
actualStoreAdapter
- the actual store adapter
-
setCandidateTargetedUrlsResolver
public void setCandidateTargetedUrlsResolver(CandidateTargetedUrlsResolver candidateTargetedUrlsResolver) -
createContext
public org.craftercms.core.service.Context createContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException - Specified by:
createContext
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-
validate
public boolean validate(org.craftercms.core.service.Context context) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException - Specified by:
validate
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-
destroyContext
public void destroyContext(org.craftercms.core.service.Context context) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException - Specified by:
destroyContext
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-
exists
public boolean exists(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException - Specified by:
exists
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.StoreException
-
findContent
public org.craftercms.core.service.Content findContent(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException - Specified by:
findContent
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.StoreException
-
findItem
public org.craftercms.core.service.Item findItem(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path, boolean withDescriptor) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.XmlFileParseException, org.craftercms.core.exception.StoreException - Specified by:
findItem
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.XmlFileParseException
org.craftercms.core.exception.StoreException
-
findItems
public List<org.craftercms.core.service.Item> findItems(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.XmlFileParseException, org.craftercms.core.exception.StoreException - Specified by:
findItems
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.XmlFileParseException
org.craftercms.core.exception.StoreException
-
mergeItems
-
containsItem
protected boolean containsItem(List<org.craftercms.core.service.Item> list, org.craftercms.core.service.Item item)
-