View Javadoc

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