1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.coa.dataaccess.impl;
17
18 import java.util.Iterator;
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.apache.ojb.broker.query.ReportQueryByCriteria;
24 import org.kuali.ole.coa.businessobject.IndirectCostRecoveryExclusionAccount;
25 import org.kuali.ole.coa.dataaccess.IndirectCostRecoveryExclusionAccountDao;
26 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
27
28
29
30
31 public class IndirectCostRecoveryExclusionAccountDaoOjb extends PlatformAwareDaoBaseOjb implements IndirectCostRecoveryExclusionAccountDao {
32 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(IndirectCostRecoveryExclusionAccountDaoOjb.class);
33
34 public IndirectCostRecoveryExclusionAccountDaoOjb() {
35 super();
36 }
37
38
39
40
41
42 public IndirectCostRecoveryExclusionAccount getByPrimaryKey(String chartOfAccountsCode, String accountNumber, String objectChartOfAccountsCode, String objectCode) {
43 LOG.debug("getByPrimaryKey() started");
44
45 Criteria crit = new Criteria();
46 crit.addEqualTo("chartOfAccountsCode", chartOfAccountsCode);
47 crit.addEqualTo("accountNumber", accountNumber);
48 crit.addEqualTo("financialObjectChartOfAccountCode", objectChartOfAccountsCode);
49 crit.addEqualTo("financialObjectCode", objectCode);
50
51 QueryByCriteria qbc = QueryFactory.newQuery(IndirectCostRecoveryExclusionAccount.class, crit);
52 return (IndirectCostRecoveryExclusionAccount) getPersistenceBrokerTemplate().getObjectByQuery(qbc);
53 }
54
55
56
57
58 public boolean existByAccount(String chartOfAccountsCode, String accountNumber) {
59 LOG.debug("existByAccount() started");
60
61 Criteria crit = new Criteria();
62 crit.addEqualTo("chartOfAccountsCode", chartOfAccountsCode);
63 crit.addEqualTo("accountNumber", accountNumber);
64
65 ReportQueryByCriteria q = QueryFactory.newReportQuery(IndirectCostRecoveryExclusionAccount.class, crit);
66 q.setAttributes(new String[] { "chartOfAccountsCode" });
67 q.setDistinct(true);
68
69 Iterator iter = getPersistenceBrokerTemplate().getReportQueryIteratorByQuery(q);
70 return iter.hasNext();
71 }
72
73 }