Coverage Report - org.kuali.rice.krad.dao.impl.PersistedLookupMetadataDaoJpa
 
Classes in this File Line Coverage Branch Coverage Complexity
PersistedLookupMetadataDaoJpa
0%
0/13
N/A
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.krad.dao.impl;
 17  
 
 18  
 import java.sql.Timestamp;
 19  
 
 20  
 import javax.persistence.EntityManager;
 21  
 import javax.persistence.PersistenceContext;
 22  
 
 23  
 import org.kuali.rice.core.framework.persistence.jpa.criteria.Criteria;
 24  
 import org.kuali.rice.core.framework.persistence.jpa.criteria.QueryByCriteria;
 25  
 import org.kuali.rice.core.framework.persistence.jpa.criteria.QueryByCriteria.QueryByCriteriaType;
 26  
 import org.kuali.rice.krad.bo.LookupResults;
 27  
 import org.kuali.rice.krad.bo.SelectedObjectIds;
 28  
 import org.kuali.rice.krad.dao.PersistedLookupMetadataDao;
 29  
 import org.kuali.rice.krad.util.KRADPropertyConstants;
 30  
 
 31  0
 public class PersistedLookupMetadataDaoJpa implements PersistedLookupMetadataDao {
 32  0
     private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PersistedLookupMetadataDaoJpa.class);
 33  
     
 34  
     @PersistenceContext
 35  
         private EntityManager entityManager;
 36  
     
 37  
     /**
 38  
      * @see org.kuali.rice.krad.dao.PersistedLookupMetadataDao#deleteOldLookupResults(java.sql.Timestamp)
 39  
      */
 40  
     public void deleteOldLookupResults(Timestamp expirationDate) {
 41  0
         Criteria criteria = new Criteria(LookupResults.class.getName());
 42  0
         criteria.lt(KRADPropertyConstants.LOOKUP_DATE, expirationDate);
 43  0
         new QueryByCriteria(entityManager, criteria, QueryByCriteriaType.DELETE).toQuery().executeUpdate();
 44  0
     }
 45  
 
 46  
     /**
 47  
      * @see org.kuali.rice.krad.dao.PersistedLookupMetadataDao#deleteOldSelectedObjectIds(java.sql.Timestamp)
 48  
      */
 49  
     public void deleteOldSelectedObjectIds(Timestamp expirationDate) {
 50  0
         Criteria criteria = new Criteria(SelectedObjectIds.class.getName());
 51  0
         criteria.lt(KRADPropertyConstants.LOOKUP_DATE, expirationDate);
 52  0
         new QueryByCriteria(entityManager, criteria, QueryByCriteriaType.DELETE).toQuery().executeUpdate();
 53  0
     }
 54  
 
 55  
     /**
 56  
      * @return the entityManager
 57  
      */
 58  
     public EntityManager getEntityManager() {
 59  0
         return this.entityManager;
 60  
     }
 61  
 
 62  
     /**
 63  
      * @param entityManager the entityManager to set
 64  
      */
 65  
     public void setEntityManager(EntityManager entityManager) {
 66  0
         this.entityManager = entityManager;
 67  0
     }
 68  
 }