Class 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 Detail

      • logger

        public static final org.apache.commons.logging.Log logger
      • actualStoreAdapter

        protected org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter
    • Constructor Detail

      • TargetedContentStoreAdapterDecorator

        public TargetedContentStoreAdapterDecorator()
    • Method Detail

      • 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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.craftercms.core.store.ContentStoreAdapter
        Throws:
        org.craftercms.core.exception.InvalidContextException
        org.craftercms.core.exception.XmlFileParseException
        org.craftercms.core.exception.StoreException
      • mergeItems

        protected List<org.craftercms.core.service.Item> mergeItems​(List<org.craftercms.core.service.Item> overriding,
                                                                    List<org.craftercms.core.service.Item> original)
      • containsItem

        protected boolean containsItem​(List<org.craftercms.core.service.Item> list,
                                       org.craftercms.core.service.Item item)