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