1 package org.kuali.ole.vnd.businessobject.lookup;
2
3 import org.kuali.ole.sys.OLEConstants;
4 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
5 import org.kuali.rice.kns.web.struts.form.LookupForm;
6 import org.kuali.rice.kns.web.ui.ResultRow;
7 import org.kuali.rice.krad.bo.BusinessObject;
8 import org.kuali.rice.krad.lookup.LookupableImpl;
9 import org.kuali.rice.krad.util.GlobalVariables;
10 import org.kuali.rice.krad.util.KRADConstants;
11
12 import java.util.Collection;
13 import java.util.HashMap;
14 import java.util.List;
15 import java.util.Map;
16
17
18
19
20
21
22
23
24 public class VendorCustomerNumberLookupableImpl extends LookupableImpl {
25
26 @Override
27 public Collection<?> performSearch(org.kuali.rice.krad.web.form.LookupForm form, Map<String, String> searchCriteria, boolean bounded) {
28 List searchResults = (List) getLookupService().findCollectionBySearchHelper(getDataObjectClass(), searchCriteria, bounded);
29 if(searchResults.size() == 0){
30 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, org.kuali.ole.OLEConstants.NO_RECORD_FOUND);
31 }
32 return searchResults;
33 }
34
35 @Override
36 public Map<String, String> performClear(org.kuali.rice.krad.web.form.LookupForm form, Map<String, String> searchCriteria) {
37 String vendorHeaderGeneratedIdentifier=searchCriteria.get(OLEConstants.VENDOR_HEADER_IDENTIFIER);
38 String vendorDetailAssignedIdentifier=searchCriteria.get(OLEConstants.VENDOR_DETAIL_IDENTIFIER);
39 super.performClear(form, searchCriteria);
40 Map<String, String> clearedSearchCriteria = new HashMap<String, String>();
41 for(Map.Entry<String,String> map:searchCriteria.entrySet()){
42 if(map.getKey() != null && map.getKey().equalsIgnoreCase(OLEConstants.VENDOR_HEADER_IDENTIFIER)){
43 clearedSearchCriteria.put(OLEConstants.VENDOR_HEADER_IDENTIFIER,vendorHeaderGeneratedIdentifier);
44 }
45 if(map.getKey() != null && map.getKey().equalsIgnoreCase(OLEConstants.VENDOR_DETAIL_IDENTIFIER)){
46 clearedSearchCriteria.put(OLEConstants.VENDOR_DETAIL_IDENTIFIER,vendorDetailAssignedIdentifier);
47 }
48 }
49 return clearedSearchCriteria;
50 }
51 }