Coverage Report - org.kuali.rice.ken.dao.impl.NotificationMessegeDeliveryDaoOjb
 
Classes in this File Line Coverage Branch Coverage Complexity
NotificationMessegeDeliveryDaoOjb
0%
0/22
N/A
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.NotificationMessageDelivery;
 24  
 import org.kuali.rice.ken.dao.NotificationMessegeDeliveryDao;
 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 NotificationMessegeDeliveryDaoOjb extends PersistenceBrokerDaoSupport implements
 38  
                 NotificationMessegeDeliveryDao {
 39  
 
 40  0
         private static final Logger LOG = Logger.getLogger(NotificationDaoOjb.class);
 41  
         
 42  
         /**
 43  
          * This overridden method ...
 44  
          * 
 45  
          * @see org.kuali.rice.ken.dao.NotificationMessegeDeliveryDao#getUndeliveredMessageDelivers()
 46  
          */
 47  
         @Override
 48  
         public Collection getUndeliveredMessageDelivers(GenericDao businessObjectDao) {
 49  
                 
 50  
                 //LOG.info("************************calling OJBNotificationMessegeDeliveryDao.getUndeliveredMessageDelivers************************ ");
 51  
                 
 52  0
         Criteria criteria = new Criteria();
 53  0
         criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.MESSAGE_DELIVERY_STATUS, NotificationConstants.MESSAGE_DELIVERY_STATUS.UNDELIVERED);
 54  0
         criteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE);
 55  0
         Collection<NotificationMessageDelivery> messageDeliveries = businessObjectDao.findMatching(NotificationMessageDelivery.class, criteria, true, RiceConstants.NO_WAIT);
 56  
 
 57  0
         return messageDeliveries;
 58  
         }
 59  
 
 60  
         /**
 61  
          * This overridden method ...
 62  
          * 
 63  
          * @see org.kuali.rice.ken.dao.NotificationMessegeDeliveryDao#getMessageDeliveriesForAutoRemoval(org.kuali.rice.core.framework.persistence.dao.GenericDao)
 64  
          */
 65  
         @Override
 66  
         public Collection<NotificationMessageDelivery> getMessageDeliveriesForAutoRemoval(Timestamp tm, GenericDao businessObjectDao) {
 67  
                 
 68  
                 //LOG.info("************************calling OJBNotificationMessegeDeliveryDao.getMessageDeliveriesForAutoRemoval************************ ");
 69  
                 
 70  
         // get all UNDELIVERED/DELIVERED notification notification message delivery records with associated notifications that have and autoRemovalDateTime <= current
 71  0
         Criteria criteria_STATUS = new Criteria();
 72  0
         criteria_STATUS.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.MESSAGE_DELIVERY_STATUS, NotificationConstants.MESSAGE_DELIVERY_STATUS.DELIVERED);
 73  
 
 74  0
         Criteria criteria_UNDELIVERED = new Criteria();
 75  0
         criteria_UNDELIVERED.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.MESSAGE_DELIVERY_STATUS, NotificationConstants.MESSAGE_DELIVERY_STATUS.UNDELIVERED);
 76  
 
 77  
         // now OR the above two together
 78  0
         criteria_STATUS.addOrCriteria(criteria_UNDELIVERED);
 79  
 
 80  0
         Criteria fullQueryCriteria = new Criteria();
 81  0
         fullQueryCriteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE);
 82  0
         fullQueryCriteria.addLessOrEqualThan(NotificationConstants.BO_PROPERTY_NAMES.NOTIFICATION_AUTO_REMOVE_DATE_TIME, tm);
 83  0
         fullQueryCriteria.addAndCriteria(criteria_STATUS);
 84  
 
 85  0
         Collection<NotificationMessageDelivery> messageDeliveries = businessObjectDao.findMatching(NotificationMessageDelivery.class, fullQueryCriteria, true, RiceConstants.NO_WAIT);
 86  
      
 87  0
         return messageDeliveries;
 88  
         }
 89  
 
 90  
         /**
 91  
          * This overridden method ...
 92  
          * 
 93  
          * @see org.kuali.rice.ken.dao.NotificationMessegeDeliveryDao#getLockedDeliveries(java.lang.Class, org.kuali.rice.core.framework.persistence.dao.GenericDao)
 94  
          */
 95  
         @Override
 96  
         public Collection<NotificationMessageDelivery> getLockedDeliveries(
 97  
                         Class clazz, GenericDao dao) {
 98  0
         Criteria criteria = new Criteria();
 99  0
         criteria.addNotNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE);
 100  0
         Collection<NotificationMessageDelivery> lockedDeliveries = dao.findMatching(clazz, criteria);
 101  
         
 102  0
         return lockedDeliveries;
 103  
         }
 104  
 
 105  
 }