1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.ken.dao.impl;
18
19 import org.apache.log4j.Logger;
20 import org.kuali.rice.core.framework.persistence.dao.GenericDao;
21 import org.kuali.rice.core.framework.persistence.jpa.criteria.Criteria;
22 import org.kuali.rice.core.util.RiceConstants;
23 import org.kuali.rice.ken.bo.Notification;
24 import org.kuali.rice.ken.dao.NotificationDao;
25 import org.kuali.rice.ken.util.NotificationConstants;
26
27 import java.sql.Timestamp;
28 import java.util.Collection;
29
30
31
32
33
34
35
36 public class NotificationDaoJpa implements NotificationDao{
37
38 private static final Logger LOG = Logger.getLogger(NotificationDaoJpa.class);
39
40
41
42
43
44 @Override
45 public Collection findMatchedNotificationsForResolution(Timestamp tm, GenericDao dao) {
46
47
48
49 Criteria criteria = new Criteria(Notification.class.getName());
50 criteria.eq(NotificationConstants.BO_PROPERTY_NAMES.PROCESSING_FLAG, NotificationConstants.PROCESSING_FLAGS.UNRESOLVED);
51 criteria.lte(NotificationConstants.BO_PROPERTY_NAMES.SEND_DATE_TIME, new Timestamp(System.currentTimeMillis()));
52 criteria.isNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE);
53
54 Collection<Notification> available_notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT);
55
56 return available_notifications;
57 }
58
59
60
61
62
63
64 @Override
65 public Collection findMatchedNotificationsForUnlock(Notification not, GenericDao dao) {
66
67
68
69 Criteria criteria = new Criteria(Notification.class.getName());
70 criteria.eq(NotificationConstants.BO_PROPERTY_NAMES.ID, not.getId());
71
72 Collection<Notification> notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT);
73
74 return notifications;
75 }
76
77 }
78