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
FieldsModifier and TypeFieldDescriptionprotected org.craftercms.core.store.ContentStoreAdapterprotected CandidateTargetedUrlsResolverstatic final org.apache.commons.logging.Log -
Constructor Summary
ConstructorsConstructorDescriptionTargetedContentStoreAdapterDecorator(CandidateTargetedUrlsResolver candidateTargetedUrlsResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancontainsItem(List<org.craftercms.core.service.Item> list, org.craftercms.core.service.Item item) org.craftercms.core.service.ContextcreateContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles, Map<String, String> configurationVariables) voiddestroyContext(org.craftercms.core.service.Context context) booleanexists(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.ContentfindContent(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.ItemfindItem(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) voidsetActualStoreAdapter(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Sets the store adapter to be decoratedbooleanvalidate(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(CandidateTargetedUrlsResolver candidateTargetedUrlsResolver)
-
-
Method Details
-
setActualStoreAdapter
public void setActualStoreAdapter(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Description copied from interface:ContentStoreAdapterDecoratorSets the store adapter to be decorated- Specified by:
setActualStoreAdapterin interfaceContentStoreAdapterDecorator- Parameters:
actualStoreAdapter- the actual store adapter
-
createContext
public org.craftercms.core.service.Context createContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles, Map<String, String> configurationVariables) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException- Specified by:
createContextin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.StoreExceptionorg.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:
validatein interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.StoreExceptionorg.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:
destroyContextin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.craftercms.core.exception.StoreExceptionorg.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:
existsin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.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:
findContentin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.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:
findItemin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.craftercms.core.exception.XmlFileParseExceptionorg.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:
findItemsin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.craftercms.core.exception.XmlFileParseExceptionorg.craftercms.core.exception.StoreException
-
mergeItems
-
containsItem
protected boolean containsItem(List<org.craftercms.core.service.Item> list, org.craftercms.core.service.Item item)
-