01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.module.chart.dao.ojb;
17:
18: import java.util.List;
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.core.dao.ojb.PlatformAwareDaoBaseOjb;
24: import org.kuali.module.chart.bo.OrganizationReversion;
25: import org.kuali.module.chart.bo.OrganizationReversionCategory;
26: import org.kuali.module.chart.dao.OrganizationReversionDao;
27:
28: /**
29: * This class implements the {@link OrganizationReversionDao} data access methods using Ojb
30: */
31: public class OrganizationReversionDaoOjb extends
32: PlatformAwareDaoBaseOjb implements OrganizationReversionDao {
33: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
34: .getLogger(OrganizationReversionDaoOjb.class);
35:
36: /**
37: * @see org.kuali.module.chart.dao.OrganizationReversionDao#getByPrimaryId(java.lang.Integer, java.lang.String,
38: * java.lang.String)
39: */
40: public OrganizationReversion getByPrimaryId(
41: Integer universityFiscalYear,
42: String financialChartOfAccountsCode, String organizationCode) {
43: LOG.debug("getByPrimaryId() started");
44:
45: Criteria criteria = new Criteria();
46: criteria.addEqualTo("universityFiscalYear",
47: universityFiscalYear);
48: criteria.addEqualTo("chartOfAccountsCode",
49: financialChartOfAccountsCode);
50: criteria.addEqualTo("organizationCode", organizationCode);
51:
52: return (OrganizationReversion) getPersistenceBrokerTemplate()
53: .getObjectByQuery(
54: QueryFactory.newQuery(
55: OrganizationReversion.class, criteria));
56: }
57:
58: /**
59: * @see org.kuali.module.chart.dao.OrganizationReversionDao#getCategories()
60: */
61: public List<OrganizationReversionCategory> getCategories() {
62: LOG.debug("getCategories() started");
63:
64: Criteria criteria = new Criteria();
65: criteria.addEqualTo(
66: "organizationReversionCategoryActiveIndicator", true);
67: QueryByCriteria q = QueryFactory.newQuery(
68: OrganizationReversionCategory.class, criteria);
69: q.addOrderByAscending("organizationReversionSortCode");
70:
71: return (List) getPersistenceBrokerTemplate()
72: .getCollectionByQuery(q);
73: }
74: }
|