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.log4j.Logger;
021import org.apache.ojb.broker.query.Criteria;
022import org.apache.ojb.broker.query.QueryFactory;
023import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
024import org.kuali.rice.krad.bo.SessionDocument;
025import org.kuali.rice.krad.dao.BusinessObjectDao;
026import org.kuali.rice.krad.dao.SessionDocumentDao;
027import org.kuali.rice.krad.util.KRADPropertyConstants;
028import org.springframework.dao.DataAccessException;
029
030/**
031 * This class is the OJB implementation of the DocumentDao interface.
032 */
033public class SessionDocumentDaoOjb extends PlatformAwareDaoBaseOjb implements SessionDocumentDao{
034    private static Logger LOG = Logger.getLogger(SessionDocumentDaoOjb.class);
035    private BusinessObjectDao businessObjectDao;
036    
037
038    public SessionDocumentDaoOjb() {
039        super();
040    }
041    
042    /*
043     * (non-Javadoc)
044     * 
045     * @see SessionDocumentDao#purgeAllSessionDocuments(java.sql.Timestamp)
046     */
047    public void purgeAllSessionDocuments(Timestamp expirationDate)throws DataAccessException {
048        Criteria criteria = new Criteria();
049                criteria.addLessThan(KRADPropertyConstants.LAST_UPDATED_DATE, expirationDate);
050                 getPersistenceBrokerTemplate().deleteByQuery(QueryFactory.newQuery(SessionDocument.class, criteria));
051                 //getPersistenceBrokerTemplate().clearCache();
052                
053    }
054
055 
056}