Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
NotificationDaoOjb |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2006-2011 The Kuali Foundation | |
3 | * | |
4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.opensource.org/licenses/ecl2.php | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
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.framework.persistence.dao.GenericDao; | |
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 | import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport; | |
27 | ||
28 | import java.sql.Timestamp; | |
29 | import java.util.Collection; | |
30 | ||
31 | /** | |
32 | * This is a description of what this class does - g1zhang don't forget to fill this in. | |
33 | * | |
34 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
35 | * | |
36 | */ | |
37 | 0 | public class NotificationDaoOjb extends PersistenceBrokerDaoSupport implements NotificationDao { |
38 | ||
39 | 0 | private static final Logger LOG = Logger.getLogger(NotificationDaoOjb.class); |
40 | /** | |
41 | * This overridden method ... | |
42 | * | |
43 | * @see org.kuali.rice.ken.dao.NotificationDao#findMatchedNotifications(java.sql.Timestamp, org.kuali.rice.core.framework.persistence.dao.GenericDao) | |
44 | */ | |
45 | @Override | |
46 | public Collection findMatchedNotificationsForResolution(Timestamp tm, GenericDao dao) { | |
47 | ||
48 | //LOG.info("************************calling OJBNotificationDao.findMatchedNotificationsForResolution(************************ "); | |
49 | ||
50 | 0 | Criteria criteria = new Criteria(); |
51 | 0 | criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.PROCESSING_FLAG, NotificationConstants.PROCESSING_FLAGS.UNRESOLVED); |
52 | 0 | criteria.addLessOrEqualThan(NotificationConstants.BO_PROPERTY_NAMES.SEND_DATE_TIME, tm); |
53 | 0 | criteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE); |
54 | ||
55 | 0 | Collection<Notification> available_notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT); |
56 | ||
57 | 0 | return available_notifications; |
58 | } | |
59 | ||
60 | /** | |
61 | * This overridden method ... | |
62 | * | |
63 | * @see org.kuali.rice.ken.dao.NotificationDao#findMatchedNotificationsForUnlock(java.sql.Timestamp, org.kuali.rice.core.framework.persistence.dao.GenericDao) | |
64 | */ | |
65 | @Override | |
66 | public Collection findMatchedNotificationsForUnlock(Notification not, GenericDao dao) { | |
67 | ||
68 | //LOG.info("************************calling OJBNotificationDao.findMatchedNotificationsForForUnlock************************ "); | |
69 | ||
70 | 0 | Criteria criteria = new Criteria(); |
71 | 0 | criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.ID, not.getId()); |
72 | ||
73 | 0 | Collection<Notification> notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT); |
74 | ||
75 | 0 | return notifications; |
76 | } | |
77 | ||
78 | } |