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 Type
    Method
    Description
    Returns 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 all ContentItems matching 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 all ContentItems, optionally filtered by name.
    readAllByNameIn(Collection<String> names, cz.jirutka.rsql.parser.ast.Node filters, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Reads all ContentItems matching 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-null ContentItems
    readAllContentItemTags(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 given uri and returns the item where the combination of its URI and its ContentModel's URI matches.
    readByModelIdAndUri(String modelId, String uri, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Retrieves the ContentItem by matching modelId and uri.
    default Optional<P>
    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 all ContentItems matching 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 all ContentItems matching the given names.
    com.broadleafcommerce.translation.service.dto.TranslationsPayload
    replaceAllItemTranslations(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 a ContentItem or its FieldData.

    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, updateSort

    Methods 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 all
      nameQuery - (optional) the content name to filter by
      page - the requested page of results from the database
      filters - additional filters to apply in the query, can be null
      context - 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-null ContentItems
      Parameters:
      page - the requested page of results from the database
      contextInfo - 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 all ContentItems, optionally filtered by name.
      Parameters:
      nameQuery - (optional) the content name to filter by
      page - the requested page of results from the database
      filters - additional filters to apply in the query, can be null
      context - 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 all ContentItems matching the given names.
      Parameters:
      names - Names of the ContentItems to retrieve.
      filters - additional filters to apply in the query, can be null
      context - context information surrounding sandboxing and multitenant state
      Returns:
      All ContentItems matching 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 all ContentItems matching the given names.
      Parameters:
      names - Names of the ContentItems to retrieve.
      page - the requested page of results from the database
      filters - additional filters to apply in the query, can be null
      context - context information surrounding sandboxing and multitenant state
      Returns:
      A page of all ContentItems matching 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 all ContentItems matching the given ids.
      Parameters:
      ids - Names of the ContentItems to retrieve.
      filters - additional filters to apply in the query, can be null
      context - context information surrounding sandboxing and multitenant state
      Returns:
      All ContentItems matching 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 all ContentItems matching the given ids.
      Parameters:
      ids - Names of the ContentItems to retrieve.
      page - the requested page of results from the database
      filters - additional filters to apply in the query, can be null
      context - context information surrounding sandboxing and multitenant state
      Returns:
      A page of all ContentItems matching 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. Use readByNameAndNotEmbedded(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 retrieved
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      an Optional containing 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 retrieved
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      an Optional containing 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 id
      filters - additional filters to apply in the query, can be null
      contextInfo - 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 id
      page - the requested page of results from the database
      filters - additional filters to apply in the query, can be null
      context - 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)
      Retrieves the ContentItem by matching modelId and uri.
      Parameters:
      modelId - ID of the model the item belongs to
      uri - URI of the item
      contextInfo - Context information surrounding sandboxing and multitenant state
      Returns:
      The ContentItem by matching modelContextId and uri.
    • readByCombinedModelAndItemUri

      Optional<P> readByCombinedModelAndItemUri(String uri, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Takes the given uri and returns the item where the combination of its URI and its ContentModel's URI matches.
      Parameters:
      uri - The URI to match against
      contextInfo - context information surrounding sandboxing and multitenant state
      Returns:
      A ContentItem if the combination of its and its parent model's URIs match uri.
    • 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 content
      filters - additional filters to apply in the query, can be null
      page - the requested page of results from the database
      context - 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 a ContentItem or its FieldData. FieldData don't have a separate endpoint but are otherwise treated as a separate entity. Therefore, this method is responsible for parsing the TranslationsPayload and pulling out the FieldData translations to be saved separately from the translation of direct ContentItem fields.
      Parameters:
      id - Id of the ContentItem
      locale - Locale the translations map to
      request - TranslationsPayload
      context - 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