mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
handle 'mark as read'
This commit is contained in:
@@ -1,10 +1,30 @@
|
||||
package com.commafeed.backend.dao;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.persistence.NoResultException;
|
||||
|
||||
import com.commafeed.backend.model.FeedEntry;
|
||||
import com.commafeed.backend.model.FeedEntryStatus;
|
||||
import com.commafeed.backend.model.User;
|
||||
import com.commafeed.frontend.utils.ModelFactory.MF;
|
||||
import com.uaihebert.factory.EasyCriteriaFactory;
|
||||
import com.uaihebert.model.EasyCriteria;
|
||||
|
||||
@Stateless
|
||||
public class FeedEntryStatusService extends GenericDAO<FeedEntryStatus, Long> {
|
||||
|
||||
public FeedEntryStatus getStatus(User user, FeedEntry entry) {
|
||||
EasyCriteria<FeedEntryStatus> criteria = EasyCriteriaFactory
|
||||
.createQueryCriteria(em, getType());
|
||||
criteria.andEquals(MF.i(proxy().getUser()), user);
|
||||
criteria.andEquals(MF.i(proxy().getEntry()), entry);
|
||||
|
||||
FeedEntryStatus status = null;
|
||||
try {
|
||||
criteria.getSingleResult();
|
||||
} catch (NoResultException e) {
|
||||
status = null;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user