@Override @HasPermission(action = UGC_READ, type = SocialPermission.class) public Iterable<T> readByTargetId(final String targetId, final String contextId) throws UGCException { log.debug("logging.ugc.findingByTarget", targetId, contextId); try { return buildUgcTreeList( IterableUtils.toList(ugcRepository.findByTargetId(targetId, contextId)), Integer.MAX_VALUE); } catch (MongoDataException ex) { log.error("logging.ugc.unableRead", ex); throw new UGCException("Unable to ", ex); } }
@Override @HasPermission(action = UGC_READ, type = SocialPermission.class) public List<T> read( final String targetId, final String contextId, final int start, final int limit, final List sortOrder, final int upToLevel, final int childrenPerLevel) throws UGCException { try { List<T> list = IterableUtils.toList( ugcRepository.findByTargetId( targetId, contextId, start, limit, sortOrder, upToLevel)); list = sortByArrays(list, sortOrder); return buildUgcTreeList(list, childrenPerLevel); } catch (MongoDataException e) { log.error("logging.ugc.unableToRead"); throw new UGCException("Unable to find ugc by target"); } }