View Javadoc
1   /*
2    * Copyright 2005 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.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.OriginEntrySource;
24  import org.kuali.ole.gl.dataaccess.OriginEntrySourceDao;
25  import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
26  
27  /**
28   * An OJB implementation of OriginEntrySourceDao
29   */
30  public class OriginEntrySourceDaoOjb extends PlatformAwareDaoBaseOjb implements OriginEntrySourceDao {
31  
32      private static final String FINANCIAL_DOCUMENT_REVERSAL_DATE = "financialDocumentReversalDate";
33      private static final String UNIVERSITY_FISCAL_YEAR = "universityFiscalYear";
34      private static final String CHART_OF_ACCOUNTS_CODE = "chartOfAccountsCode";
35      private static final String ACCOUNT_NUMBER = "accountNumber";
36      private static final String SUB_ACCOUNT_NUMBER = "subAccountNumber";
37      private static final String FINANCIAL_OBJECT_CODE = "financialObjectCode";
38      private static final String FINANCIAL_SUB_OBJECT_CODE = "financialSubObjectCode";
39      private static final String FINANCIAL_BALANCE_TYPE_CODE = "financialBalanceTypeCode";
40      private static final String FINANCIAL_OBJECT_TYPE_CODE = "financialObjectTypeCode";
41      private static final String UNIVERSITY_FISCAL_PERIOD_CODE = "universityFiscalPeriodCode";
42      private static final String FINANCIAL_DOCUMENT_TYPE_CODE = "financialDocumentTypeCode";
43      private static final String FINANCIAL_SYSTEM_ORIGINATION_CODE = "financialSystemOriginationCode";
44      private static final String TRANSACTION_LEDGER_ENTRY_SEQUENCE_NUMBER = "transactionLedgerEntrySequenceNumber";
45  
46      /**
47       * Constructs a OriginEntrySourceDaoOjb instance
48       */
49      public OriginEntrySourceDaoOjb() {
50          super();
51      }
52  
53      /**
54       * Fetches all origin entry full records in the database
55       * 
56       * @return a Collection of all origin entry source records
57       * @see org.kuali.ole.gl.dataaccess.OriginEntrySourceDao#findAll()
58       */
59      public Collection findAll() {
60          QueryByCriteria query = QueryFactory.newQuery(OriginEntrySource.class, (Criteria) null);// "SELECT * FROM
61          // GL_ORIGIN_ENTRY_SRC_T");
62          Collection thawed = getPersistenceBrokerTemplate().getCollectionByQuery(query);
63          // Collection frozen = Collections.unmodifiableCollection(thawed);
64          return thawed;
65      }
66  
67      /**
68       * Finds an origin entry source record based on its source code
69       * 
70       * @param code the code of the origin entry source record to find
71       * @return an Origin Entry Source record if found, or null if not found
72       * @see org.kuali.ole.gl.dataaccess.OriginEntrySourceDao#findBySourceCode(java.lang.String)
73       */
74      public OriginEntrySource findBySourceCode(String code) {
75          Criteria criteria = new Criteria();
76          criteria.addEqualTo("code", code);
77          QueryByCriteria query = QueryFactory.newQuery(OriginEntrySource.class, criteria);
78          return (OriginEntrySource) getPersistenceBrokerTemplate().getObjectByQuery(query);
79      }
80  
81  }