Interface StructuredContentService

All Known Implementing Classes:
StructuredContentServiceImpl

public interface StructuredContentService
Provides services to manage StructuredContent items.
Author:
bpolster
  • Method Details

    • findStructuredContentById

      StructuredContent findStructuredContentById(Long contentId)
      Returns the StructuredContent item associated with the passed in id.
      Parameters:
      contentId - - The id of the content item.
      Returns:
      The associated structured content item.
    • findStructuredContentTypeById

      StructuredContentType findStructuredContentTypeById(Long id)
      Returns the StructuredContentType associated with the passed in id.
      Parameters:
      id - - The id of the content type.
      Returns:
      The associated StructuredContentType.
    • findStructuredContentTypeByName

      StructuredContentType findStructuredContentTypeByName(String name)
      Returns the StructuredContentType associated with the passed in String value.
      Parameters:
      name - - The name of the content type.
      Returns:
      The associated StructuredContentType.
    • retrieveAllStructuredContentTypes

      List<StructuredContentType> retrieveAllStructuredContentTypes()
      Returns:
      a list of all StructuredContentTypes
    • findAllContentItems

      List<StructuredContent> findAllContentItems()
      Finds all content items regardless of the Sandbox they are a member of
      Returns:
    • saveStructuredContentType

      StructuredContentType saveStructuredContentType(StructuredContentType type)
      Saves the given type and returns the merged instance
    • lookupStructuredContentItemsByType

      List<StructuredContentDTO> lookupStructuredContentItemsByType(StructuredContentType contentType, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
      This method returns content
      Returns active content items for the passed in sandbox that match the passed in type.
      The SandBox parameter impacts the results as follows. If a SandBoxType of production is passed in, only those items in that SandBox are returned.
      If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.
      The secure item is used in cases where the structured content item contains an image path that needs to be rewritten to use https.
      Parameters:
      sandBox - - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.
      contentType - - the type of content to return
      count - - the max number of content items to return
      ruleDTOs - - a Map of objects that will be used in MVEL processing.
      secure - - set to true if the request is being served over https
      Returns:
      - The matching items
      See Also:
      • org.broadleafcommerce.cms.web.structure.DisplayContentTag
    • lookupStructuredContentItemsByName

      List<StructuredContentDTO> lookupStructuredContentItemsByName(String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
      This method returns content by name only.
      Returns active content items for the passed in sandbox that match the passed in type.
      The SandBox parameter impacts the results as follows. If a SandBoxType of production is passed in, only those items in that SandBox are returned.
      If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.
      Parameters:
      sandBox - - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.
      contentName - - the name of content to return
      count - - the max number of content items to return
      ruleDTOs - - a Map of objects that will be used in MVEL processing.
      secure - - set to true if the request is being served over https
      Returns:
      - The matching items
      See Also:
      • org.broadleafcommerce.cms.web.structure.DisplayContentTag
    • lookupStructuredContentItemsByName

      List<StructuredContentDTO> lookupStructuredContentItemsByName(StructuredContentType contentType, String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
      This method returns content by name and type.
      Returns active content items for the passed in sandbox that match the passed in type.
      The SandBox parameter impacts the results as follows. If a SandBoxType of production is passed in, only those items in that SandBox are returned.
      If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.
      Parameters:
      sandBox - - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.
      contentType - - the type of content to return
      contentName - - the name of content to return
      count - - the max number of content items to return
      ruleDTOs - - a Map of objects that will be used in MVEL processing.
      secure - - set to true if the request is being served over https
      Returns:
      - The matching items
      See Also:
      • org.broadleafcommerce.cms.web.structure.DisplayContentTag
    • findLanguageOnlyLocale

      Locale findLanguageOnlyLocale(Locale locale)
    • buildStructuredContentDTOList

      List<StructuredContentDTO> buildStructuredContentDTOList(List<StructuredContent> structuredContentList, boolean secure)
    • evaluateAndPriortizeContent

      List<StructuredContentDTO> evaluateAndPriortizeContent(List<StructuredContentDTO> structuredContentList, int count, Map<String,Object> ruleDTOs)
    • getStructuredContentCache

      javax.cache.Cache getStructuredContentCache()
    • buildStructuredContentDTO

      StructuredContentDTO buildStructuredContentDTO(StructuredContent sc, boolean secure)
      Converts a StructuredContent into a StructuredContentDTO. If the item contains fields with broadleaf cms urls, the urls are converted to utilize the domain.

      The StructuredContentDTO is built via the EntityConfiguration. To override the actual type that is returned, include an override in an applicationContext like any other entity override.

      Parameters:
      sc -
      secure -
      Returns:
    • addStructuredContentListToCache

      void addStructuredContentListToCache(String key, List<StructuredContentDTO> scDTOList)
    • buildTypeKey

      @Deprecated String buildTypeKey(SandBox currentSandbox, Long site, Locale locale, String contentType)
      Builds the cache key for DTOLists based on the SC Type.
      Parameters:
      currentSandbox -
      site -
      locale -
      contentType -
      Returns:
      cache key for DTOList
    • buildTypeKeyWithSecure

      String buildTypeKeyWithSecure(SandBox currentSandbox, Long site, Locale locale, String contentType, Boolean secure)
      Builds the cache key for DTOLists based on the SC Type.
      Parameters:
      currentSandbox -
      site -
      locale -
      contentType -
      secure -
      Returns:
      cache key for DTOList
    • getStructuredContentListFromCache

      List<StructuredContentDTO> getStructuredContentListFromCache(String key)
    • removeStructuredContentFromCache

      void removeStructuredContentFromCache(SandBox sandBox, StructuredContent sc)
      Call to evict an item from the cache.
      Parameters:
      sandBox -
      sc -
    • removeItemFromCache

      @Deprecated void removeItemFromCache(String nameKey, String typeKey)
      Call to evict both secure and non-secure SC items matching the passed in keys.
      Parameters:
      nameKey -
      typeKey -
    • removeItemFromCacheByKey

      boolean removeItemFromCacheByKey(String key)
      Call to evict both secure and non-secure SC items matching the passed in key.
      Parameters:
      key -
      Returns:
    • convertToDtos

      List<StructuredContentDTO> convertToDtos(List<StructuredContent> scs, boolean isSecure)
      Converts a list of StructuredContent objects into their corresponding StructuredContentDTOs. This method will utilize a cache in production mode, and it will additionally hydrate the returned StructuredContentDTO objects via the #hydrateForeignLookups(List) method.
      Parameters:
      scs -
      Returns:
      the list of StructuredContentDTOs
    • getStructuredContentItemsByContentName

      List<StructuredContentDTO> getStructuredContentItemsByContentName(String contentName, Locale locale, boolean isSecure)
      First attempts to retrieve StructuredContentDTO from cache before making calls to database
      Parameters:
      contentName - (Name of ContentItem
      locale -
      isSecure -
      Returns: