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.apache.ojb.broker.query.Criteria;
21 import org.kuali.rice.core.api.util.RiceConstants;
22 import org.kuali.rice.core.framework.persistence.dao.GenericDao;
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 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
27
28 import java.sql.Timestamp;
29 import java.util.Collection;
30
31
32
33
34
35
36
37 public class NotificationDaoOjb extends PersistenceBrokerDaoSupport implements NotificationDao {
38
39 private static final Logger LOG = Logger.getLogger(NotificationDaoOjb.class);
40
41
42
43
44
45 @Override
46 public Collection findMatchedNotificationsForResolution(Timestamp tm, GenericDao dao) {
47
48
49
50 Criteria criteria = new Criteria();
51 criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.PROCESSING_FLAG, NotificationConstants.PROCESSING_FLAGS.UNRESOLVED);
52 criteria.addLessOrEqualThan(NotificationConstants.BO_PROPERTY_NAMES.SEND_DATE_TIME, tm);
53 criteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE);
54
55 Collection<Notification> available_notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT);
56
57 return available_notifications;
58 }
59
60
61
62
63
64
65 @Override
66 public Collection findMatchedNotificationsForUnlock(Notification not, GenericDao dao) {
67
68
69
70 Criteria criteria = new Criteria();
71 criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.ID, not.getId());
72
73 Collection<Notification> notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT);
74
75 return notifications;
76 }
77
78 }