1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.kuali.ole.pdp.service.impl;
17  
18  import java.util.HashMap;
19  import java.util.Iterator;
20  import java.util.List;
21  import java.util.Map;
22  
23  import org.kuali.ole.pdp.PdpPropertyConstants;
24  import org.kuali.ole.pdp.businessobject.PaymentDetail;
25  import org.kuali.ole.pdp.dataaccess.PaymentDetailDao;
26  import org.kuali.ole.pdp.service.PaymentDetailService;
27  import org.kuali.ole.sys.DynamicCollectionComparator;
28  import org.kuali.ole.sys.service.NonTransactional;
29  import org.kuali.rice.krad.service.BusinessObjectService;
30  
31  @NonTransactional
32  public class PaymentDetailServiceImpl implements PaymentDetailService {
33      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(PaymentDetailServiceImpl.class);
34  
35      private PaymentDetailDao paymentDetailDao;
36      private BusinessObjectService businessObjectService;
37      
38      public void setPaymentDetailDao(PaymentDetailDao c) {
39          paymentDetailDao = c;
40      }
41  
42      
43  
44  
45      public Iterator getByDisbursementNumber(Integer disbursementNumber) {
46          LOG.debug("getByDisbursementNumber() started");
47          
48          Map fieldValues = new HashMap();
49          fieldValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_NUMBER, disbursementNumber);
50          List<PaymentDetail> paymentDetailByDisbursementNumberList= (List<PaymentDetail>)this.businessObjectService.findMatching(PaymentDetail.class, fieldValues);
51          DynamicCollectionComparator.sort(paymentDetailByDisbursementNumberList, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_FINANCIAL_DOCUMENT_TYPE_CODE, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_CUST_PAYMENT_DOC_NBR);
52  
53          return paymentDetailByDisbursementNumberList.iterator();
54      }
55      
56      
57  
58  
59  
60  
61  
62  
63  
64      public Iterator<PaymentDetail> getByDisbursementNumber(Integer disbursementNumber, Integer processId, String disbursementType, String bankCode) {
65          if (LOG.isDebugEnabled()) {
66              LOG.debug("getByDisbursementNumber() started");
67          }
68          
69          Map fieldValues = new HashMap();
70          fieldValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_NUMBER, disbursementNumber);
71          fieldValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP+"."+PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_PROCESS_ID, processId);
72          fieldValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP+"."+PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_DISBURSEMENT_TYPE_CODE, disbursementType);
73          fieldValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_GROUP+"."+PdpPropertyConstants.PaymentGroup.PAYMENT_GROUP_BANK_CODE, bankCode);
74          List<PaymentDetail> paymentDetailByDisbursementNumberList= (List<PaymentDetail>)this.businessObjectService.findMatching(PaymentDetail.class, fieldValues);
75          DynamicCollectionComparator.sort(paymentDetailByDisbursementNumberList, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_FINANCIAL_DOCUMENT_TYPE_CODE, PdpPropertyConstants.PaymentDetail.PAYMENT_DISBURSEMENT_CUST_PAYMENT_DOC_NBR);
76  
77          return paymentDetailByDisbursementNumberList.iterator();
78      }
79  
80      
81  
82  
83      public Iterator getUnprocessedCancelledDetails(String organization, List<String> subUnits) {
84          LOG.debug("getUnprocessedCancelledDetails() started");
85  
86          return paymentDetailDao.getUnprocessedCancelledDetails(organization, subUnits);
87      }
88  
89      
90  
91  
92      public Iterator getUnprocessedPaidDetails(String organization, List<String> subUnits) {
93          LOG.debug("getUnprocessedPaidDetails() started");
94  
95          return paymentDetailDao.getUnprocessedPaidDetails(organization, subUnits);
96      }
97  
98      public void setBusinessObjectService(BusinessObjectService businessObjectService) {
99          this.businessObjectService = businessObjectService;
100     }
101 }