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.NotificationMessageDelivery; |
23 | |
import org.kuali.rice.ken.dao.NotificationMessegeDeliveryDao; |
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 | 0 | public class NotificationMessegeDeliveryDaoOjb extends PersistenceBrokerDaoSupport implements |
37 | |
NotificationMessegeDeliveryDao { |
38 | |
|
39 | 0 | private static final Logger LOG = Logger.getLogger(NotificationDaoOjb.class); |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
@Override |
47 | |
public Collection getUndeliveredMessageDelivers(GenericDao businessObjectDao) { |
48 | |
|
49 | |
|
50 | |
|
51 | 0 | Criteria criteria = new Criteria(); |
52 | 0 | criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.MESSAGE_DELIVERY_STATUS, NotificationConstants.MESSAGE_DELIVERY_STATUS.UNDELIVERED); |
53 | 0 | criteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE); |
54 | 0 | Collection<NotificationMessageDelivery> messageDeliveries = businessObjectDao.findMatching(NotificationMessageDelivery.class, criteria, true, RiceConstants.NO_WAIT); |
55 | |
|
56 | 0 | return messageDeliveries; |
57 | |
} |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
@Override |
65 | |
public Collection<NotificationMessageDelivery> getMessageDeliveriesForAutoRemoval(Timestamp tm, GenericDao businessObjectDao) { |
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | 0 | Criteria criteria_STATUS = new Criteria(); |
71 | 0 | criteria_STATUS.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.MESSAGE_DELIVERY_STATUS, NotificationConstants.MESSAGE_DELIVERY_STATUS.DELIVERED); |
72 | |
|
73 | 0 | Criteria criteria_UNDELIVERED = new Criteria(); |
74 | 0 | criteria_UNDELIVERED.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.MESSAGE_DELIVERY_STATUS, NotificationConstants.MESSAGE_DELIVERY_STATUS.UNDELIVERED); |
75 | |
|
76 | |
|
77 | 0 | criteria_STATUS.addOrCriteria(criteria_UNDELIVERED); |
78 | |
|
79 | 0 | Criteria fullQueryCriteria = new Criteria(); |
80 | 0 | fullQueryCriteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE); |
81 | 0 | fullQueryCriteria.addLessOrEqualThan(NotificationConstants.BO_PROPERTY_NAMES.NOTIFICATION_AUTO_REMOVE_DATE_TIME, tm); |
82 | 0 | fullQueryCriteria.addAndCriteria(criteria_STATUS); |
83 | |
|
84 | 0 | Collection<NotificationMessageDelivery> messageDeliveries = businessObjectDao.findMatching(NotificationMessageDelivery.class, fullQueryCriteria, true, RiceConstants.NO_WAIT); |
85 | |
|
86 | 0 | return messageDeliveries; |
87 | |
} |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
|
94 | |
@Override |
95 | |
public Collection<NotificationMessageDelivery> getLockedDeliveries( |
96 | |
Class clazz, GenericDao dao) { |
97 | 0 | Criteria criteria = new Criteria(); |
98 | 0 | criteria.addNotNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE); |
99 | 0 | Collection<NotificationMessageDelivery> lockedDeliveries = dao.findMatching(clazz, criteria); |
100 | |
|
101 | 0 | return lockedDeliveries; |
102 | |
} |
103 | |
|
104 | |
} |