1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.kuali.ole.pdp.dataaccess.impl;
21
22 import java.math.BigDecimal;
23 import java.sql.Timestamp;
24
25 import org.apache.ojb.broker.query.Criteria;
26 import org.apache.ojb.broker.query.QueryByCriteria;
27 import org.kuali.ole.pdp.PdpPropertyConstants;
28 import org.kuali.ole.pdp.businessobject.Batch;
29 import org.kuali.ole.pdp.businessobject.CustomerProfile;
30 import org.kuali.ole.pdp.dataaccess.PaymentFileLoadDao;
31 import org.kuali.rice.core.framework.persistence.ojb.dao.PlatformAwareDaoBaseOjb;
32
33
34
35
36 public class PaymentFileLoadDaoOjb extends PlatformAwareDaoBaseOjb implements PaymentFileLoadDao {
37 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PaymentFileLoadDaoOjb.class);
38
39 public PaymentFileLoadDaoOjb() {
40 super();
41 }
42
43
44
45
46
47 public boolean isDuplicateBatch(CustomerProfile customer, Integer count, BigDecimal totalAmount, Timestamp now) {
48 LOG.debug("isDuplicateBatch() starting");
49
50 Criteria criteria = new Criteria();
51 criteria.addEqualTo(PdpPropertyConstants.CUSTOMER_ID, customer.getId());
52 criteria.addEqualTo(PdpPropertyConstants.CUSTOMER_FILE_CREATE_TIMESTAMP, now);
53 criteria.addEqualTo(PdpPropertyConstants.PAYMENT_COUNT, count);
54 criteria.addEqualTo(PdpPropertyConstants.PAYMENT_TOTAL_AMOUNT, totalAmount);
55
56 return getPersistenceBrokerTemplate().getObjectByQuery(new QueryByCriteria(Batch.class, criteria)) != null;
57 }
58 }