@Repository(value="blContentItemService") public class ContentItemServiceImpl extends Object implements ContentItemService
Modifier and Type | Field and Description |
---|---|
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 net.sf.ehcache.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
OverrideContentItem s |
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 net.sf.ehcache.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 net.sf.ehcache.Cache structuredContentMapCache
protected boolean getIncludeNonOverriddenSCItemsFlag()
public ContentItem findContentItemById(Long id)
ContentItemService
ContentItem
that has the given idfindContentItemById
in interface ContentItemService
ContentItem
public OverrideContentItem findOverrideContentItemByContentItemId(Long contentItemId)
ContentItemService
OverrideContentItem
for the given ContentItem
idfindOverrideContentItemByContentItemId
in interface ContentItemService
OverrideContentItem
public ContentItem saveContentItem(ContentItem contentItem)
ContentItemService
ContentItem
and returns the saved versionsaveContentItem
in interface ContentItemService
ContentItem
public OverrideContentItem readOverrideContentItemById(Long id)
ContentItemService
OverrideContentItem
that has the given idreadOverrideContentItemById
in interface ContentItemService
OverrideContentItem
public ContentItem generateContentItemByOverrideContentItem(OverrideContentItem overrideContentItem)
ContentItemService
ContentItem
that takes into consideration the overrides present in the given
OverrideContentItem
. This method will iterate through the OverrideSCItem
s 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 ContentItemService
ContentItem
protected List<StructuredContentContentItemXref> generateContentItemFields(OverrideContentItem overrideContentItem, ContentItem clonedCI)
protected List<StructuredContentContentItemXref> generateSCCIXref(OverrideContentItem overrideContentItem, ContentItem clonedCI)
public List<OverrideContentItem> findAllOverrideContentItemsByContentItemId(Long contentItemId)
ContentItemService
OverrideContentItem
sfindAllOverrideContentItemsByContentItemId
in interface ContentItemService
OverrideContentItem
spublic ContentItemDTO createContentItemDTOFromContentItem(boolean secure, Map<String,Object> args, ContentItem ci)
ContentItemService
createContentItemDTOFromContentItem
in interface ContentItemService
public void setStructuredContentForDTO(ContentItem contentItem, boolean isSecure, ContentItemDTO ciDto)
StructuredContentDTO
to ContentItemDTO
setStructuredContentForDTO
in interface ContentItemService
contentItem
- 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)
ContentItemService
ContentItemDTO
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 ContentItemService
public ContentItemDTO postRetrievalContentItemModification(ContentItemDTO ciDto, String name, boolean secure, Map<String,Object> args)
ContentItemService
ContentItemDTO
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 ContentItemService
args
- @returnpublic List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> hydrateForeignLookups(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
ContentItemService
StructuredContentDTO
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 ContentItemService
protected 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)
ContentItemService
removeContentItemFromCache
in interface ContentItemService
protected void addStructuredContentDTOsToCache(ContentItemDTO contentItemDto, ContentItem item, boolean secure)
protected net.sf.ehcache.Cache getStructuredContentMapCache()
protected ContentItemDTO createContentItemDto(ContentItem contentItem)
ContentItemDTO
given a contentItem.Copyright © 2020. All rights reserved.