001package org.kuali.ole.select.keyvalue; 002 003import org.kuali.ole.OLEConstants; 004import org.kuali.rice.core.api.util.ConcreteKeyValue; 005import org.kuali.rice.core.api.util.KeyValue; 006import org.kuali.rice.kim.api.identity.Person; 007import org.kuali.rice.kim.api.services.KimApiServiceLocator; 008import org.kuali.rice.kim.impl.identity.PersonServiceImpl; 009import org.kuali.rice.kim.service.KIMServiceLocatorInternal; 010import org.kuali.rice.krad.keyvalues.KeyValuesBase; 011 012import java.util.ArrayList; 013import java.util.HashMap; 014import java.util.List; 015import java.util.Map; 016 017/** 018 * OleAssigneeKeyValues is the value finder class for the Owner/Assignee in the License Request Document 019 */ 020public class OleAssigneeKeyValues extends KeyValuesBase { 021 private boolean blankOption; 022 023 /** 024 * Gets the blankOption attribute. 025 * 026 * @return Returns the blankOption 027 */ 028 public boolean isBlankOption() { 029 return this.blankOption; 030 } 031 032 /** 033 * Sets the blankOption attribute value. 034 * 035 * @param blankOption The blankOption to set. 036 */ 037 public void setBlankOption(boolean blankOption) { 038 this.blankOption = blankOption; 039 } 040 041 /** 042 * Gets the keyValues attribute. 043 * 044 * @return Returns the keyValues 045 */ 046 @Override 047 public List getKeyValues() { 048 List<KeyValue> keyValues = new ArrayList<KeyValue>(); 049 keyValues.add(new ConcreteKeyValue("", "")); 050 Map<String, String> roleSearchCriteria = new HashMap<String, String>(); 051 roleSearchCriteria.put("lookupRoleNamespaceCode", OLEConstants.OleLicenseRequest.LICENSE_NMSPACE); 052 roleSearchCriteria.put("lookupRoleName", OLEConstants.OleLicenseRequest.LICENSE_ASSIGNEE_ROLE); 053 PersonServiceImpl personServiceImpl = (PersonServiceImpl) KIMServiceLocatorInternal.getService(KimApiServiceLocator.KIM_PERSON_SERVICE); 054 List<Person> persons = personServiceImpl.findPeople(roleSearchCriteria); 055 for (Person person : persons) { 056 keyValues.add(new ConcreteKeyValue(person.getPrincipalId(), person.getPrincipalName())); 057 } 058 return keyValues; 059 } 060 061} 062