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 /* 017 * Created on Aug 7, 2004 018 * 019 */ 020 package org.kuali.kfs.pdp.dataaccess.impl; 021 022 import java.math.BigDecimal; 023 import java.sql.Timestamp; 024 025 import org.apache.ojb.broker.query.Criteria; 026 import org.apache.ojb.broker.query.QueryByCriteria; 027 import org.kuali.kfs.pdp.PdpPropertyConstants; 028 import org.kuali.kfs.pdp.businessobject.Batch; 029 import org.kuali.kfs.pdp.businessobject.CustomerProfile; 030 import org.kuali.kfs.pdp.businessobject.PaymentAccountHistory; 031 import org.kuali.kfs.pdp.businessobject.PaymentGroup; 032 import org.kuali.kfs.pdp.dataaccess.PaymentFileLoadDao; 033 import org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb; 034 035 /** 036 * @see org.kuali.kfs.pdp.dataaccess.PaymentFileLoadDao 037 */ 038 public class PaymentFileLoadDaoOjb extends PlatformAwareDaoBaseOjb implements PaymentFileLoadDao { 039 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PaymentFileLoadDaoOjb.class); 040 041 public PaymentFileLoadDaoOjb() { 042 super(); 043 } 044 045 /** 046 * @see org.kuali.kfs.pdp.dataaccess.PaymentFileLoadDao#isDuplicateBatch(org.kuali.kfs.pdp.businessobject.CustomerProfile, 047 * java.lang.Integer, java.math.BigDecimal, java.sql.Timestamp) 048 */ 049 public boolean isDuplicateBatch(CustomerProfile customer, Integer count, BigDecimal totalAmount, Timestamp now) { 050 LOG.debug("isDuplicateBatch() starting"); 051 052 Criteria criteria = new Criteria(); 053 criteria.addEqualTo(PdpPropertyConstants.CUSTOMER_ID, customer.getId()); 054 criteria.addEqualTo(PdpPropertyConstants.CUSTOMER_FILE_CREATE_TIMESTAMP, now); 055 criteria.addEqualTo(PdpPropertyConstants.PAYMENT_COUNT, count); 056 criteria.addEqualTo(PdpPropertyConstants.PAYMENT_TOTAL_AMOUNT, totalAmount); 057 058 return getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(Batch.class, criteria)) != null; 059 } 060 }