001 /**
002 * Copyright 2005-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.ken.dao.impl;
017
018 import org.apache.log4j.Logger;
019 import org.apache.ojb.broker.query.Criteria;
020 import org.kuali.rice.core.api.util.RiceConstants;
021 import org.kuali.rice.core.framework.persistence.dao.GenericDao;
022 import org.kuali.rice.ken.bo.NotificationBo;
023 import org.kuali.rice.ken.dao.NotificationDao;
024 import org.kuali.rice.ken.util.NotificationConstants;
025 import org.springmodules.orm.ojb.support.PersistenceBrokerDaoSupport;
026
027 import java.sql.Timestamp;
028 import java.util.Collection;
029
030 /**
031 * This is a description of what this class does - g1zhang don't forget to fill this in.
032 *
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 *
035 */
036 public class NotificationDaoOjb extends PersistenceBrokerDaoSupport implements NotificationDao {
037
038 private static final Logger LOG = Logger.getLogger(NotificationDaoOjb.class);
039 /**
040 * This overridden method ...
041 *
042 * @see org.kuali.rice.ken.dao.NotificationDao#findMatchedNotifications(java.sql.Timestamp, org.kuali.rice.core.framework.persistence.dao.GenericDao)
043 */
044 @Override
045 public Collection findMatchedNotificationsForResolution(Timestamp tm, GenericDao dao) {
046
047 //LOG.info("************************calling OJBNotificationDao.findMatchedNotificationsForResolution(************************ ");
048
049 Criteria criteria = new Criteria();
050 criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.PROCESSING_FLAG, NotificationConstants.PROCESSING_FLAGS.UNRESOLVED);
051 criteria.addLessOrEqualThan(NotificationConstants.BO_PROPERTY_NAMES.SEND_DATE_TIME, tm);
052 criteria.addIsNull(NotificationConstants.BO_PROPERTY_NAMES.LOCKED_DATE);
053
054 Collection<NotificationBo> available_notifications = dao.findMatching(NotificationBo.class, criteria, true, RiceConstants.NO_WAIT);
055
056 return available_notifications;
057 }
058
059 /**
060 * This overridden method ...
061 *
062 * @see org.kuali.rice.ken.dao.NotificationDao#findMatchedNotificationsForUnlock(java.sql.Timestamp, org.kuali.rice.core.framework.persistence.dao.GenericDao)
063 */
064 @Override
065 public Collection findMatchedNotificationsForUnlock(NotificationBo not, GenericDao dao) {
066
067 //LOG.info("************************calling OJBNotificationDao.findMatchedNotificationsForForUnlock************************ ");
068
069 Criteria criteria = new Criteria();
070 criteria.addEqualTo(NotificationConstants.BO_PROPERTY_NAMES.ID, not.getId());
071
072 Collection<NotificationBo> notifications = dao.findMatching(NotificationBo.class, criteria, true, RiceConstants.NO_WAIT);
073
074 return notifications;
075 }
076
077 }