01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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: /*
17: * Created on Aug 7, 2004
18: *
19: */
20: package org.kuali.module.pdp.dao.ojb;
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.core.dao.ojb.PlatformAwareDaoBaseOjb;
28: import org.kuali.module.pdp.bo.Batch;
29: import org.kuali.module.pdp.bo.CustomerProfile;
30: import org.kuali.module.pdp.bo.PaymentAccountHistory;
31: import org.kuali.module.pdp.bo.PaymentGroup;
32: import org.kuali.module.pdp.dao.PaymentFileLoadDao;
33:
34: /**
35: * @author jsissom
36: */
37: public class PaymentFileLoadDaoOjb extends PlatformAwareDaoBaseOjb
38: implements PaymentFileLoadDao {
39: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
40: .getLogger(PaymentFileLoadDaoOjb.class);
41:
42: public PaymentFileLoadDaoOjb() {
43: super ();
44: }
45:
46: public boolean isDuplicateBatch(CustomerProfile customer,
47: Integer count, BigDecimal totalAmount, Timestamp now) {
48: LOG.debug("isDuplicateBatch() starting");
49:
50: Criteria criteria = new Criteria();
51: criteria.addEqualTo("customerId", customer.getId());
52: criteria.addEqualTo("customerFileCreateTimestamp", now);
53: criteria.addEqualTo("paymentCount", count);
54: criteria.addEqualTo("paymentTotalAmount", totalAmount);
55:
56: return getPersistenceBrokerTemplate().getObjectByQuery(
57: new QueryByCriteria(Batch.class, criteria)) != null;
58: }
59:
60: public void createBatch(Batch batch) {
61: LOG.debug("createBatch() started");
62:
63: getPersistenceBrokerTemplate().store(batch);
64: }
65:
66: public void createGroup(PaymentGroup group) {
67: LOG.debug("createGroup() started");
68: getPersistenceBrokerTemplate().store(group);
69: }
70:
71: public void createPaymentAccountHistory(PaymentAccountHistory pah) {
72: getPersistenceBrokerTemplate().store(pah);
73: }
74: }
|