001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.purap.dao.ojb;
017:
018: import java.util.Collection;
019:
020: import org.apache.log4j.Logger;
021: import org.apache.ojb.broker.query.Criteria;
022: import org.apache.ojb.broker.query.Query;
023: import org.apache.ojb.broker.query.QueryByCriteria;
024: import org.kuali.core.dao.ojb.PlatformAwareDaoBaseOjb;
025: import org.kuali.core.util.KualiDecimal;
026: import org.kuali.module.purap.bo.NegativePaymentRequestApprovalLimit;
027: import org.kuali.module.purap.dao.NegativePaymentRequestApprovalLimitDao;
028:
029: /**
030: * OJB Implementation of NegativePaymentRequestApprovalLimitDao.
031: */
032: public class NegativePaymentRequestApprovalLimitDaoOjb extends
033: PlatformAwareDaoBaseOjb implements
034: NegativePaymentRequestApprovalLimitDao {
035: private static Logger LOG = Logger
036: .getLogger(NegativePaymentRequestApprovalLimitDaoOjb.class);
037:
038: /**
039: * @see org.kuali.module.purap.dao.NegativePaymentRequestApprovalLimitDao#findByChart(java.lang.String)
040: */
041: public Collection<NegativePaymentRequestApprovalLimit> findByChart(
042: String chartCode) {
043: LOG.debug("Entering findByChart(String)");
044: Criteria criteria = new Criteria();
045: criteria.addEqualTo("chartOfAccountsCode", chartCode);
046: Query query = new QueryByCriteria(
047: NegativePaymentRequestApprovalLimit.class, criteria);
048: LOG.debug("Leaving findByChart(String)");
049: return getPersistenceBrokerTemplate().getCollectionByQuery(
050: query);
051: }
052:
053: /**
054: * @see org.kuali.module.purap.dao.NegativePaymentRequestApprovalLimitDao#findByChartAndAccount(java.lang.String,
055: * java.lang.String)
056: */
057: public Collection<NegativePaymentRequestApprovalLimit> findByChartAndAccount(
058: String chartCode, String accountNumber) {
059: LOG.debug("Entering findByChartAndAccount(String, String)");
060: Criteria criteria = new Criteria();
061: criteria.addEqualTo("chartOfAccountsCode", chartCode);
062: criteria.addEqualTo("accountNumber", accountNumber);
063: Query query = new QueryByCriteria(
064: NegativePaymentRequestApprovalLimit.class, criteria);
065: LOG.debug("Leaving findByChartAndAccount(String, String)");
066: return getPersistenceBrokerTemplate().getCollectionByQuery(
067: query);
068: }
069:
070: /**
071: * @see org.kuali.module.purap.dao.NegativePaymentRequestApprovalLimitDao#findByChartAndOrganization(java.lang.String,
072: * java.lang.String)
073: */
074: public Collection<NegativePaymentRequestApprovalLimit> findByChartAndOrganization(
075: String chartCode, String organizationCode) {
076: LOG
077: .debug("Entering findByChartAndOrganization(String, String)");
078: Criteria criteria = new Criteria();
079: criteria.addEqualTo("chartOfAccountsCode", chartCode);
080: criteria.addEqualTo("organizationCode", organizationCode);
081: Query query = new QueryByCriteria(
082: NegativePaymentRequestApprovalLimit.class, criteria);
083: LOG.debug("Leaving findByChartAndOrganization(String, String)");
084: return getPersistenceBrokerTemplate().getCollectionByQuery(
085: query);
086: }
087:
088: /**
089: * @see org.kuali.module.purap.dao.NegativePaymentRequestApprovalLimitDao#findAboveLimit(org.kuali.core.util.KualiDecimal)
090: */
091: public Collection<NegativePaymentRequestApprovalLimit> findAboveLimit(
092: KualiDecimal limit) {
093: LOG.debug("Entering findAboveLimit(KualiDecimal)");
094: Criteria criteria = new Criteria();
095: criteria.addGreaterThan(
096: "negativePaymentRequestApprovalLimitAmount", limit);
097: Query query = new QueryByCriteria(
098: NegativePaymentRequestApprovalLimit.class, criteria);
099: LOG.debug("Leaving findAboveLimit(KualiDecimal)");
100: return getPersistenceBrokerTemplate().getCollectionByQuery(
101: query);
102: }
103:
104: /**
105: * @see org.kuali.module.purap.dao.NegativePaymentRequestApprovalLimitDao#findBelowLimit(org.kuali.core.util.KualiDecimal)
106: */
107: public Collection<NegativePaymentRequestApprovalLimit> findBelowLimit(
108: KualiDecimal limit) {
109: LOG.debug("Entering findBelowLimit(KualiDecimal)");
110: Criteria criteria = new Criteria();
111: criteria.addLessThan(
112: "negativePaymentRequestApprovalLimitAmount", limit);
113: Query query = new QueryByCriteria(
114: NegativePaymentRequestApprovalLimit.class, criteria);
115: LOG.debug("Leaving findBelowLimit(KualiDecimal)");
116: return getPersistenceBrokerTemplate().getCollectionByQuery(
117: query);
118: }
119:
120: }
|