Class CategoryStorage

java.lang.Object
io.meeds.social.category.storage.CategoryStorage

@Service public class CategoryStorage extends Object
TODO change to component when CategoryIndexingConnector moved to be managed by Spring
  • Constructor Details

    • CategoryStorage

      public CategoryStorage()
  • Method Details

    • createCategory

      public io.meeds.social.category.model.Category createCategory(io.meeds.social.category.model.Category category)
    • updateCategory

      @CacheEvict(cacheNames="social.category", key="#root.args[0].getId()") public io.meeds.social.category.model.Category updateCategory(io.meeds.social.category.model.Category category)
    • deleteCategory

      @CacheEvict(cacheNames="social.category") public io.meeds.social.category.model.Category deleteCategory(long id)
    • getCategory

      @Cacheable(cacheNames="social.category") public io.meeds.social.category.model.Category getCategory(long categoryId)
    • getRootCategoryId

      @Cacheable(cacheNames="social.categoryRootId") public long getRootCategoryId(long ownerId)
    • getRootCategory

      public io.meeds.social.category.model.Category getRootCategory(long ownerId)
    • getSubcategoryIds

      public List<Long> getSubcategoryIds(long categoryId, long offset, long limit)
    • countSubcategories

      public long countSubcategories(long categoryId)
    • findCategories

      public List<io.meeds.social.category.model.Category> findCategories(io.meeds.social.category.model.CategorySearchFilter filter, List<Long> identityIds, Locale locale)
    • findCategories

      public List<io.meeds.social.category.model.Category> findCategories(io.meeds.social.category.model.CategorySearchFilter filter, List<Long> identityIds, List<Long> categoryIds, Locale locale)
      Parameters:
      filter - search filter
      identityIds - identities of the user, used for link permissions
      categoryIds - when not null, only these categories may match
      locale - locale of the searched and sorted name
      Returns:
      the matching categories
    • findCategoryIds

      public List<Long> findCategoryIds(io.meeds.social.category.model.CategorySearchFilter filter, List<Long> identityIds, Locale locale)
    • countSubcategories

      public int countSubcategories(io.meeds.social.category.model.CategorySearchFilter filter, List<Long> identityIds, Locale locale)
    • getLinkedIds

      public List<Long> getLinkedIds(io.meeds.social.category.model.CategoryObject object)
    • getLinkedIds

      public Map<String,List<Long>> getLinkedIds(String objectType, List<String> objectIds)
      The categories each of several objects is filed under, in one query.

      The single-object getLinkedIds(CategoryObject) is the right call for a reader looking at one thing, and the wrong one for a list: a page of rows showing what each is filed under would ask it once per row, which is a query per message on a mail folder and per document on a drive. This answers the page, so the caller decorates its rows by lookup.

      It is not a drop-in replacement in one respect: the ids are used as given, where the single-object call puts its object through the category plugin first. See the caveat on CategoryLinkService.getLinkedIds(String, java.util.List).

      Parameters:
      objectType - the objects' type, as registered by a category plugin
      objectIds - the objects' identifiers
      Returns:
      the category identifiers of each object, keyed by object id; an object with no category is absent from the map rather than present with an empty list
    • getLinkedIds

      public List<Long> getLinkedIds(String objectType)
    • getLinkedItems

      public List<io.meeds.social.category.model.CategoryObject> getLinkedItems(long categoryId, List<String> objectTypes, int offset, int limit)
    • isLinked

      public boolean isLinked(long categoryId, io.meeds.social.category.model.CategoryObject object)
    • link

      public void link(long categoryId, io.meeds.social.category.model.CategoryObject object, long userIdentityId)
    • unlink

      public void unlink(long categoryId, io.meeds.social.category.model.CategoryObject object)
    • getMetadataItem

      public org.exoplatform.social.metadata.model.MetadataItem getMetadataItem(long categoryId, io.meeds.social.category.model.CategoryObject object)
    • getAllCategoryIds

      public List<Long> getAllCategoryIds(int offset, int limit)