Class DefaultContentFolderService<P extends ContentFolder>

java.lang.Object
com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P>
com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P>
com.broadleafcommerce.content.service.folder.DefaultContentFolderService<P>
All Implemented Interfaces:
ContentFolderService<P>, com.broadleafcommerce.data.tracking.core.service.CrudEntityService<P>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<P>

public class DefaultContentFolderService<P extends ContentFolder> extends com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService<P> implements ContentFolderService<P>
Author:
Jon Fleschler (jfleschler)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultContentFolderService(ContentFolderRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    existsByParentFolderId(String folderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns whether there are any folders with folderId as their ContentFolder.parentFolderId.
    protected ContentFolderRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    org.springframework.data.domain.Page<P>
    readAllByContextIds(Collection<String> folderIds, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Finds all folders with IDs in the supplied list.
    org.springframework.data.domain.Page<P>
    readAllByName(String nameQuery, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all folders in the database, optionally filtering by name if specified.
    org.springframework.data.domain.Page<P>
    readAllSubFoldersOfFolder(String folderId, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable pageInfo, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads all folders who have the given folder as a parent.
    readPathToFolder(String folderId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Returns a list of all folders that are in the path to the given folder.

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseRsqlCrudEntityService

    getRsqlHelper, readAll, readAll, readAll, readAll

    Methods inherited from class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService

    convertFromPersistentDomain, convertToPersistentDomain, create, createAll, createAllAllowingPartialSuccess, delete, getHelper, getSortPositionStrategy, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, setSortPositionStrategy, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    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
  • Constructor Details

    • DefaultContentFolderService

      public DefaultContentFolderService(ContentFolderRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityHelper helper)
  • Method Details

    • readAllByName

      public org.springframework.data.domain.Page<P> readAllByName(@Nullable String nameQuery, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentFolderService
      Reads all folders in the database, optionally filtering by name if specified.
      Specified by:
      readAllByName in interface ContentFolderService<P extends ContentFolder>
      Parameters:
      nameQuery - the name to search for (optional)
      filters - additional filters to apply in the query, can be null
      pageInfo - pagination information
      contextInfo - the context to perform the operation in
      Returns:
      the requested page of folders from the result of the query
    • readAllByContextIds

      public org.springframework.data.domain.Page<P> readAllByContextIds(Collection<String> folderIds, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentFolderService
      Finds all folders with IDs in the supplied list.
      Specified by:
      readAllByContextIds in interface ContentFolderService<P extends ContentFolder>
      Parameters:
      folderIds - the folder context IDs to search for
      pageInfo - pagination information
      contextInfo - the context to perform the operation in
      Returns:
      the folders that matched with the IDs in the given list
    • readAllSubFoldersOfFolder

      public org.springframework.data.domain.Page<P> readAllSubFoldersOfFolder(@Nullable String folderId, @Nullable cz.jirutka.rsql.parser.ast.Node filters, @Nullable org.springframework.data.domain.Pageable pageInfo, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentFolderService
      Reads all folders who have the given folder as a parent.
      Specified by:
      readAllSubFoldersOfFolder in interface ContentFolderService<P extends ContentFolder>
      Parameters:
      folderId - the context ID of the folder whose children should be returned. If null, this will return all root folders.
      filters - additional filters to apply in the query, can be null
      pageInfo - pagination information
      contextInfo - the context to perform the operation in
      Returns:
      all folders who have the given folder as a parent. Throws EntityMissingException if no folder was found with the given folderId.
    • readPathToFolder

      public List<P> readPathToFolder(String folderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentFolderService
      Returns a list of all folders that are in the path to the given folder. The list will be ordered from the root folder to the given folder.
      Specified by:
      readPathToFolder in interface ContentFolderService<P extends ContentFolder>
      Parameters:
      folderId - the context ID of the folder to find the path to
      contextInfo - the context surrounding sandboxing and mulitenant state
      Returns:
      a list of all folders that are in the path to the given folder
    • existsByParentFolderId

      public boolean existsByParentFolderId(String folderId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ContentFolderService
      Returns whether there are any folders with folderId as their ContentFolder.parentFolderId. Essentially, this determines if there are any subfolders directly in the given folder.
      Specified by:
      existsByParentFolderId in interface ContentFolderService<P extends ContentFolder>
      Parameters:
      folderId - the context ID of the parent folder to search for
      contextInfo - the context surrounding sandboxing and mulitenant state
      Returns:
      whether there are any folders with folderId as their ContentFolder.parentFolderId
    • getRepository

      protected ContentFolderRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
      Overrides:
      getRepository in class com.broadleafcommerce.data.tracking.core.service.BaseCrudEntityService<P extends ContentFolder>