mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.commafeed.backend.dao;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.commafeed.model.Feed;
|
||||
import com.commafeed.model.FeedEntry;
|
||||
|
||||
@Stateless
|
||||
public class FeedEntryService extends GenericDAO<FeedEntry, String> {
|
||||
|
||||
@Inject
|
||||
FeedService feedService;
|
||||
|
||||
public void updateEntries(String url, Collection<FeedEntry> entries) {
|
||||
Feed feed = feedService.findById(url);
|
||||
for (FeedEntry entry : entries) {
|
||||
FeedEntry existing = findById(entry.getGuid());
|
||||
if (existing == null) {
|
||||
entry.setFeed(feed);
|
||||
save(entry);
|
||||
}
|
||||
}
|
||||
feed.setLastUpdated(Calendar.getInstance().getTime());
|
||||
em.merge(feed);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user