1 package org.kuali.ole.select.keyvalue;
2
3 import org.kuali.ole.OLEConstants;
4 import org.kuali.rice.core.api.util.ConcreteKeyValue;
5 import org.kuali.rice.core.api.util.KeyValue;
6 import org.kuali.rice.kim.api.identity.Person;
7 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
8 import org.kuali.rice.kim.impl.identity.PersonServiceImpl;
9 import org.kuali.rice.kim.service.KIMServiceLocatorInternal;
10 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
11
12 import java.util.ArrayList;
13 import java.util.HashMap;
14 import java.util.List;
15 import java.util.Map;
16
17
18
19
20 public class OleAssigneeKeyValues extends KeyValuesBase {
21 private boolean blankOption;
22
23
24
25
26
27
28 public boolean isBlankOption() {
29 return this.blankOption;
30 }
31
32
33
34
35
36
37 public void setBlankOption(boolean blankOption) {
38 this.blankOption = blankOption;
39 }
40
41
42
43
44
45
46 @Override
47 public List getKeyValues() {
48 List<KeyValue> keyValues = new ArrayList<KeyValue>();
49 keyValues.add(new ConcreteKeyValue("", ""));
50 Map<String, String> roleSearchCriteria = new HashMap<String, String>();
51 roleSearchCriteria.put("lookupRoleNamespaceCode", OLEConstants.OleLicenseRequest.LICENSE_NMSPACE);
52 roleSearchCriteria.put("lookupRoleName", OLEConstants.OleLicenseRequest.LICENSE_ASSIGNEE_ROLE);
53 PersonServiceImpl personServiceImpl = (PersonServiceImpl) KIMServiceLocatorInternal.getService(KimApiServiceLocator.KIM_PERSON_SERVICE);
54 List<Person> persons = personServiceImpl.findPeople(roleSearchCriteria);
55 for (Person person : persons) {
56 keyValues.add(new ConcreteKeyValue(person.getPrincipalId(), person.getPrincipalName()));
57 }
58 return keyValues;
59 }
60
61 }
62