@Repository(value="blContentItemService") public class ContentItemServiceImpl extends Object implements ContentItemService
| Modifier and Type | Field and Description |
|---|---|
protected javax.cache.CacheManager |
cacheManager |
protected ContentItemDao |
contentItemDao |
protected ContentZoneServiceExtensionManager |
extensionManager |
protected static String |
FOREIGN_LOOKUP |
protected org.broadleafcommerce.common.dao.GenericEntityDao |
genericDao |
protected OverrideContentService |
overrideContentService |
protected ContentZoneQueryExtensionHandler |
queryExtensionManager |
protected org.broadleafcommerce.common.sandbox.SandBoxHelper |
sandBoxHelper |
protected org.broadleafcommerce.common.cache.StatisticsService |
statisticsService |
protected javax.cache.Cache |
structuredContentMapCache |
protected org.broadleafcommerce.cms.structure.service.StructuredContentService |
structuredContentService |
| Constructor and Description |
|---|
ContentItemServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addStructuredContentDTOsToCache(ContentItemDTO contentItemDto,
ContentItem item,
boolean secure) |
protected String |
buildCacheKey(ContentItemDTO contentItemDto,
ContentItem item) |
protected String |
buildMapKey(ContentItemDTO contentItemDto,
boolean secure,
org.broadleafcommerce.common.web.BroadleafRequestContext context) |
protected ContentItemDTO |
createContentItemDto(ContentItem contentItem)
Creates the
ContentItemDTO given a contentItem. |
ContentItemDTO |
createContentItemDTOFromContentItem(boolean secure,
Map<String,Object> args,
ContentItem ci)
Creates a ContentItemDTO from the passed in ContentItem and caches it
|
protected List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> |
createStructuredContentDTOs(ContentItem ci,
boolean isSecure)
Creates
StructuredContentDTO objects. |
List<OverrideContentItem> |
findAllOverrideContentItemsByContentItemId(Long contentItemId)
Returns a list of all
OverrideContentItems |
ContentItem |
findContentItemById(Long id)
Returns the
ContentItem that has the given id |
OverrideContentItem |
findOverrideContentItemByContentItemId(Long contentItemId)
Returns the appropriate
OverrideContentItem for the given ContentItem id |
ContentItem |
generateContentItemByOverrideContentItem(OverrideContentItem overrideContentItem)
Creates a transient
ContentItem that takes into consideration the overrides present in the given
OverrideContentItem. |
protected List<StructuredContentContentItemXref> |
generateContentItemFields(OverrideContentItem overrideContentItem,
ContentItem clonedCI) |
protected List<StructuredContentContentItemXref> |
generateSCCIXref(OverrideContentItem overrideContentItem,
ContentItem clonedCI) |
protected String |
getCacheKey(String cacheKey,
org.broadleafcommerce.common.extension.ResultType resultType) |
ContentItemDTO |
getClonedContentItemDTO(ContentItemDTO ciDto)
When passing in the
ContentItemDTO to the post retrieval method
we clone the DTO to prevent unwanted changes to the original. |
protected boolean |
getIncludeNonOverriddenSCItemsFlag() |
protected org.broadleafcommerce.common.extension.ResultType |
getResultType(Object object) |
protected javax.cache.Cache |
getStructuredContentMapCache() |
List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> |
hydrateForeignLookups(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
StructuredContentDTO objects are sometimes cached in the StructuredContentService. |
protected boolean |
isMasterContentData(org.broadleafcommerce.common.structure.dto.StructuredContentDTO scDto) |
protected boolean |
isValueObjectTranslatable(Object value) |
protected List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> |
lookupStructuredContentDTOsFromCache(ContentItemDTO contentItemDto,
ContentItem item,
boolean secure) |
ContentItemDTO |
postRetrievalContentItemModification(ContentItemDTO ciDto,
String name,
boolean secure,
Map<String,Object> args)
Used to modify the
ContentItemDTO created. |
OverrideContentItem |
readOverrideContentItemById(Long id)
Returns the
OverrideContentItem that has the given id |
boolean |
removeContentItemFromCache(ContentItem contentItem)
Removes the passed in contentItem (and its associated StructuredContent items) from cache
|
ContentItem |
saveContentItem(ContentItem contentItem)
Saves a
ContentItem and returns the saved version |
protected void |
setMasterStructuredContentDTOs(ContentItemDTO ciDto) |
protected void |
setStructuredContentDTOTranslations(ContentItem contentItem,
List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos) |
void |
setStructuredContentForDTO(ContentItem contentItem,
boolean isSecure,
ContentItemDTO ciDto)
Adds
StructuredContentDTO to ContentItemDTO |
protected void |
sortDTOsByPriority(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos) |
protected void |
translateStructuredContentDTO(org.broadleafcommerce.common.structure.dto.StructuredContentDTO dto,
ContentItem contentItem) |
protected List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> |
utilizeCache(ContentItem contentItem,
boolean isSecure,
ContentItemDTO ciDto) |
protected static final String FOREIGN_LOOKUP
protected ContentItemDao contentItemDao
protected OverrideContentService overrideContentService
protected ContentZoneServiceExtensionManager extensionManager
protected ContentZoneQueryExtensionHandler queryExtensionManager
protected org.broadleafcommerce.common.dao.GenericEntityDao genericDao
protected org.broadleafcommerce.common.cache.StatisticsService statisticsService
protected org.broadleafcommerce.cms.structure.service.StructuredContentService structuredContentService
protected org.broadleafcommerce.common.sandbox.SandBoxHelper sandBoxHelper
protected javax.cache.CacheManager cacheManager
protected javax.cache.Cache structuredContentMapCache
protected boolean getIncludeNonOverriddenSCItemsFlag()
public ContentItem findContentItemById(Long id)
ContentItemServiceContentItem that has the given idfindContentItemById in interface ContentItemServiceContentItempublic OverrideContentItem findOverrideContentItemByContentItemId(Long contentItemId)
ContentItemServiceOverrideContentItem for the given ContentItem idfindOverrideContentItemByContentItemId in interface ContentItemServiceOverrideContentItempublic ContentItem saveContentItem(ContentItem contentItem)
ContentItemServiceContentItem and returns the saved versionsaveContentItem in interface ContentItemServiceContentItempublic OverrideContentItem readOverrideContentItemById(Long id)
ContentItemServiceOverrideContentItem that has the given idreadOverrideContentItemById in interface ContentItemServiceOverrideContentItempublic ContentItem generateContentItemByOverrideContentItem(OverrideContentItem overrideContentItem)
ContentItemServiceContentItem that takes into consideration the overrides present in the given
OverrideContentItem. This method will iterate through the OverrideSCItems in the override
content item and generate a content item that has the overrides in place.
This method is used to allow downstream code to only think about rendering a content item and not have to worry
about handling things differently if there is an override content item present.generateContentItemByOverrideContentItem in interface ContentItemServiceContentItemprotected List<StructuredContentContentItemXref> generateContentItemFields(OverrideContentItem overrideContentItem, ContentItem clonedCI)
protected List<StructuredContentContentItemXref> generateSCCIXref(OverrideContentItem overrideContentItem, ContentItem clonedCI)
public List<OverrideContentItem> findAllOverrideContentItemsByContentItemId(Long contentItemId)
ContentItemServiceOverrideContentItemsfindAllOverrideContentItemsByContentItemId in interface ContentItemServiceOverrideContentItemspublic ContentItemDTO createContentItemDTOFromContentItem(boolean secure, Map<String,Object> args, ContentItem ci)
ContentItemServicecreateContentItemDTOFromContentItem in interface ContentItemServicepublic void setStructuredContentForDTO(ContentItem contentItem, boolean isSecure, ContentItemDTO ciDto)
StructuredContentDTO to ContentItemDTOsetStructuredContentForDTO in interface ContentItemServicecontentItem - ciDto - isSecure - protected List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> utilizeCache(ContentItem contentItem, boolean isSecure, ContentItemDTO ciDto)
protected void setMasterStructuredContentDTOs(ContentItemDTO ciDto)
protected boolean isMasterContentData(org.broadleafcommerce.common.structure.dto.StructuredContentDTO scDto)
protected List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> createStructuredContentDTOs(ContentItem ci, boolean isSecure)
StructuredContentDTO objects.ci - isSecure - protected void setStructuredContentDTOTranslations(ContentItem contentItem, List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
contentItem - dtos - protected void translateStructuredContentDTO(org.broadleafcommerce.common.structure.dto.StructuredContentDTO dto,
ContentItem contentItem)
dto - contentItem - protected boolean isValueObjectTranslatable(Object value)
value - protected void sortDTOsByPriority(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
public ContentItemDTO getClonedContentItemDTO(ContentItemDTO ciDto)
ContentItemServiceContentItemDTO to the post retrieval method
we clone the DTO to prevent unwanted changes to the original. With this hook point implementors can override
this behavior if needed.getClonedContentItemDTO in interface ContentItemServicepublic ContentItemDTO postRetrievalContentItemModification(ContentItemDTO ciDto, String name, boolean secure, Map<String,Object> args)
ContentItemServiceContentItemDTO created. This allows
for a hook point to allow implementors to add custom logic to change, add, remove any element(s) in this DTO.
The default implementation does not make any modifications.
One example would be to modify the StructuredContentDTO
that has been retrieved with the ContentItem. The list can be filtered, reordered, etc.postRetrievalContentItemModification in interface ContentItemServiceargs - @returnpublic List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> hydrateForeignLookups(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
ContentItemServiceStructuredContentDTO objects are sometimes cached in the StructuredContentService. Furthermore, this cached
version contains information about the kind of value the DTO might hold. In the cases where the value is a foreign
key lookup, we want to get the object that it represents and set that as the internal value. However, since these
DTOs are not Hibernate entities and are possibly stored in a cache, we need to load the target object on each request
to avoid lazy initialization exceptions. This method performs that hydration.hydrateForeignLookups in interface ContentItemServiceprotected List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> lookupStructuredContentDTOsFromCache(ContentItemDTO contentItemDto, ContentItem item, boolean secure)
protected String buildCacheKey(ContentItemDTO contentItemDto, ContentItem item)
protected String buildMapKey(ContentItemDTO contentItemDto, boolean secure, org.broadleafcommerce.common.web.BroadleafRequestContext context)
protected String getCacheKey(String cacheKey, org.broadleafcommerce.common.extension.ResultType resultType)
protected org.broadleafcommerce.common.extension.ResultType getResultType(Object object)
public boolean removeContentItemFromCache(ContentItem contentItem)
ContentItemServiceremoveContentItemFromCache in interface ContentItemServiceprotected void addStructuredContentDTOsToCache(ContentItemDTO contentItemDto, ContentItem item, boolean secure)
protected javax.cache.Cache getStructuredContentMapCache()
protected ContentItemDTO createContentItemDto(ContentItem contentItem)
ContentItemDTO given a contentItem.Copyright © 2020. All rights reserved.