mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
wip: allow parallel update of feeds
This commit is contained in:
@@ -14,30 +14,20 @@ import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.FeedEntry;
|
||||
import com.commafeed.backend.model.FeedEntry_;
|
||||
import com.commafeed.backend.model.Feed_;
|
||||
import com.google.api.client.util.Lists;
|
||||
import com.uaihebert.model.EasyCriteria;
|
||||
|
||||
@Stateless
|
||||
public class FeedEntryDAO extends GenericDAO<FeedEntry> {
|
||||
|
||||
public List<FeedEntry> findByGuids(List<String> guids) {
|
||||
List<String> hashes = Lists.newArrayList();
|
||||
for (String guid : guids) {
|
||||
hashes.add(DigestUtils.sha1Hex(guid));
|
||||
}
|
||||
public List<FeedEntry> findByGuid(String guid) {
|
||||
String hash = DigestUtils.sha1Hex(guid);
|
||||
|
||||
EasyCriteria<FeedEntry> criteria = createCriteria();
|
||||
criteria.setDistinctTrue();
|
||||
criteria.andStringIn(FeedEntry_.guidHash.getName(), hashes);
|
||||
criteria.andEquals(FeedEntry_.guidHash.getName(), hash);
|
||||
criteria.leftJoinFetch(FeedEntry_.feeds.getName());
|
||||
|
||||
List<FeedEntry> list = Lists.newArrayList();
|
||||
for (FeedEntry entry : criteria.getResultList()) {
|
||||
if (guids.contains(entry.getGuid())) {
|
||||
list.add(entry);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
return criteria.getResultList();
|
||||
}
|
||||
|
||||
public List<FeedEntry> findByFeed(Feed feed, int offset, int limit) {
|
||||
|
||||
Reference in New Issue
Block a user