Coverage Report - org.kuali.rice.krms.impl.repository.RuleTypeValuesFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleTypeValuesFinder
0%
0/11
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.kuali.rice.core.api.util.ConcreteKeyValue;
 19  
 import org.kuali.rice.core.api.util.KeyValue;
 20  
 import org.kuali.rice.krad.keyvalues.KeyValuesBase;
 21  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 22  
 
 23  
 import java.util.ArrayList;
 24  
 import java.util.Collection;
 25  
 import java.util.List;
 26  
 
 27  
 /**
 28  
  * This class returns all rule types of rules.
 29  
  */
 30  0
 public class RuleTypeValuesFinder extends KeyValuesBase {
 31  
 
 32  
     private boolean blankOption;
 33  
 
 34  
     @Override
 35  
         public List<KeyValue> getKeyValues() {
 36  0
         List<KeyValue> keyValues = new ArrayList<KeyValue>();
 37  
 
 38  0
         if(blankOption){
 39  0
             keyValues.add(new ConcreteKeyValue("", ""));
 40  
         }
 41  
 
 42  
         // TODO: Only select the rules for the specific context of the agenda
 43  
         // Map<String, String> fieldValues = new HashMap<String, String>();
 44  
         // fieldValues.put(KrmsImplConstants.PropertyNames.Context.CONTEXT_ID, form.getAgenda().getContextId);
 45  
         // Collection<ContextValidRuleBo> contextValidRules = KRADServiceLocator.getBusinessObjectService().findMatching(ContextValidRuleBo.class, fieldValues);
 46  0
         Collection<ContextValidRuleBo> contextValidRules = KRADServiceLocator.getBusinessObjectService().findAll(ContextValidRuleBo.class);
 47  0
         for (ContextValidRuleBo contextValidRule : contextValidRules) {
 48  0
             keyValues.add(new ConcreteKeyValue(contextValidRule.getRuleType().getId(), contextValidRule.getRuleType().getName()));
 49  
         }
 50  0
         return keyValues;
 51  
     }
 52  
 
 53  
     /**
 54  
      * @return the blankOption
 55  
      */
 56  
     public boolean isBlankOption() {
 57  0
         return this.blankOption;
 58  
     }
 59  
 
 60  
     /**
 61  
      * @param blankOption the blankOption to set
 62  
      */
 63  
     public void setBlankOption(boolean blankOption) {
 64  0
         this.blankOption = blankOption;
 65  0
     }
 66  
 
 67  
 }