1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.gl.dataaccess.impl;
17
18 import java.util.ArrayList;
19 import java.util.Iterator;
20 import java.util.List;
21
22 import org.apache.ojb.broker.query.Criteria;
23 import org.apache.ojb.broker.query.QueryFactory;
24 import org.apache.ojb.broker.query.ReportQueryByCriteria;
25 import org.kuali.ole.gl.businessobject.BalanceHistory;
26 import org.kuali.ole.gl.dataaccess.LedgerBalanceHistoryBalancingDao;
27 import org.kuali.ole.sys.OLEPropertyConstants;
28 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
29
30
31
32
33 public class BalanceHistoryDaoOjb extends PlatformAwareDaoBaseOjb implements LedgerBalanceHistoryBalancingDao {
34 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BalanceHistoryDaoOjb.class);
35
36
37
38
39 public List<Integer> findDistinctFiscalYears() {
40 Criteria crit = new Criteria();
41 ReportQueryByCriteria q = QueryFactory.newReportQuery(BalanceHistory.class, crit);
42 q.setAttributes(new String[] { OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR });
43 q.setDistinct(true);
44
45 Iterator<Object[]> years = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(q);
46 List<Integer> yearList = new ArrayList<Integer>();
47
48 while (years != null && years.hasNext()) {
49 Object[] year = years.next();
50 yearList.add(new Integer(year[0].toString()));
51 }
52
53 return yearList;
54 }
55 }