1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.lookup;
17
18 import java.util.Collection;
19 import java.util.HashMap;
20 import java.util.Map;
21 import java.util.Set;
22
23 import org.kuali.rice.kns.lookup.LookupResultsSupportStrategyService;
24 import org.kuali.rice.krad.bo.BusinessObject;
25 import org.kuali.rice.krad.bo.PersistableBusinessObject;
26 import org.kuali.rice.krad.service.BusinessObjectService;
27 import org.kuali.rice.krad.util.KRADPropertyConstants;
28
29
30
31
32
33
34
35 public class PersistableBusinessObjectLookupResultsSupportStrategyImpl
36 implements LookupResultsSupportStrategyService {
37
38 private BusinessObjectService businessObjectService;
39
40
41
42
43
44
45 public String getLookupIdForBusinessObject(BusinessObject businessObject) {
46 PersistableBusinessObject pbo = (PersistableBusinessObject)businessObject;
47 return pbo.getObjectId();
48 }
49
50
51
52
53
54
55 public <T extends BusinessObject> Collection<T> retrieveSelectedResultBOs(Class<T> boClass, Set<String> lookupIds)
56 throws Exception {
57
58 Map<String, Collection<String>> queryCriteria = new HashMap<String, Collection<String>>();
59 queryCriteria.put(KRADPropertyConstants.OBJECT_ID, lookupIds);
60 return getBusinessObjectService().findMatching(boClass, queryCriteria);
61 }
62
63
64
65
66
67
68 public boolean qualifiesForStrategy(Class<? extends BusinessObject> boClass) {
69 return PersistableBusinessObject.class.isAssignableFrom(boClass);
70 }
71
72
73
74
75 public BusinessObjectService getBusinessObjectService() {
76 return this.businessObjectService;
77 }
78
79
80
81
82 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
83 this.businessObjectService = businessObjectService;
84 }
85 }