Interface UGCRepository<T extends UGC>

All Superinterfaces:
org.craftercms.commons.mongo.CrudRepository<T>
All Known Implementing Classes:
UGCRepositoryImpl

public interface UGCRepository<T extends UGC> extends org.craftercms.commons.mongo.CrudRepository<T>
UGC Repository Definitions.
  • Method Details

    • findChildrenOf

      List<T> findChildrenOf(String ugcId, int childrenCount, String contextId) throws org.craftercms.commons.mongo.MongoDataException
      Finds all the ugc and all its children.
      Parameters:
      ugcId - Id of the ugc to find and its children.
      childrenCount - How many Children Levels.
      contextId - Context ID of the UGCs.
      Returns:
      List of the ugc and all its tree. (first element is the "ROOT" UGC) this is ordered by ancestors size and created date (descending).
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • findByTargetId

      Iterable<T> findByTargetId(String targetId, String contextId) throws org.craftercms.commons.mongo.MongoDataException
      Finds all UGC's of a contextId that belongs to the given target-id.
      Parameters:
      targetId - Target Id which the ugs belongs to.
      contextId - Context ID of the UGCs.
      Returns:
      A Iterable of UGC that belong to the contextId and are associated to the target.
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • deleteAttribute

      void deleteAttribute(String ugcId, String contextId, String[] attributeName) throws org.craftercms.commons.mongo.MongoDataException
      Deletes an attribute Has to be full "dot notation" mode
      Parameters:
      ugcId - Id of the ugc to remove the attribute.
      contextId - Context ID of the UGCs.
      attributeName - Attributes name(Full dot notation) to unset/delete
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • findUGC

      T findUGC(String contextId, String ugcId) throws org.craftercms.commons.mongo.MongoDataException
      Finds a ugc with the given id and contextId.
      Parameters:
      contextId - Context ID of the UGCs.
      ugcId - Id of the ugc
      Returns:
      The Found UGC.
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • setAttributes

      void setAttributes(String ugcId, String contextId, Map<String,Object> attributes) throws org.craftercms.commons.mongo.MongoDataException
      Adds the given attributes to the ugc.
      Parameters:
      ugcId - Id of the ugc to add the attributes.
      contextId - Context ID of the UGCs.
      attributes - Attributes to add/removeWatcher to the UGC.
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • deleteUgc

      void deleteUgc(String ugcId, String contextId) throws org.craftercms.commons.mongo.MongoDataException
      Deletes the given UGC and All its children.
      Parameters:
      ugcId - Id of the ugc
      contextId - Context ID of the UGCs.
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • findByUserQuery

      Iterable<T> findByUserQuery(String contextId, String query, String sort, int start, int limit) throws org.craftercms.commons.mongo.MongoDataException
      Finds Ugcs by the given user query. It assumes that the query has been sanitized for any security concerns
      Parameters:
      contextId - Context ID of the UGCs.
      query - Query to execute.
      sort - Sort query If null or empty it will be ignored
      start - Where to start
      limit - How many results
      Returns:
      A list of the Ugc that match the given query in the given order, empty if nothing is found.
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • findChildren

      Iterable<T> findChildren(String ugcId, String targetId, String contextId, int start, int limit, List sortOrder, int upToLevel) throws org.craftercms.commons.mongo.MongoDataException, UGCNotFound
      Finds all the children of a given ugc.
      Parameters:
      ugcId - Id of the ugc to find and its children.
      targetId - Target Id which the ugs belongs to.
      contextId - Context ID of the UGCs.
      start - where to start.
      limit - How many results
      upToLevel - how many sub-children levels to lookup.
      Returns:
      An iterable with the results.empty if nothing is found.
      Throws:
      org.craftercms.commons.mongo.MongoDataException
      UGCNotFound
    • findByTargetId

      Iterable<T> findByTargetId(String targetId, String contextId, int start, int limit, List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,Boolean>> sortOrder, int upToLevel) throws org.craftercms.commons.mongo.MongoDataException
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • countByTargetId

      long countByTargetId(String contextId, String threadId, int levels) throws org.craftercms.commons.mongo.MongoDataException
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • countChildrenOf

      long countChildrenOf(String contextId, String ugcId) throws org.craftercms.commons.mongo.MongoDataException
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • findByModerationStatus

      Iterable<T> findByModerationStatus(ModerationStatus status, String targetId, String contextId, int start, int limit, List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,Boolean>> sortOrder) throws org.craftercms.commons.mongo.MongoDataException
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • countFindByModerationStatus

      long countFindByModerationStatus(ModerationStatus status, String targetId, String contextId) throws org.craftercms.commons.mongo.MongoDataException
      Throws:
      org.craftercms.commons.mongo.MongoDataException
    • findAllFlagged

      Iterable<T> findAllFlagged(String context, int start, int pageSize, List sortOrder)
    • countAllFlagged

      long countAllFlagged(String context, int start, int pageSize, List sortOrder)