public void deleteByBlogEntryIds(Iterable<Identifier> blogEntryIds) { if (blogEntryIds.iterator().hasNext()) { Query<Comment> comments = getDataStore().createQuery(Comment.class).field("blogEntryId").in(blogEntryIds); getDataStore().delete(comments); } } }
/** * Finds {@link WatchRecord}s for the specified entities. * @param entities The entities * @return The {@link WatchRecord}s for the specified entities. Any WatchRecord for that watches * one of the specified entities will be returned */ @Override public List<WatchRecord> findWatchRecords(@Nonnull ProjectId projectId, @Nonnull Collection<? extends OWLEntity> entities) { Query<WatchRecord> query = datastore.createQuery(WatchRecord.class); return query .field(PROJECT_ID).equal(projectId) .field(ENTITY).in(entities) .asList(); }
/** * Finds {@link WatchRecord}s for the specified user and entities. * @param userId The {@link UserId}. * @param entities The {@link OWLEntity}. * @return The {@link WatchRecord}s for the specified user and entities. Each watch record will specify * a watch for the specified user and one of the specifed entities. */ @Override public List<WatchRecord> findWatchRecords(@Nonnull ProjectId projectId, @Nonnull UserId userId, @Nonnull Collection<? extends OWLEntity> entities) { Query<WatchRecord> query = datastore.createQuery(WatchRecord.class); return query .field(PROJECT_ID).equal(projectId) .field(USER_ID).equal(userId) .field(ENTITY).in(entities) .asList(); }