001/* 002 * Copyright 2006 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.ole.fp.dataaccess.impl; 017 018import java.util.Collection; 019 020import org.apache.log4j.Logger; 021import org.apache.ojb.broker.query.Criteria; 022import org.apache.ojb.broker.query.QueryByCriteria; 023import org.apache.ojb.broker.query.QueryFactory; 024import org.kuali.ole.fp.businessobject.Check; 025import org.kuali.ole.fp.businessobject.CheckBase; 026import org.kuali.ole.fp.dataaccess.CheckDao; 027import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb; 028import org.springframework.dao.DataAccessException; 029 030/** 031 * This class is the OJB implementation of the AccountingLineDao interface. 032 */ 033 034public class CheckDaoOjb extends PlatformAwareDaoBaseOjb implements CheckDao { 035 private static final Logger LOG = Logger.getLogger(CheckDaoOjb.class); 036 037 /** 038 * @param line 039 * @throws DataAccessException 040 */ 041 public void deleteCheck(Check check) throws DataAccessException { 042 getPersistenceBrokerTemplate().delete(check); 043 } 044 045 /** 046 * Retrieves accounting lines associate with a given document header ID using OJB. 047 * 048 * @param classname 049 * @param id 050 * @return 051 */ 052 public Collection<CheckBase> findByDocumentHeaderId(String documentHeaderId) throws DataAccessException { 053 Criteria criteria = new Criteria(); 054 criteria.addEqualTo("FDOC_NBR", documentHeaderId); 055 056 QueryByCriteria query = QueryFactory.newQuery(CheckBase.class, criteria); 057 058 Collection<CheckBase> lines = getPersistenceBrokerTemplate().getCollectionByQuery(query); 059 060 return lines; 061 } 062}