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.ArrayList;
19 import java.util.Collection;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23
24 import org.kuali.ole.pdp.PdpPropertyConstants;
25 import org.kuali.ole.pdp.businessobject.PayeeACHAccount;
26 import org.kuali.ole.pdp.service.AchService;
27 import org.kuali.ole.sys.OLEPropertyConstants;
28 import org.kuali.rice.krad.service.BusinessObjectService;
29
30
31
32
33 public class AchServiceImpl implements AchService {
34 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(AchServiceImpl.class);
35
36 private BusinessObjectService businessObjectService;
37
38
39
40
41 public PayeeACHAccount getAchInformation(String idType, String payeeId, String achTransactionType) {
42 LOG.debug("getAchInformation() started");
43
44 Map<String, Object> fields = new HashMap<String, Object>();
45
46 fields.put(OLEPropertyConstants.ACTIVE, Boolean.TRUE);
47 fields.put(PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE, idType);
48 fields.put(PdpPropertyConstants.ACH_TRANSACTION_TYPE, achTransactionType);
49 fields.put(PdpPropertyConstants.PAYEE_ID_NUMBER, payeeId);
50
51 Collection<PayeeACHAccount> rows = businessObjectService.findMatching(PayeeACHAccount.class, fields);
52 if (rows.size() != 1) {
53 if (LOG.isDebugEnabled()) {
54 LOG.debug("getAchInformation() not found rows = " + rows.size());
55 }
56
57 return null;
58 }
59 else {
60 LOG.debug("getAchInformation() found");
61
62 return rows.iterator().next();
63 }
64 }
65
66
67
68
69 public List<PayeeACHAccount> getActiveAchAccounts() {
70 LOG.debug("getActivePayeeAchAccounts() started");
71
72 Map<String, Object> fields = new HashMap<String, Object>();
73 fields.put(OLEPropertyConstants.ACTIVE, Boolean.TRUE);
74 Collection<PayeeACHAccount> accounts = businessObjectService.findMatchingOrderBy(PayeeACHAccount.class, fields, PdpPropertyConstants.PAYEE_IDENTIFIER_TYPE_CODE, true);
75
76 return new ArrayList<PayeeACHAccount>(accounts);
77 }
78
79
80
81
82
83
84 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
85 this.businessObjectService = businessObjectService;
86 }
87
88 }