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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
countAllFlagged(String context, int start, int pageSize, List sortOrder)
long
countByTargetId(String contextId, String threadId, int levels)
long
countChildrenOf(String contextId, String ugcId)
long
countFindByModerationStatus(ModerationStatus status, String targetId, String contextId)
void
deleteAttribute(String ugcId, String contextId, String[] attributeName)
Deletes an attribute Has to be full "dot notation" modevoid
deleteUgc(String ugcId, String contextId)
Deletes the given UGC and All its children.Iterable<T>
findAllFlagged(String context, int start, int pageSize, List sortOrder)
Iterable<T>
findByModerationStatus(ModerationStatus status, String targetId, String contextId, int start, int limit, List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,Boolean>> sortOrder)
Iterable<T>
findByTargetId(String targetId, String contextId)
Finds all UGC's of a contextId that belongs to the given target-id.Iterable<T>
findByTargetId(String targetId, String contextId, int start, int limit, List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,Boolean>> sortOrder, int upToLevel)
Iterable<T>
findByUserQuery(String contextId, String query, String sort, int start, int limit)
Finds Ugcs by the given user query.Iterable<T>
findChildren(String ugcId, String targetId, String contextId, int start, int limit, List sortOrder, int upToLevel)
Finds all the children of a given ugc.List<T>
findChildrenOf(String ugcId, int childrenCount, String contextId)
Finds all the ugc and all its children.T
findUGC(String contextId, String ugcId)
Finds a ugc with the given id and contextId.void
setAttributes(String ugcId, String contextId, Map<String,Object> attributes)
Adds the given attributes to the ugc.-
Methods inherited from interface org.craftercms.commons.mongo.CrudRepository
count, count, count, deleteFile, deleteFile, find, find, findAll, findById, findByStringId, findOne, findOne, getFileInfo, getFileInfo, insert, insert, listFilesByName, readFile, readFile, remove, remove, removeById, removeByStringId, save, save, saveFile, saveFile, update, update, update, update, updateFile, updateFile, updateFile
-
-
-
-
Method Detail
-
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 ugccontextId
- 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 ignoredstart
- Where to startlimit
- 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.contextId
- Context ID of the UGCs.limit
- How many resultsstart
- where to start.upToLevel
- how many sub-children levels to lookup.targetId
- Target Id which the ugs belongs to.- 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
-
-