Coverage Report - org.kuali.rice.krms.impl.repository.ContextTypeValuesFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
ContextTypeValuesFinder
0%
0/14
0%
0/4
1.667
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.krms.impl.repository;
 17  
 
 18  
 import org.apache.cxf.common.util.StringUtils;
 19  
 import org.kuali.rice.core.api.util.ConcreteKeyValue;
 20  
 import org.kuali.rice.core.api.util.KeyValue;
 21  
 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
 22  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 23  
 import org.kuali.rice.krad.service.KeyValuesService;
 24  
 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
 25  
 import org.kuali.rice.krad.uif.view.ViewModel;
 26  
 import org.kuali.rice.krad.web.form.MaintenanceForm;
 27  
 import org.kuali.rice.krad.web.form.UifFormBase;
 28  
 import org.kuali.rice.krms.impl.ui.AgendaEditor;
 29  
 
 30  
 import java.util.ArrayList;
 31  
 import java.util.Collection;
 32  
 import java.util.Collections;
 33  
 import java.util.HashMap;
 34  
 import java.util.List;
 35  
 import java.util.Map;
 36  
 
 37  
 /**
 38  
  * Helper class that returns all valid types for contexts.
 39  
  */
 40  0
 public class ContextTypeValuesFinder extends UifKeyValuesFinderBase {
 41  
 
 42  
     private boolean blankOption;
 43  
 
 44  
     /**
 45  
      * @return the blankOption
 46  
      */
 47  
     public boolean isBlankOption() {
 48  0
         return this.blankOption;
 49  
     }
 50  
 
 51  
     /**
 52  
      * @param blankOption the blankOption to set
 53  
      */
 54  
     public void setBlankOption(boolean blankOption) {
 55  0
         this.blankOption = blankOption;
 56  0
     }
 57  
 
 58  
     @Override
 59  
     public List<KeyValue> getKeyValues(ViewModel model) {
 60  0
         List<KeyValue> keyValues = new ArrayList<KeyValue>();
 61  
 
 62  0
         if(blankOption){
 63  0
             keyValues.add(new ConcreteKeyValue("", ""));
 64  
         }
 65  
 
 66  
         // ToDo: Currently we hardcoded any types named "CONTEXT" to be valid with contexts.
 67  0
         KeyValuesService boService = KRADServiceLocator.getKeyValuesService();
 68  0
         Map<String,Object> fieldValues = new HashMap<String, Object>();
 69  0
         fieldValues.put("name", "CONTEXT");
 70  0
         Collection<KrmsTypeBo> types = boService.findMatching(KrmsTypeBo.class, fieldValues);
 71  
 
 72  0
         for (KrmsTypeBo type : types) {
 73  0
             keyValues.add(new ConcreteKeyValue(type.getId(), type.getName() + " [" + type.getNamespace() + "]"));
 74  
         }
 75  
 
 76  0
         return keyValues;
 77  
     }
 78  
 }