Coverage Report - org.kuali.rice.kew.rule.MyRules
 
Classes in this File Line Coverage Branch Coverage Complexity
MyRules
0%
0/34
0%
0/10
2
 
 1  
 /*
 2  
  * Copyright 2005-2007 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.kuali.rice.kew.rule;
 18  
 
 19  
 import java.io.Serializable;
 20  
 import java.util.ArrayList;
 21  
 import java.util.Iterator;
 22  
 import java.util.List;
 23  
 
 24  
 /**
 25  
  * A collection of rules uses by the web tier for rendering and interacting
 26  
  * with the rules GUI.
 27  
  *
 28  
  * @see RuleBaseValues
 29  
  *
 30  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 31  
  */
 32  
 public class MyRules implements Serializable {
 33  
 
 34  
 
 35  
         private static final long serialVersionUID = 9178574188141418571L;
 36  
         private List rules;
 37  
 
 38  0
     public MyRules() {
 39  0
         rules = new ArrayList();
 40  0
     }
 41  
 
 42  
     public void addRule(RuleBaseValues rule, Integer counter) {
 43  0
         boolean alreadyAdded = false;
 44  0
         int location = 0;
 45  0
         for (Iterator ruleIter = getRules().iterator(); ruleIter.hasNext();) {
 46  0
             RuleBaseValues ruleRow = (RuleBaseValues) ruleIter.next();
 47  
 
 48  0
             if (counter != null && counter.intValue() == location) {
 49  0
                 ruleRow.setActiveInd(rule.getActiveInd());
 50  0
                 ruleRow.setCurrentInd(rule.getCurrentInd());
 51  0
                 ruleRow.setVersionNumber(rule.getVersionNumber());
 52  0
                 ruleRow.setDescription(rule.getDescription());
 53  0
                 ruleRow.setForceAction(rule.getForceAction());
 54  0
                 ruleRow.setDocTypeName(rule.getDocTypeName());
 55  0
                 ruleRow.setFromDate(rule.getFromDate());
 56  0
                 ruleRow.setToDate(rule.getToDate());
 57  0
                 ruleRow.setRuleTemplate(rule.getRuleTemplate());
 58  0
                 ruleRow.setVersionNbr(rule.getVersionNbr());
 59  0
                 ruleRow.setResponsibilities(rule.getResponsibilities());
 60  0
                 ruleRow.setRuleExtensions(rule.getRuleExtensions());
 61  
                 
 62  0
                 alreadyAdded = true;
 63  
             }
 64  0
             location++;
 65  0
         }
 66  0
         if (!alreadyAdded) {
 67  0
             getRules().add(rule);
 68  
         }
 69  0
     }
 70  
 
 71  
     public RuleBaseValues getRule(int index) {
 72  0
         while (getRules().size() <= index) {
 73  0
             RuleBaseValues rule = new RuleBaseValues();
 74  
 //            rule.setPreviousVersion(new RuleBaseValues());
 75  0
             getRules().add(rule);
 76  0
         }
 77  0
         return (RuleBaseValues) getRules().get(index);
 78  
     }
 79  
 
 80  
     public List getRules() {
 81  0
         return rules;
 82  
     }
 83  
 
 84  
     public void setRules(List rules) {
 85  0
         this.rules = rules;
 86  0
     }
 87  
 }