1 package org.kuali.ole.select.lookup;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.ole.service.OleAgreementSearchService;
5 import org.kuali.rice.krad.lookup.LookupUtils;
6 import org.kuali.rice.krad.lookup.LookupableImpl;
7 import org.kuali.rice.krad.util.GlobalVariables;
8 import org.kuali.rice.krad.util.KRADConstants;
9 import org.kuali.rice.krad.web.form.LookupForm;
10
11 import java.util.Collection;
12 import java.util.Map;
13
14
15
16
17 public class OleAgreementSearchLookupableImpl extends LookupableImpl {
18
19 OleAgreementSearchService agreementSearchService = new OleAgreementSearchService();
20
21 @Override
22 public Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded) {
23 Collection<?> displayList;
24
25 LookupUtils.preprocessDateFields(searchCriteria);
26 displayList = agreementSearchService.getAgreementInformation(searchCriteria);
27
28
29 for (Object object : displayList) {
30 if (isResultReturnable(object)) {
31 form.setAtLeastOneRowReturnable(true);
32 }
33 }
34 if (displayList.size() == 0) {
35 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, OLEConstants.NO_RECORD_FOUND);
36 }
37 return displayList;
38 }
39 }