Coverage Report - org.kuali.rice.krms.framework.engine.BasicAgenda
 
Classes in this File Line Coverage Branch Coverage Complexity
BasicAgenda
58%
10/17
25%
2/8
3
 
 1  
 package org.kuali.rice.krms.framework.engine;
 2  
 
 3  
 import java.util.Map;
 4  
 
 5  
 import org.kuali.rice.krms.api.engine.ExecutionEnvironment;
 6  
 import org.kuali.rice.krms.api.repository.agenda.AgendaDefinition;
 7  
 
 8  
 public class BasicAgenda implements Agenda {
 9  
 
 10  
         private String eventName;
 11  
         private Map<String, String> qualifiers;
 12  
         private AgendaTree agendaTree;
 13  
         
 14  29
         public BasicAgenda(String eventName, Map<String, String> qualifiers, AgendaTree agendaTree) {
 15  29
                 this.eventName = eventName;
 16  29
                 this.qualifiers = qualifiers;
 17  29
                 this.agendaTree = agendaTree;
 18  29
         }
 19  
         
 20  
         @Override
 21  
         public void execute(ExecutionEnvironment environment) {
 22  29
                 agendaTree.execute(environment);
 23  29
         }
 24  
 
 25  
         @Override
 26  
         public boolean appliesTo(ExecutionEnvironment environment) {
 27  29
                 if (eventName.equals(environment.getSelectionCriteria().getEventName())) {
 28  29
                         for (String agendaQualifierName : qualifiers.keySet()) {
 29  
                             // ignore the eventName qualifier, we've already matched it
 30  0
                             if (agendaQualifierName.equals(AgendaDefinition.Constants.EVENT)) continue;
 31  
                             
 32  0
                                 String qualifierValue = qualifiers.get(agendaQualifierName);
 33  0
                                 String environmentQualifierValue = environment.getSelectionCriteria().getAgendaQualifiers().get(agendaQualifierName);
 34  0
                                 if (!qualifierValue.equals(environmentQualifierValue)) {
 35  0
                                         return false;
 36  
                                 }
 37  0
                         }
 38  
                 } else {
 39  0
                         return false;
 40  
                 }
 41  29
                 return true;
 42  
         }
 43  
 
 44  
 }