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.apache.ojb.broker.query.Criteria;
20 import org.kuali.rice.core.api.util.RiceConstants;
21 import org.kuali.rice.core.framework.persistence.dao.GenericDao;
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 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
26
27 import java.sql.Timestamp;
28 import java.util.Collection;
29
30
31
32
33
34
35
36 public class NotificationDaoOjb extends PersistenceBrokerDaoSupport implements NotificationDao {
37
38 private static final Logger LOG = Logger.getLogger(NotificationDaoOjb.class);
39
40
41
42
43
44 @Override
45 public Collection findMatchedNotificationsForResolution(Timestamp tm, GenericDao dao) {
46
47
48
49 Criteria criteria = new Criteria();
50 criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.PROCESSING_FLAG, NotificationConstants.PROCESSING_FLAGS.UNRESOLVED);
51 criteria.addLessOrEqualThan(NotificationConstants.BO_PROPERTY_NAMES.SEND_DATE_TIME, tm);
52 criteria.addIsNull(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();
70 criteria.addEqualTo(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 }