public interface ContentItemService
Modifier and Type | Method and Description |
---|---|
ContentItemDTO |
createContentItemDTOFromContentItem(boolean secure,
Map<String,Object> args,
ContentItem ci)
Creates a ContentItemDTO from the passed in ContentItem and caches it
|
List<OverrideContentItem> |
findAllOverrideContentItemsByContentItemId(Long id)
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 . |
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. |
List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> |
hydrateForeignLookups(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
StructuredContentDTO objects are sometimes cached in the StructuredContentService. |
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 |
void |
setStructuredContentForDTO(ContentItem contentItem,
boolean isSecure,
ContentItemDTO ciDto)
Adds
StructuredContentDTO to ContentItemDTO . |
ContentItem findContentItemById(Long id)
ContentItem
that has the given idid
- ContentItem
ContentItem saveContentItem(ContentItem contentItem)
ContentItem
and returns the saved versioncontentItem
- ContentItem
OverrideContentItem findOverrideContentItemByContentItemId(Long contentItemId)
OverrideContentItem
for the given ContentItem
idcontentItemId
- OverrideContentItem
OverrideContentItem readOverrideContentItemById(Long id)
OverrideContentItem
that has the given idid
- OverrideContentItem
ContentItem generateContentItemByOverrideContentItem(OverrideContentItem overrideContentItem)
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.overrideContentItem
- ContentItem
List<OverrideContentItem> findAllOverrideContentItemsByContentItemId(Long id)
OverrideContentItem
sid
- OverrideContentItem
sContentItemDTO createContentItemDTOFromContentItem(boolean secure, Map<String,Object> args, ContentItem ci)
secure
- args
- ci
- ContentItemDTO getClonedContentItemDTO(ContentItemDTO ciDto)
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.ciDto
- ContentItemDTO postRetrievalContentItemModification(ContentItemDTO ciDto, String name, boolean secure, Map<String,Object> args)
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.ciDto
- name
- secure
- args
- @returnList<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> hydrateForeignLookups(List<org.broadleafcommerce.common.structure.dto.StructuredContentDTO> dtos)
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.dtos
- boolean removeContentItemFromCache(ContentItem contentItem)
contentItem
- void setStructuredContentForDTO(ContentItem contentItem, boolean isSecure, ContentItemDTO ciDto)
StructuredContentDTO
to ContentItemDTO
. First looks at Cache, then goes to database.contentItem
- ciDto
- isSecure
- Copyright © 2020. All rights reserved.