| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| NotificationDaoJpa |
|
| 1.0;1 |
| 1 | /** | |
| 2 | * Copyright 2005-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 | 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 | * This is a description of what this class does - g1zhang don't forget to fill this in. | |
| 31 | * | |
| 32 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 33 | * | |
| 34 | */ | |
| 35 | 0 | public class NotificationDaoJpa implements NotificationDao{ |
| 36 | ||
| 37 | 0 | private static final Logger LOG = Logger.getLogger(NotificationDaoJpa.class); |
| 38 | /** | |
| 39 | * This overridden method ... | |
| 40 | * | |
| 41 | * @see org.kuali.rice.ken.dao.NotificationDao#findMatchedNotifications(java.sql.Timestamp, org.kuali.rice.core.framework.persistence.dao.GenericDao) | |
| 42 | */ | |
| 43 | @Override | |
| 44 | public Collection findMatchedNotificationsForResolution(Timestamp tm, GenericDao dao) { | |
| 45 | ||
| 46 | //LOG.info("************************calling OJBNotificationDao.findMatchedNotificationsForResolution(************************ "); | |
| 47 | ||
| 48 | 0 | Criteria criteria = new Criteria(Notification.class.getName()); |
| 49 | 0 | criteria.eq(NotificationConstants.BO_PROPERTY_NAMES.PROCESSING_FLAG, NotificationConstants.PROCESSING_FLAGS.UNRESOLVED); |
| 50 | 0 | criteria.lte(NotificationConstants.BO_PROPERTY_NAMES.SEND_DATE_TIME, new Timestamp(System.currentTimeMillis())); |
| 51 | 0 | criteria.isNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE); |
| 52 | ||
| 53 | 0 | Collection<Notification> available_notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT); |
| 54 | ||
| 55 | 0 | return available_notifications; |
| 56 | } | |
| 57 | ||
| 58 | /** | |
| 59 | * This overridden method ... | |
| 60 | * | |
| 61 | * @see org.kuali.rice.ken.dao.NotificationDao#findMatchedNotificationsForUnlock(java.sql.Timestamp, org.kuali.rice.core.framework.persistence.dao.GenericDao) | |
| 62 | */ | |
| 63 | @Override | |
| 64 | public Collection findMatchedNotificationsForUnlock(Notification not, GenericDao dao) { | |
| 65 | ||
| 66 | //LOG.info("************************calling OJBNotificationDao.findMatchedNotificationsForForUnlock************************ "); | |
| 67 | ||
| 68 | 0 | Criteria criteria = new Criteria(Notification.class.getName()); |
| 69 | 0 | criteria.eq(NotificationConstants.BO_PROPERTY_NAMES.ID, not.getId()); |
| 70 | ||
| 71 | 0 | Collection<Notification> notifications = dao.findMatching(Notification.class, criteria, true, RiceConstants.NO_WAIT); |
| 72 | ||
| 73 | 0 | return notifications; |
| 74 | } | |
| 75 | ||
| 76 | } | |
| 77 |