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: package org.kuali.module.pdp.dao.ojb;
17:
18: import java.sql.Timestamp;
19: import java.util.ArrayList;
20: import java.util.Collection;
21: import java.util.Date;
22: import java.util.Iterator;
23:
24: import org.apache.ojb.broker.query.Criteria;
25: import org.apache.ojb.broker.query.QueryByCriteria;
26: import org.kuali.core.dao.ojb.PlatformAwareDaoBaseOjb;
27: import org.kuali.module.pdp.PdpConstants;
28: import org.kuali.module.pdp.bo.PaymentGroupHistory;
29: import org.kuali.module.pdp.dao.PaymentGroupHistoryDao;
30:
31: public class PaymentGroupHistoryDaoOjb extends PlatformAwareDaoBaseOjb
32: implements PaymentGroupHistoryDao {
33: private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
34: .getLogger(PaymentGroupHistoryDaoOjb.class);
35:
36: public PaymentGroupHistoryDaoOjb() {
37: super ();
38: }
39:
40: /**
41: * @see org.kuali.module.pdp.dao.PaymentGroupHistoryDao#save(org.kuali.module.pdp.bo.PaymentGroupHistory)
42: */
43: public PaymentGroupHistory save(
44: PaymentGroupHistory paymentGroupHistory) {
45: LOG.debug("save() started");
46: paymentGroupHistory.setChangeTime(new Timestamp(new Date()
47: .getTime()));
48: getPersistenceBrokerTemplate().store(paymentGroupHistory);
49: return paymentGroupHistory;
50: }
51:
52: /**
53: * @see org.kuali.module.pdp.dao.PaymentGroupHistoryDao#getCanceledChecks()
54: */
55: public Iterator getCanceledChecks() {
56: LOG.debug("getCanceledChecks() started");
57:
58: Collection codes = new ArrayList();
59: codes.add(PdpConstants.PaymentChangeCodes.CANCEL_DISBURSEMENT);
60: codes
61: .add(PdpConstants.PaymentChangeCodes.CANCEL_REISSUE_DISBURSEMENT);
62:
63: Criteria crit = new Criteria();
64: crit.addIn("paymentChangeCode", codes);
65: crit.addIsNull("pmtCancelExtractDate");
66:
67: Criteria o1 = new Criteria();
68: o1.addNotEqualTo("disbursementTypeCode",
69: PdpConstants.DisbursementTypeCodes.ACH);
70: Criteria o1a = new Criteria();
71: o1a.addIsNull("disbursementTypeCode");
72: o1.addOrCriteria(o1a);
73:
74: Criteria o2 = new Criteria();
75: o2.addEqualTo("disbursementTypeCode",
76: PdpConstants.DisbursementTypeCodes.CHECK);
77: Criteria o2a = new Criteria();
78: o2a.addEqualTo("paymentGroup.disbursementTypeCode",
79: PdpConstants.DisbursementTypeCodes.CHECK);
80: o2.addOrCriteria(o2a);
81:
82: crit.addAndCriteria(o1);
83: crit.addAndCriteria(o2);
84:
85: return getPersistenceBrokerTemplate().getIteratorByQuery(
86: new QueryByCriteria(PaymentGroupHistory.class, crit));
87: }
88: }
|