1 package org.kuali.ole.license.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.*;
13
14
15
16
17 public class OleAssigneeKeyValues extends KeyValuesBase {
18 private boolean blankOption;
19
20
21
22
23
24 public boolean isBlankOption() {
25 return this.blankOption;
26 }
27
28
29
30
31
32 public void setBlankOption(boolean blankOption) {
33 this.blankOption = blankOption;
34 }
35
36
37
38
39
40 @Override
41 public List getKeyValues() {
42 List<KeyValue> keyValues = new ArrayList<KeyValue>();
43 keyValues.add(new ConcreteKeyValue("", ""));
44 Map<String,String> roleSearchCriteria = new HashMap<String, String>();
45 roleSearchCriteria.put("lookupRoleNamespaceCode", OLEConstants.OleLicenseRequest.LICENSE_NMSPACE);
46 roleSearchCriteria.put("lookupRoleName", OLEConstants.OleLicenseRequest.LICENSE_ASSIGNEE_ROLE);
47 PersonServiceImpl personServiceImpl = (PersonServiceImpl) KIMServiceLocatorInternal.getService(KimApiServiceLocator.KIM_PERSON_SERVICE);
48 List<Person> persons = personServiceImpl.findPeople(roleSearchCriteria);
49 for(Person person : persons){
50 keyValues.add(new ConcreteKeyValue(person.getPrincipalId(),person.getPrincipalName()));
51 }
52 return keyValues;
53 }
54
55 }
56