2013-04-18 12:50:44 +02:00
|
|
|
package com.commafeed.backend.services;
|
|
|
|
|
|
|
|
|
|
import javax.ejb.Stateless;
|
|
|
|
|
import javax.inject.Inject;
|
|
|
|
|
|
|
|
|
|
import com.commafeed.backend.dao.FeedEntryStatusDAO;
|
|
|
|
|
import com.commafeed.backend.model.FeedEntryStatus;
|
|
|
|
|
import com.commafeed.backend.model.User;
|
|
|
|
|
|
|
|
|
|
@Stateless
|
|
|
|
|
public class FeedEntryService {
|
|
|
|
|
|
|
|
|
|
@Inject
|
|
|
|
|
FeedEntryStatusDAO feedEntryStatusDAO;
|
|
|
|
|
|
|
|
|
|
public void markEntry(User user, Long entryId, boolean read) {
|
|
|
|
|
FeedEntryStatus status = feedEntryStatusDAO.findById(user, entryId);
|
2013-05-23 11:30:57 +02:00
|
|
|
if (status != null) {
|
|
|
|
|
status.setRead(read);
|
|
|
|
|
feedEntryStatusDAO.update(status);
|
|
|
|
|
}
|
2013-04-18 12:50:44 +02:00
|
|
|
}
|
2013-04-29 22:37:26 +02:00
|
|
|
|
|
|
|
|
public void starEntry(User user, Long entryId, boolean starred) {
|
|
|
|
|
FeedEntryStatus status = feedEntryStatusDAO.findById(user, entryId);
|
2013-05-23 11:30:57 +02:00
|
|
|
if (status != null) {
|
|
|
|
|
status.setStarred(starred);
|
|
|
|
|
feedEntryStatusDAO.update(status);
|
|
|
|
|
}
|
2013-04-29 22:37:26 +02:00
|
|
|
}
|
2013-04-18 12:50:44 +02:00
|
|
|
}
|