| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kns.lookup.keyvalues; |
| 17 | |
|
| 18 | |
import org.apache.log4j.Logger; |
| 19 | |
import org.kuali.rice.core.util.KeyValue; |
| 20 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
| 21 | |
import org.kuali.rice.kim.api.type.KimType; |
| 22 | |
import org.kuali.rice.kim.service.KIMServiceLocatorWeb; |
| 23 | |
import org.kuali.rice.kim.service.support.KimTypeService; |
| 24 | |
|
| 25 | |
import java.util.ArrayList; |
| 26 | |
import java.util.Collections; |
| 27 | |
import java.util.List; |
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | 0 | public class KimAttributeValuesFinder extends KeyValuesBase { |
| 33 | |
|
| 34 | 0 | private static final Logger LOG = Logger.getLogger( KimAttributeValuesFinder.class ); |
| 35 | |
|
| 36 | |
protected String kimTypeId; |
| 37 | |
protected String kimAttributeName; |
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
@Override |
| 43 | |
public List<KeyValue> getKeyValues() { |
| 44 | 0 | KimType kimType = KimApiServiceLocator.getKimTypeInfoService().getKimType(kimTypeId); |
| 45 | 0 | if ( kimType != null ) { |
| 46 | 0 | KimTypeService service = KIMServiceLocatorWeb.getKimTypeService(kimType); |
| 47 | 0 | if ( service != null ) { |
| 48 | 0 | return new ArrayList<KeyValue>(service.getAttributeValidValues(kimTypeId,kimAttributeName)); |
| 49 | |
} |
| 50 | 0 | LOG.error( "Unable to get type service " + kimType.getServiceName() ); |
| 51 | 0 | } else { |
| 52 | 0 | LOG.error( "Unable to obtain KIM type for kimTypeId=" + kimTypeId ); |
| 53 | |
} |
| 54 | 0 | return Collections.emptyList(); |
| 55 | |
} |
| 56 | |
|
| 57 | |
|
| 58 | |
|
| 59 | |
|
| 60 | |
public String getKimAttributeName() { |
| 61 | 0 | return this.kimAttributeName; |
| 62 | |
} |
| 63 | |
|
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
public void setKimAttributeName(String kimAttributeName) { |
| 68 | 0 | this.kimAttributeName = kimAttributeName; |
| 69 | 0 | } |
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
public String getKimTypeId() { |
| 75 | 0 | return this.kimTypeId; |
| 76 | |
} |
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
public void setKimTypeId(String kimTypeId) { |
| 82 | 0 | this.kimTypeId = kimTypeId; |
| 83 | 0 | } |
| 84 | |
|
| 85 | |
} |