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 package org.kuali.kfs.pdp.dataaccess.impl; 017 018 import java.util.ArrayList; 019 import java.util.Collection; 020 import java.util.Iterator; 021 022 import org.apache.ojb.broker.query.Criteria; 023 import org.apache.ojb.broker.query.QueryByCriteria; 024 import org.kuali.kfs.pdp.PdpConstants; 025 import org.kuali.kfs.pdp.PdpPropertyConstants; 026 import org.kuali.kfs.pdp.businessobject.PaymentGroupHistory; 027 import org.kuali.kfs.pdp.dataaccess.PaymentGroupHistoryDao; 028 import org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb; 029 030 public class PaymentGroupHistoryDaoOjb extends PlatformAwareDaoBaseOjb implements PaymentGroupHistoryDao { 031 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PaymentGroupHistoryDaoOjb.class); 032 033 public PaymentGroupHistoryDaoOjb() { 034 super(); 035 } 036 037 /** 038 * @see org.kuali.kfs.pdp.dataaccess.PaymentGroupHistoryDao#getCanceledChecks() 039 */ 040 public Iterator getCanceledChecks() { 041 LOG.debug("getCanceledChecks() started"); 042 043 Collection codes = new ArrayList(); 044 codes.add(PdpConstants.PaymentChangeCodes.CANCEL_DISBURSEMENT); 045 codes.add(PdpConstants.PaymentChangeCodes.CANCEL_REISSUE_DISBURSEMENT); 046 047 Criteria crit = new Criteria(); 048 crit.addIn(PdpPropertyConstants.PAYMENT_CHANGE_CODE, codes); 049 crit.addIsNull(PdpPropertyConstants.PaymentGroupHistory.PMT_CANCEL_EXTRACT_DATE); 050 051 Criteria o1 = new Criteria(); 052 o1.addNotEqualTo(PdpPropertyConstants.DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.ACH); 053 Criteria o1a = new Criteria(); 054 o1a.addIsNull(PdpPropertyConstants.DISBURSEMENT_TYPE_CODE); 055 o1.addOrCriteria(o1a); 056 057 Criteria o2 = new Criteria(); 058 o2.addEqualTo(PdpPropertyConstants.DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.CHECK); 059 Criteria o2a = new Criteria(); 060 o2a.addEqualTo(PdpPropertyConstants.PAYMENT_GROUP + "." + PdpPropertyConstants.DISBURSEMENT_TYPE_CODE, PdpConstants.DisbursementTypeCodes.CHECK); 061 o2.addOrCriteria(o2a); 062 063 crit.addAndCriteria(o1); 064 crit.addAndCriteria(o2); 065 066 return getPersistenceBrokerTemplate().getIteratorByQuery(new QueryByCriteria(PaymentGroupHistory.class, crit)); 067 } 068 }