View Javadoc
1   /*
2    * Copyright 2005-2006 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.ole.coa.dataaccess.impl;
17  
18  import java.util.ArrayList;
19  import java.util.Collection;
20  import java.util.Iterator;
21  import java.util.List;
22  
23  import org.apache.ojb.broker.query.Criteria;
24  import org.apache.ojb.broker.query.QueryFactory;
25  import org.kuali.ole.coa.businessobject.ObjectCode;
26  import org.kuali.ole.coa.dataaccess.ObjectCodeDao;
27  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
28  
29  
30  /**
31   * This class is the OJB implementation of the ObjectCodeDao interface.
32   */
33  public class ObjectCodeDaoOjb extends PlatformAwareDaoBaseOjb implements ObjectCodeDao {
34      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ObjectCodeDaoOjb.class);
35  
36  
37      /**
38       * @see org.kuali.ole.coa.dataaccess.ObjectCodeDao#getYearList(java.lang.String, java.lang.String)
39       */
40      public List getYearList(String chartOfAccountsCode, String financialObjectCode) {
41  
42          List returnList = new ArrayList();
43          Criteria criteria = new Criteria();
44          criteria.addEqualTo("chartOfAccountsCode", chartOfAccountsCode);
45          criteria.addEqualTo("financialObjectCode", financialObjectCode);
46          Collection years = getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(ObjectCode.class, criteria));
47          for (Iterator iter = years.iterator(); iter.hasNext();) {
48              ObjectCode o = (ObjectCode) iter.next();
49              if (o != null) {
50                  returnList.add(o.getUniversityFiscalYear());
51              }
52          }
53          return returnList;
54  
55  
56      }
57  }