Interface ContentItemService<P extends ContentItem>
- All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>,com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
- All Known Implementing Classes:
DefaultContentItemService
public interface ContentItemService<P extends ContentItem>
extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>
This service is responsible for handling all CRUD operations on
ContentItems.- Author:
- Jon Fleschler (jfleschler)
-
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the repository domain corresponding to the projection domain.readAllByIdIn(Collection<String> ids, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given ids.readAllByModelId(String modelId, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all content for a specific model.org.springframework.data.domain.Page<P>readAllByName(String nameQuery, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read allContentItems, optionally filtered by name.readAllByNameIn(Collection<String> names, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given names.org.springframework.data.domain.Page<P>readAllByNameWithActiveFlag(String activeFilter, String nameQuery, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all content, filtered by active date ranges, optionally filtered by name.org.springframework.data.domain.Page<P>readAllByQuery(String query, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all content based on the provided query.org.springframework.data.domain.Page<P>readAllByUriIsNotBlank(org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all non-nullContentItemsreadAllContentItemTags(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all tags associated with content items.readByCombinedModelAndItemUri(String uri, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Takes the givenuriand returns the item where the combination ofits URIand itsContentModel's URImatches.readByModelIdAndUri(String modelId, String uri, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) readByName(String contentName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.3.readByNameAndNotEmbedded(String contentName, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the non-embedded content item with the given name (should only be one result, as content names are unique in non-embedded items).org.springframework.data.domain.Page<P>readPageByIdIn(Collection<String> ids, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given ids.org.springframework.data.domain.Page<P>readPageByModelId(String modelId, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all content for a specific model.org.springframework.data.domain.Page<P>readPageByNameIn(Collection<String> names, org.springframework.data.domain.Pageable page, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given names.com.broadleafcommerce.translation.service.dto.TranslationsPayloadreplaceAllItemTranslations(String id, Locale locale, com.broadleafcommerce.translation.service.dto.TranslationsPayload request, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles persistence of translations related to aContentItemor itsFieldData.Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService
create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSortMethods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService
readAll, readAll, readAll, readAll
-
Method Details
-
readAllByNameWithActiveFlag
org.springframework.data.domain.Page<P> readAllByNameWithActiveFlag(String activeFilter, @Nullable String nameQuery, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all content, filtered by active date ranges, optionally filtered by name.- Parameters:
activeFilter- whether to filter by active / inactive or allnameQuery- (optional) the content name to filter bypage- the requested page of results from the databasefilters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- all menus, optionally filtered by name
-
readAllByUriIsNotBlank
org.springframework.data.domain.Page<P> readAllByUriIsNotBlank(@Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all non-nullContentItems- Parameters:
page- the requested page of results from the databasecontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a page of non-null content items
-
getRepositoryDomain
String getRepositoryDomain()Returns the name of the repository domain corresponding to the projection domain.- Returns:
- The name of the repository domain corresponding to the projection domain.
-
readAllByName
org.springframework.data.domain.Page<P> readAllByName(@Nullable String nameQuery, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read allContentItems, optionally filtered by name.- Parameters:
nameQuery- (optional) the content name to filter bypage- the requested page of results from the databasefilters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- all
ContentItems, optionally filtered by name
-
readAllByNameIn
List<P> readAllByNameIn(Collection<String> names, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given names.- Parameters:
names- Names of theContentItemsto retrieve.filters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- All
ContentItemsmatching the given names.
-
readPageByNameIn
org.springframework.data.domain.Page<P> readPageByNameIn(Collection<String> names, org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given names.- Parameters:
names- Names of theContentItemsto retrieve.page- the requested page of results from the databasefilters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- A page of all
ContentItemsmatching the given names.
-
readAllByIdIn
List<P> readAllByIdIn(Collection<String> ids, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given ids.- Parameters:
ids- Names of theContentItemsto retrieve.filters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- All
ContentItemsmatching the given ids.
-
readPageByIdIn
org.springframework.data.domain.Page<P> readPageByIdIn(Collection<String> ids, org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Reads allContentItemsmatching the given ids.- Parameters:
ids- Names of theContentItemsto retrieve.page- the requested page of results from the databasefilters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- A page of all
ContentItemsmatching the given ids.
-
readByName
@Deprecated(since="2.1.3", forRemoval=true) default Optional<P> readByName(String contentName, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.3. Content names are not unique for all content, they are only unique for non-embedded content. UsereadByNameAndNotEmbedded(String, ContextInfo)instead.Finds the content with the given name (should only be one result, as content names are unique).- Parameters:
contentName- the name of the content that should be retrievedcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- an
Optionalcontaining the content with the given name, empty if not found
-
readByNameAndNotEmbedded
Optional<P> readByNameAndNotEmbedded(String contentName, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds the non-embedded content item with the given name (should only be one result, as content names are unique in non-embedded items).- Parameters:
contentName- the name of the content that should be retrievedcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- an
Optionalcontaining the content with the given name, empty if not found
-
readAllByModelId
List<P> readAllByModelId(String modelId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all content for a specific model.- Parameters:
modelId- the content's model idfilters- additional filters to apply in the query, can be nullcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a list of content items associated with a model
-
readPageByModelId
org.springframework.data.domain.Page<P> readPageByModelId(String modelId, org.springframework.data.domain.Pageable page, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all content for a specific model.- Parameters:
modelId- the content's model idpage- the requested page of results from the databasefilters- additional filters to apply in the query, can be nullcontext- context information surrounding sandboxing and multitenant state- Returns:
- a page of content items associated with a model
-
readByModelIdAndUri
Optional<P> readByModelIdAndUri(String modelId, String uri, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) - Parameters:
modelId- ID of the model the item belongs touri- URI of the itemcontextInfo- Context information surrounding sandboxing and multitenant state- Returns:
- The
ContentItemby matchingmodelContextIdanduri.
-
readByCombinedModelAndItemUri
Optional<P> readByCombinedModelAndItemUri(String uri, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Takes the givenuriand returns the item where the combination ofits URIand itsContentModel's URImatches.- Parameters:
uri- The URI to match againstcontextInfo- context information surrounding sandboxing and multitenant state- Returns:
- A
ContentItemif the combination of its and its parent model's URIs matchuri.
-
readAllByQuery
org.springframework.data.domain.Page<P> readAllByQuery(@Nullable String query, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read all content based on the provided query.- Parameters:
query- the query to use to filter contentfilters- additional filters to apply in the query, can be nullpage- the requested page of results from the databasecontext- context information surrounding sandboxing and multitenant state- Returns:
- a page of content items matching the query
-
replaceAllItemTranslations
com.broadleafcommerce.translation.service.dto.TranslationsPayload replaceAllItemTranslations(String id, Locale locale, com.broadleafcommerce.translation.service.dto.TranslationsPayload request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles persistence of translations related to aContentItemor itsFieldData. FieldData don't have a separate endpoint but are otherwise treated as a separate entity. Therefore, this method is responsible for parsing theTranslationsPayloadand pulling out theFieldDatatranslations to be saved separately from the translation of directContentItemfields.- Parameters:
id- Id of theContentItemlocale- Locale the translations map torequest-TranslationsPayloadcontext- Additional multitenant and sandbox info- Returns:
- The updated translations.
-
readAllContentItemTags
Collection<ContentTag> readAllContentItemTags(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Read all tags associated with content items.- Parameters:
contextInfo- context information surrounding sandboxing and multitenant state- Returns:
- a list of tags
-