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.module.ar.document.dataaccess.impl; 017 018 import java.util.ArrayList; 019 import java.util.Collection; 020 import java.util.List; 021 022 import org.apache.ojb.broker.query.Criteria; 023 import org.apache.ojb.broker.query.QueryByCriteria; 024 import org.apache.ojb.broker.query.QueryFactory; 025 import org.kuali.kfs.module.ar.businessobject.AccountsReceivableDocumentHeader; 026 import org.kuali.kfs.module.ar.document.dataaccess.AccountsReceivableDocumentHeaderDao; 027 import org.kuali.kfs.sys.KFSConstants; 028 import org.kuali.kfs.sys.context.SpringContext; 029 import org.kuali.rice.kew.exception.WorkflowException; 030 import org.kuali.rice.kns.dao.impl.PlatformAwareDaoBaseOjb; 031 import org.kuali.rice.kns.exception.InfrastructureException; 032 import org.kuali.rice.kns.service.DocumentService; 033 034 public class AccountsReceivableDocumentHeaderDaoOjb extends PlatformAwareDaoBaseOjb implements AccountsReceivableDocumentHeaderDao { 035 036 public Collection getARDocumentHeadersByCustomerNumber(String customerNumber){ 037 Criteria criteria = new Criteria(); 038 criteria.addEqualTo(KFSConstants.CustomerOpenItemReport.CUSTOMER_NUMBER,customerNumber); 039 040 return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(AccountsReceivableDocumentHeader.class, criteria)); 041 } 042 043 public Collection getARDocumentHeadersByCustomerNumberByProcessingOrgCodeAndChartCode(String customerNumber, String processingChartOfAccountCode, String processingOrganizationCode) { 044 Criteria criteria = new Criteria(); 045 criteria.addEqualTo(KFSConstants.CustomerOpenItemReport.CUSTOMER_NUMBER,customerNumber); 046 criteria.addEqualTo(KFSConstants.CustomerOpenItemReport.PROCESSING_COA_CODE,processingChartOfAccountCode); 047 criteria.addEqualTo(KFSConstants.CustomerOpenItemReport.PROCESSING_ORGANIZATION_CODE,processingOrganizationCode); 048 049 return getPersistenceBrokerTemplate().getCollectionByQuery(QueryFactory.newQuery(AccountsReceivableDocumentHeader.class, criteria)); 050 } 051 }