001/**
002 * Copyright 2005-2018 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 */
016package org.kuali.rice.krad.dao.impl;
017
018import java.sql.Timestamp;
019
020import org.apache.ojb.broker.query.Criteria;
021import org.apache.ojb.broker.query.QueryFactory;
022import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
023import org.kuali.rice.kns.lookup.LookupResults;
024import org.kuali.rice.kns.lookup.SelectedObjectIds;
025import org.kuali.rice.krad.dao.PersistedLookupMetadataDao;
026import org.kuali.rice.krad.util.KRADPropertyConstants;
027
028public class PersistedLookupMetadataDaoOjb extends PlatformAwareDaoBaseOjb implements PersistedLookupMetadataDao {
029    private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PersistedLookupMetadataDaoOjb.class);
030    
031    /**
032     * @see org.kuali.rice.krad.dao.PersistedLookupMetadataDao#deleteOldLookupResults(java.sql.Timestamp)
033     */
034    public void deleteOldLookupResults(Timestamp expirationDate) {
035        Criteria criteria = new Criteria();
036        criteria.addLessThan(KRADPropertyConstants.LOOKUP_DATE, expirationDate);
037        getPersistenceBrokerTemplate().deleteByQuery(QueryFactory.newQuery(LookupResults.class, criteria));
038    }
039
040    /**
041     * @see org.kuali.rice.krad.dao.PersistedLookupMetadataDao#deleteOldSelectedObjectIds(java.sql.Timestamp)
042     */
043    public void deleteOldSelectedObjectIds(Timestamp expirationDate) {
044        Criteria criteria = new Criteria();
045        criteria.addLessThan(KRADPropertyConstants.LOOKUP_DATE, expirationDate);
046        getPersistenceBrokerTemplate().deleteByQuery(QueryFactory.newQuery(SelectedObjectIds.class, criteria));
047    }
048}