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.Collection;
19
20 import org.apache.ojb.broker.query.Criteria;
21 import org.apache.ojb.broker.query.QueryByCriteria;
22 import org.apache.ojb.broker.query.QueryFactory;
23 import org.kuali.ole.gl.businessobject.SufficientFundBalances;
24 import org.kuali.ole.gl.dataaccess.SufficientFundBalancesDao;
25 import org.kuali.ole.sys.OLEPropertyConstants;
26 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
27
28
29
30
31 public class SufficientFundBalancesDaoOjb extends PlatformAwareDaoBaseOjb implements SufficientFundBalancesDao {
32 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(SufficientFundBalancesDaoOjb.class);
33
34
35
36
37
38
39
40
41
42
43 public Collection getByObjectCode(Integer universityFiscalYear, String chartOfAccountsCode, String financialObjectCode) {
44 LOG.debug("getByObjectCode() started");
45
46 Criteria crit = new Criteria();
47 crit.addEqualTo(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, universityFiscalYear);
48 crit.addEqualTo(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
49 crit.addEqualTo(OLEPropertyConstants.FINANCIAL_OBJECT_CODE, financialObjectCode);
50
51 QueryByCriteria qbc = QueryFactory.newQuery(SufficientFundBalances.class, crit);
52 return getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
53 }
54
55
56
57
58
59
60
61
62
63
64 public int deleteByAccountNumber(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber) {
65 LOG.debug("deleteByAccountNumber() started");
66
67 Criteria crit = new Criteria();
68 crit.addEqualTo(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, universityFiscalYear);
69 crit.addEqualTo(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartOfAccountsCode);
70 crit.addEqualTo(OLEPropertyConstants.ACCOUNT_NUMBER, accountNumber);
71
72 QueryByCriteria qbc = QueryFactory.newQuery(SufficientFundBalances.class, crit);
73 int count = getPersistenceBrokerTemplate().getCount(qbc);
74 getPersistenceBrokerTemplate().deleteByQuery(qbc);
75
76
77
78
79
80 getPersistenceBrokerTemplate().clearCache();
81
82 return count;
83 }
84
85
86
87
88
89
90
91 public Collection testingGetAllEntries() {
92 LOG.debug("testingGetAllEntries() started");
93
94 Criteria criteria = new Criteria();
95 QueryByCriteria qbc = QueryFactory.newQuery(SufficientFundBalances.class, criteria);
96 qbc.addOrderBy(OLEPropertyConstants.UNIVERSITY_FISCAL_YEAR, true);
97 qbc.addOrderBy(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, true);
98 qbc.addOrderBy(OLEPropertyConstants.ACCOUNT_NUMBER, true);
99 qbc.addOrderBy(OLEPropertyConstants.FINANCIAL_OBJECT_CODE, true);
100
101 return getPersistenceBrokerTemplate().getCollectionByQuery(qbc);
102 }
103 }