Coverage Report - org.kuali.rice.kns.lookup.keyvalues.KimAttributeValuesFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
KimAttributeValuesFinder
0%
0/17
0%
0/4
1.6
 
 1  
 /*
 2  
  * Copyright 2007-2009 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
          * @see org.kuali.rice.kns.lookup.keyvalues.KeyValuesFinder#getKeyValues()
 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  
          * @return the kimAttributeName
 59  
          */
 60  
         public String getKimAttributeName() {
 61  0
                 return this.kimAttributeName;
 62  
         }
 63  
 
 64  
         /**
 65  
          * @param kimAttributeName the kimAttributeName to set
 66  
          */
 67  
         public void setKimAttributeName(String kimAttributeName) {
 68  0
                 this.kimAttributeName = kimAttributeName;
 69  0
         }
 70  
 
 71  
         /**
 72  
          * @return the kimTypeId
 73  
          */
 74  
         public String getKimTypeId() {
 75  0
                 return this.kimTypeId;
 76  
         }
 77  
 
 78  
         /**
 79  
          * @param kimTypeId the kimTypeId to set
 80  
          */
 81  
         public void setKimTypeId(String kimTypeId) {
 82  0
                 this.kimTypeId = kimTypeId;
 83  0
         }
 84  
 
 85  
 }