Coverage Report - org.kuali.rice.krms.impl.repository.ActionTypeValuesFinder
 
Classes in this File Line Coverage Branch Coverage Complexity
ActionTypeValuesFinder
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.kuali.rice.core.api.util.ConcreteKeyValue;
 19  
 import org.kuali.rice.core.api.util.KeyValue;
 20  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 21  
 import org.kuali.rice.krad.uif.control.UifKeyValuesFinderBase;
 22  
 import org.kuali.rice.krad.uif.view.ViewModel;
 23  
 import org.kuali.rice.krad.web.form.MaintenanceForm;
 24  
 import org.kuali.rice.krms.impl.ui.AgendaEditor;
 25  
 import org.kuali.rice.krms.impl.util.KrmsImplConstants;
 26  
 
 27  
 import java.util.ArrayList;
 28  
 import java.util.Collection;
 29  
 import java.util.Collections;
 30  
 import java.util.List;
 31  
 import java.util.Map;
 32  
 
 33  
 /**
 34  
  * This class returns all action types of rules.
 35  
  */
 36  0
 public class ActionTypeValuesFinder extends UifKeyValuesFinderBase {
 37  
 
 38  
     private boolean blankOption;
 39  
 
 40  
     @Override
 41  
         public List<KeyValue> getKeyValues(ViewModel model) {
 42  0
         List<KeyValue> keyValues = new ArrayList<KeyValue>();
 43  
 
 44  0
         MaintenanceForm maintenanceForm = (MaintenanceForm) model;
 45  0
         AgendaEditor agendaEditor = ((AgendaEditor) maintenanceForm.getDocument().getNewMaintainableObject().getDataObject());
 46  
 
 47  0
         if(blankOption){
 48  0
             keyValues.add(new ConcreteKeyValue("", ""));
 49  
         }
 50  
 
 51  0
         Map<String, String> criteria = Collections.singletonMap(KrmsImplConstants.PropertyNames.Context.CONTEXT_ID,
 52  
                 agendaEditor.getAgenda().getContextId());
 53  0
         Collection<ContextValidActionBo> contextValidActions =
 54  
                 KRADServiceLocator.getBusinessObjectService().findMatchingOrderBy(
 55  
                         ContextValidActionBo.class, criteria, "actionType.name", true);
 56  0
         for (ContextValidActionBo contextValidAction : contextValidActions) {
 57  0
             keyValues.add(new ConcreteKeyValue(contextValidAction.getActionType().getId(), contextValidAction.getActionType().getName()));
 58  
         }
 59  0
         return keyValues;
 60  
     }
 61  
 
 62  
     /**
 63  
      * @return the blankOption
 64  
      */
 65  
     public boolean isBlankOption() {
 66  0
         return this.blankOption;
 67  
     }
 68  
 
 69  
     /**
 70  
      * @param blankOption the blankOption to set
 71  
      */
 72  
     public void setBlankOption(boolean blankOption) {
 73  0
         this.blankOption = blankOption;
 74  0
     }
 75  
 }