Class AbstractCategoryServiceImpl

java.lang.Object
org.alfresco.repo.search.impl.AbstractCategoryServiceImpl
All Implemented Interfaces:
CategoryService
Direct Known Subclasses:
NoIndexCategoryServiceImpl, SolrCategoryServiceImpl

public abstract class AbstractCategoryServiceImpl extends Object implements CategoryService
Category service implementation
Author:
andyh
  • Field Details

  • Constructor Details

    • AbstractCategoryServiceImpl

      public AbstractCategoryServiceImpl()
  • Method Details

    • setNodeService

      public void setNodeService(NodeService nodeService)
      Set the node service
      Parameters:
      nodeService - NodeService
    • setPublicNodeService

      public void setPublicNodeService(NodeService publicNodeService)
      Set the public node service
      Parameters:
      publicNodeService - NodeService
    • setTenantService

      public void setTenantService(TenantService tenantService)
      Set the tenant service
      Parameters:
      tenantService - TenantService
    • setNamespacePrefixResolver

      public void setNamespacePrefixResolver(NamespacePrefixResolver namespacePrefixResolver)
      Set the service to map prefixes to uris
      Parameters:
      namespacePrefixResolver - NamespacePrefixResolver
    • setDictionaryService

      public void setDictionaryService(DictionaryService dictionaryService)
      Set the dictionary service
      Parameters:
      dictionaryService - DictionaryService
    • setIndexerAndSearcher

      public void setIndexerAndSearcher(IndexerAndSearcher indexerAndSearcher)
      Set the indexer and searcher
      Parameters:
      indexerAndSearcher - IndexerAndSearcher
    • setQueryFetchSize

      public void setQueryFetchSize(int queryFetchSize)
    • getChildren

      public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, CategoryService.Mode mode, CategoryService.Depth depth)
      Description copied from interface: CategoryService
      Get the children of a given category node
      Specified by:
      getChildren in interface CategoryService
      Parameters:
      categoryRef - - the category node
      mode - - the enumeration mode for what to recover
      depth - - the enumeration depth for what level to recover
      Returns:
      a collection of all the nodes found identified by their ChildAssocRef's
    • getChildren

      public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, CategoryService.Mode mode, CategoryService.Depth depth, String filter)
    • getPrefix

      protected String getPrefix(String uri)
    • getCategories

      public Collection<ChildAssociationRef> getCategories(StoreRef storeRef, QName aspectQName, CategoryService.Depth depth)
      Description copied from interface: CategoryService
      Get a list of all the categories appropriate for a given property. The full list of categories that may be assigned for this aspect.
      Specified by:
      getCategories in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectQName - QName
      depth - - the enumeration depth for what level to recover
      Returns:
      a collection of all the nodes found identified by their ChildAssocRef's
    • getClassificationNodes

      protected Set<NodeRef> getClassificationNodes(StoreRef storeRef, QName aspectQName)
    • getClassifications

      public Collection<ChildAssociationRef> getClassifications(StoreRef storeRef)
      Description copied from interface: CategoryService
      Get all the classification entries
      Specified by:
      getClassifications in interface CategoryService
    • getClassificationAspects

      public Collection<QName> getClassificationAspects()
      Description copied from interface: CategoryService
      Get all the types that represent categories
      Specified by:
      getClassificationAspects in interface CategoryService
    • createClassification

      public NodeRef createClassification(StoreRef storeRef, QName typeName, String attributeName)
      Description copied from interface: CategoryService
      Create a new category. This will extend the category types in the data dictionary All it needs is the type name and the attribute in which to store noderefs to categories.
      Specified by:
      createClassification in interface CategoryService
      Parameters:
      storeRef - StoreRef
      typeName - QName
      attributeName - String
    • getRootCategories

      public org.alfresco.query.PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, org.alfresco.query.PagingRequest pagingRequest, boolean sortByName)
      Description copied from interface: CategoryService
      Get a paged list of the root categories for an aspect/classification
      Specified by:
      getRootCategories in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectName - QName
      pagingRequest - PagingRequest
      sortByName - boolean
    • getRootCategories

      public org.alfresco.query.PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, org.alfresco.query.PagingRequest pagingRequest, boolean sortByName, String filter)
      Description copied from interface: CategoryService
      Get a paged list of the root categories for an aspect/classification
      Specified by:
      getRootCategories in interface CategoryService
      Returns:
    • getRootCategories

      public org.alfresco.query.PagingResults<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, org.alfresco.query.PagingRequest pagingRequest, boolean sortByName, Collection<String> exactNamesFilter, Collection<String> alikeNamesFilter)
      Description copied from interface: CategoryService
      Get a paged list of the root categories for an aspect/classification supporting multiple name filters.
      Specified by:
      getRootCategories in interface CategoryService
      Returns:
    • getRootCategories

      public Collection<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, Collection<String> exactNamesFilter, Collection<String> alikeNamesFilter)
      Description copied from interface: CategoryService
      Get a collection of the root categories for an aspect/classification supporting multiple name filters.
      Specified by:
      getRootCategories in interface CategoryService
    • getRootCategories

      public Collection<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName)
      Description copied from interface: CategoryService
      Get the root categories for an aspect/classification
      Specified by:
      getRootCategories in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectName - QName
    • getRootCategories

      public Collection<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, String filter)
      Description copied from interface: CategoryService
      Get the root categories for an aspect/classification with names that start with filter
      Specified by:
      getRootCategories in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectName - QName
      filter - String
    • getCategory

      public ChildAssociationRef getCategory(NodeRef parent, QName aspectName, String name)
      Description copied from interface: CategoryService
      Looks up a category by name under its immediate parent. Index-independent so can be used for cluster-safe existence checks.
      Specified by:
      getCategory in interface CategoryService
      Parameters:
      parent - the parent
      aspectName - the aspect name
      name - the category name
      Returns:
      the category child association reference
    • getRootCategories

      public Collection<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName, String name, boolean create)
      Description copied from interface: CategoryService
      Gets root categories by name, optionally creating one if one does not exist. Index-independent so can be used for cluster-safe existence checks.
      Specified by:
      getRootCategories in interface CategoryService
      Parameters:
      storeRef - the store ref
      aspectName - the aspect name
      name - the aspect name
      create - should a category node be created if one does not exist?
      Returns:
      the root categories
    • createCategory

      public NodeRef createCategory(NodeRef parent, String name)
      Description copied from interface: CategoryService
      Create a new category.
      Specified by:
      createCategory in interface CategoryService
      Parameters:
      parent - NodeRef
      name - String
      Returns:
      NodeRef
    • createRootCategory

      public NodeRef createRootCategory(StoreRef storeRef, QName aspectName, String name)
      Description copied from interface: CategoryService
      Create a new root category in the given classification
      Specified by:
      createRootCategory in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectName - QName
      name - String
      Returns:
      NodeRef
    • deleteCategory

      public void deleteCategory(NodeRef nodeRef)
      Description copied from interface: CategoryService
      Delete a category
      Specified by:
      deleteCategory in interface CategoryService
      Parameters:
      nodeRef - NodeRef
    • deleteClassification

      public void deleteClassification(StoreRef storeRef, QName aspectName)
      Description copied from interface: CategoryService
      Delete a classification
      Specified by:
      deleteClassification in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectName - QName
    • getTopCategories

      public abstract List<Pair<NodeRef,Integer>> getTopCategories(StoreRef storeRef, QName aspectName, int count)
      Description copied from interface: CategoryService
      Get the most polular categories
      Specified by:
      getTopCategories in interface CategoryService
      Parameters:
      storeRef - StoreRef
      aspectName - QName
      count - int
      Returns:
      List
    • createSearchTopCategoriesParameters

      protected SearchParameters createSearchTopCategoriesParameters(StoreRef storeRef, QName aspectName, int count)
      Creates search query parameters used to get top categories. Can be used as a base both wih SOLR and ES.
      Parameters:
      storeRef - Node store reference
      aspectName - Aspect name. "cm:generalclassifiable" aspect should be used for usual cases. It is possible to use a custom aspect but it must have valid category property
      count - Will be used as faceted results limit, when system has very many categories this must be reflecting that number
      Returns:
      SearchParameters to perform search for top categories.
    • getRootCategoryNodeRef

      public Optional<NodeRef> getRootCategoryNodeRef(StoreRef storeRef)
      Description copied from interface: CategoryService
      Get a root category NodeRef
      Specified by:
      getRootCategoryNodeRef in interface CategoryService
      Returns:
      NodeRef for category root node