2013-03-20 20:33:42 +01:00
|
|
|
package com.commafeed.backend.dao;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.ejb.Stateless;
|
|
|
|
|
|
|
|
|
|
import com.commafeed.frontend.utils.ModelFactory.MF;
|
|
|
|
|
import com.commafeed.model.FeedCategory;
|
|
|
|
|
import com.commafeed.model.FeedSubscription;
|
|
|
|
|
import com.commafeed.model.User;
|
2013-03-22 11:42:25 +01:00
|
|
|
import com.uaihebert.factory.EasyCriteriaFactory;
|
|
|
|
|
import com.uaihebert.model.EasyCriteria;
|
2013-03-20 20:33:42 +01:00
|
|
|
|
|
|
|
|
@Stateless
|
|
|
|
|
public class FeedSubscriptionService extends GenericDAO<FeedSubscription, Long> {
|
|
|
|
|
|
|
|
|
|
public List<FeedSubscription> findAll(User user) {
|
|
|
|
|
return findByField(MF.i(MF.p(FeedCategory.class).getUser()), user);
|
|
|
|
|
}
|
2013-03-22 11:42:25 +01:00
|
|
|
|
|
|
|
|
public List<FeedSubscription> findWithoutCategories(User user) {
|
|
|
|
|
EasyCriteria<FeedSubscription> criteria = EasyCriteriaFactory.createQueryCriteria(em, getType());
|
|
|
|
|
criteria.andEquals("user", user);
|
|
|
|
|
criteria.andEquals("category", null);
|
|
|
|
|
return criteria.getResultList();
|
|
|
|
|
|
|
|
|
|
}
|
2013-03-20 20:33:42 +01:00
|
|
|
}
|