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.ArrayList;
19 import java.util.Collection;
20 import java.util.HashMap;
21 import java.util.Map;
22 import java.util.Set;
23
24 import org.kuali.rice.kns.bo.BusinessObject;
25 import org.kuali.rice.kns.bo.PersistableBusinessObject;
26 import org.kuali.rice.kns.bo.SelectedObjectIds;
27 import org.kuali.rice.kns.exception.AuthorizationException;
28 import org.kuali.rice.kns.service.BusinessObjectService;
29 import org.kuali.rice.kns.util.KNSPropertyConstants;
30
31
32
33
34
35
36
37 public class PersistableBusinessObjectLookupResultsSupportStrategyImpl
38 implements LookupResultsSupportStrategyService {
39
40 private BusinessObjectService businessObjectService;
41
42
43
44
45
46
47 public String getLookupIdForBusinessObject(BusinessObject businessObject) {
48 PersistableBusinessObject pbo = (PersistableBusinessObject)businessObject;
49 return pbo.getObjectId();
50 }
51
52
53
54
55
56
57 public <T extends BusinessObject> Collection<T> retrieveSelectedResultBOs(Class<T> boClass, Set<String> lookupIds)
58 throws Exception {
59
60 Map<String, Collection<String>> queryCriteria = new HashMap<String, Collection<String>>();
61 queryCriteria.put(KNSPropertyConstants.OBJECT_ID, lookupIds);
62 return getBusinessObjectService().findMatching(boClass, queryCriteria);
63 }
64
65
66
67
68
69
70 public boolean qualifiesForStrategy(Class<? extends BusinessObject> boClass) {
71 return PersistableBusinessObject.class.isAssignableFrom(boClass);
72 }
73
74
75
76
77 public BusinessObjectService getBusinessObjectService() {
78 return this.businessObjectService;
79 }
80
81
82
83
84 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
85 this.businessObjectService = businessObjectService;
86 }
87 }