1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.vnd.businessobject.lookup;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import java.util.Map;
21
22 import org.apache.cxf.common.util.StringUtils;
23 import org.kuali.ole.vnd.batch.service.VendorExcludeService;
24 import org.kuali.ole.vnd.businessobject.VendorAddress;
25 import org.kuali.ole.vnd.businessobject.VendorDetail;
26 import org.kuali.ole.vnd.document.service.VendorService;
27 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
28 import org.kuali.rice.krad.bo.BusinessObject;
29
30 public class DebarredVendorUnmatchedLookupableHelperServiceImpl extends KualiLookupableHelperServiceImpl {
31 VendorExcludeService vendorExcludeService;
32 VendorService vendorService;
33
34 @Override
35 public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
36 return getDebarredVendorUnmatchedSearchResults(fieldValues);
37 }
38
39 @Override
40 public List<? extends BusinessObject> getSearchResultsUnbounded(Map<String, String> fieldValues) {
41 return getDebarredVendorUnmatchedSearchResults(fieldValues);
42 }
43
44 protected List<? extends BusinessObject> getDebarredVendorUnmatchedSearchResults(Map<String, String> fieldValues) {
45 List<VendorDetail> vendorResultList = vendorExcludeService.getDebarredVendorsUnmatched();
46 List<VendorDetail> filteredVendorList = new ArrayList<VendorDetail> ();
47 VendorAddress defaultAddress;
48 String vendorType = fieldValues.get("vendorTypeCode");
49 for (VendorDetail vendor : vendorResultList) {
50 if (!StringUtils.isEmpty(vendorType) && !vendor.getVendorHeader().getVendorTypeCode().equals(vendorType)) {
51 continue;
52 }
53 defaultAddress = vendorService.getVendorDefaultAddress(vendor.getVendorAddresses(), vendor.getVendorHeader().getVendorType().getAddressType().getVendorAddressTypeCode(), "");
54 if (defaultAddress != null ) {
55 vendor.setDefaultAddressLine1(defaultAddress.getVendorLine1Address());
56 vendor.setDefaultAddressCity(defaultAddress.getVendorCityName());
57 vendor.setDefaultAddressStateCode(defaultAddress.getVendorStateCode());
58 vendor.setDefaultAddressCountryCode(defaultAddress.getVendorCountryCode());
59 }
60 filteredVendorList.add(vendor);
61 }
62 return filteredVendorList;
63 }
64
65
66
67
68
69 public VendorExcludeService getVendorExcludeService() {
70 return vendorExcludeService;
71 }
72
73
74
75
76
77 public void setVendorExcludeService(VendorExcludeService vendorExcludeService) {
78 this.vendorExcludeService = vendorExcludeService;
79 }
80
81
82
83
84
85 public VendorService getVendorService() {
86 return vendorService;
87 }
88
89
90
91
92
93 public void setVendorService(VendorService vendorService) {
94 this.vendorService = vendorService;
95 }
96 }