001/* 002 * Copyright 2005-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.coa.dataaccess.impl; 017 018import java.util.ArrayList; 019import java.util.Collection; 020import java.util.Iterator; 021import java.util.List; 022 023import org.apache.ojb.broker.query.Criteria; 024import org.apache.ojb.broker.query.QueryFactory; 025import org.kuali.ole.coa.businessobject.ObjectCode; 026import org.kuali.ole.coa.dataaccess.ObjectCodeDao; 027import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb; 028 029 030/** 031 * This class is the OJB implementation of the ObjectCodeDao interface. 032 */ 033public class ObjectCodeDaoOjb extends PlatformAwareDaoBaseOjb implements ObjectCodeDao { 034 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ObjectCodeDaoOjb.class); 035 036 037 /** 038 * @see org.kuali.ole.coa.dataaccess.ObjectCodeDao#getYearList(java.lang.String, java.lang.String) 039 */ 040 public List getYearList(String chartOfAccountsCode, String financialObjectCode) { 041 042 List returnList = new ArrayList(); 043 Criteria criteria = new Criteria(); 044 criteria.addEqualTo("chartOfAccountsCode", chartOfAccountsCode); 045 criteria.addEqualTo("financialObjectCode", financialObjectCode); 046 Collection years = getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(ObjectCode.class, criteria)); 047 for (Iterator iter = years.iterator(); iter.hasNext();) { 048 ObjectCode o = (ObjectCode) iter.next(); 049 if (o != null) { 050 returnList.add(o.getUniversityFiscalYear()); 051 } 052 } 053 return returnList; 054 055 056 } 057}