1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.lookup;
17
18 import org.apache.commons.collections.MapUtils;
19 import org.kuali.rice.kim.impl.KIMPropertyConstants;
20 import org.kuali.rice.kim.impl.group.GroupBo;
21 import org.kuali.rice.kim.impl.identity.principal.PrincipalBo;
22 import org.kuali.rice.kim.impl.role.RoleBo;
23 import org.kuali.rice.krad.lookup.LookupUtils;
24 import org.kuali.rice.krad.lookup.LookupableImpl;
25 import org.kuali.rice.krad.lookup.LookupForm;
26
27 import java.util.Collection;
28 import java.util.List;
29 import java.util.Map;
30
31
32
33
34 public class UIRoleMemberLookupableImpl extends LookupableImpl {
35
36 @Override
37 public Collection<?> performSearch(LookupForm form, Map<String, String> searchCriteria, boolean bounded) {
38
39 Map<String, String> nonBlankSearchCriteria = processSearchCriteria(form, searchCriteria);
40 List<String> wildcardAsLiteralSearchCriteria = identifyWildcardDisabledFields(form, nonBlankSearchCriteria);
41
42 Integer searchResultsLimit = null;
43
44 if (bounded) {
45 searchResultsLimit = LookupUtils.getSearchResultsLimit(getDataObjectClass(), form);
46 }
47
48 Class<?> dataObjectClass = null;
49
50 if ("P".equals(MapUtils.getString(searchCriteria, KIMPropertyConstants.KimMember.MEMBER_TYPE_CODE))) {
51 dataObjectClass = PrincipalBo.class;
52 } else if ("G".equals(MapUtils.getString(searchCriteria, KIMPropertyConstants.KimMember.MEMBER_TYPE_CODE))) {
53 dataObjectClass = GroupBo.class;
54 } else if ("R".equals(MapUtils.getString(searchCriteria, KIMPropertyConstants.KimMember.MEMBER_TYPE_CODE))) {
55 dataObjectClass = RoleBo.class;
56 }
57
58 return getLookupService().findCollectionBySearchHelper(dataObjectClass, nonBlankSearchCriteria,
59 wildcardAsLiteralSearchCriteria, !bounded, searchResultsLimit);
60 }
61 }