001 /*
002 * Copyright 2011 The Kuali Foundation.
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.kfs.gl.dataaccess.impl;
017
018 import java.util.Collection;
019
020 import org.apache.ojb.broker.query.Criteria;
021 import org.apache.ojb.broker.query.QueryByCriteria;
022 import org.apache.ojb.broker.query.QueryFactory;
023 import org.kuali.kfs.gl.businessobject.OriginEntrySource;
024 import org.kuali.kfs.gl.dataaccess.OriginEntrySourceDao;
025 import org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb;
026
027 /**
028 * An OJB implementation of OriginEntrySourceDao
029 */
030 public class OriginEntrySourceDaoOjb extends PlatformAwareDaoBaseOjb implements OriginEntrySourceDao {
031
032 private static final String FINANCIAL_DOCUMENT_REVERSAL_DATE = "financialDocumentReversalDate";
033 private static final String UNIVERSITY_FISCAL_YEAR = "universityFiscalYear";
034 private static final String CHART_OF_ACCOUNTS_CODE = "chartOfAccountsCode";
035 private static final String ACCOUNT_NUMBER = "accountNumber";
036 private static final String SUB_ACCOUNT_NUMBER = "subAccountNumber";
037 private static final String FINANCIAL_OBJECT_CODE = "financialObjectCode";
038 private static final String FINANCIAL_SUB_OBJECT_CODE = "financialSubObjectCode";
039 private static final String FINANCIAL_BALANCE_TYPE_CODE = "financialBalanceTypeCode";
040 private static final String FINANCIAL_OBJECT_TYPE_CODE = "financialObjectTypeCode";
041 private static final String UNIVERSITY_FISCAL_PERIOD_CODE = "universityFiscalPeriodCode";
042 private static final String FINANCIAL_DOCUMENT_TYPE_CODE = "financialDocumentTypeCode";
043 private static final String FINANCIAL_SYSTEM_ORIGINATION_CODE = "financialSystemOriginationCode";
044 private static final String TRANSACTION_LEDGER_ENTRY_SEQUENCE_NUMBER = "transactionLedgerEntrySequenceNumber";
045
046 /**
047 * Constructs a OriginEntrySourceDaoOjb instance
048 */
049 public OriginEntrySourceDaoOjb() {
050 super();
051 }
052
053 /**
054 * Fetches all origin entry full records in the database
055 *
056 * @return a Collection of all origin entry source records
057 * @see org.kuali.kfs.gl.dataaccess.OriginEntrySourceDao#findAll()
058 */
059 public Collection findAll() {
060 QueryByCriteria query = QueryFactory.newQuery(OriginEntrySource.class, (Criteria) null);// "SELECT * FROM
061 // GL_ORIGIN_ENTRY_SRC_T");
062 Collection thawed = getPersistenceBrokerTemplate().getCollectionByQuery(query);
063 // Collection frozen = Collections.unmodifiableCollection(thawed);
064 return thawed;
065 }
066
067 /**
068 * Finds an origin entry source record based on its source code
069 *
070 * @param code the code of the origin entry source record to find
071 * @return an Origin Entry Source record if found, or null if not found
072 * @see org.kuali.kfs.gl.dataaccess.OriginEntrySourceDao#findBySourceCode(java.lang.String)
073 */
074 public OriginEntrySource findBySourceCode(String code) {
075 Criteria criteria = new Criteria();
076 criteria.addEqualTo("code", code);
077 QueryByCriteria query = QueryFactory.newQuery(OriginEntrySource.class, criteria);
078 return (OriginEntrySource) getPersistenceBrokerTemplate().getObjectByQuery(query);
079 }
080
081 }