Coverage report

  %line %branch
org.apache.turbine.services.intake.xmlmodel.Rule
0% 
0% 

 1  
 package org.apache.turbine.services.intake.xmlmodel;
 2  
 
 3  
 /*
 4  
  * Copyright 2001-2005 The Apache Software Foundation.
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License")
 7  
  * you may not use this file except in compliance with the License.
 8  
  * You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 import java.io.Serializable;
 20  
 
 21  
 import org.apache.turbine.services.intake.validator.Constraint;
 22  
 
 23  
 import org.xml.sax.Attributes;
 24  
 
 25  
 /**
 26  
  * A Class for holding data about a constraint on a property.
 27  
  *
 28  
  * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
 29  
  * @version $Id: Rule.java 278822 2005-09-05 19:53:05Z henning $
 30  
  */
 31  
 public class Rule
 32  
         implements Constraint, Serializable
 33  
 {
 34  
     /** Serial Version UID */
 35  
     private static final long serialVersionUID = 3662886424992562964L;
 36  
 
 37  
     private String name;
 38  
     private String value;
 39  
     private String message;
 40  
     private XmlField parent;
 41  
 
 42  
     /**
 43  
      * Default Constructor
 44  
      */
 45  
     public Rule()
 46  0
     {
 47  0
     }
 48  
 
 49  
     /**
 50  
      * Imports a column from an XML specification
 51  
      */
 52  
     public void loadFromXML(Attributes attrib)
 53  
     {
 54  0
         setName(attrib.getValue("name"));
 55  0
         setValue(attrib.getValue("value"));
 56  0
     }
 57  
 
 58  
     /**
 59  
      * Set the name of the parameter
 60  
      */
 61  
     public void setName(String newName)
 62  
     {
 63  0
         name = newName;
 64  0
     }
 65  
 
 66  
     /**
 67  
      * Get the name of the parameter
 68  
      */
 69  
     public String getName()
 70  
     {
 71  0
         return name;
 72  
     }
 73  
 
 74  
     /**
 75  
      * Set the value of the parameter
 76  
      */
 77  
     public void setValue(String newValue)
 78  
     {
 79  0
         value = newValue;
 80  0
     }
 81  
 
 82  
     /**
 83  
      * Get the value of the parameter
 84  
      */
 85  
     public String getValue()
 86  
     {
 87  0
         return value;
 88  
     }
 89  
 
 90  
     /**
 91  
      * Set the error message
 92  
      */
 93  
     public void setMessage(String newMessage)
 94  
     {
 95  0
         message = newMessage;
 96  0
     }
 97  
 
 98  
     /**
 99  
      * Get the error message
 100  
      */
 101  
     public String getMessage()
 102  
     {
 103  0
         return message;
 104  
     }
 105  
 
 106  
     /**
 107  
      * Set the parent Field of the rule
 108  
      */
 109  
     public void setField(XmlField parent)
 110  
     {
 111  0
         this.parent = parent;
 112  0
     }
 113  
 
 114  
     /**
 115  
      * Get the parent Field of the rule
 116  
      */
 117  
     public XmlField getField()
 118  
     {
 119  0
         return parent;
 120  
     }
 121  
 
 122  
     /**
 123  
      * String representation of the column. This
 124  
      * is an xml representation.
 125  
      */
 126  
     public String toString()
 127  
     {
 128  0
         StringBuffer result = new StringBuffer(100);
 129  
 
 130  0
         result.append("<rule name=\"" + name + "\"")
 131  
                 .append(" value=\"" + value + "\"");
 132  
 
 133  0
         if (message == null)
 134  
         {
 135  0
             result.append(" />\n");
 136  
         }
 137  
         else
 138  
         {
 139  0
             result.append(">")
 140  
                     .append(message)
 141  
                     .append("</rule>\n");
 142  
         }
 143  
 
 144  0
         return result.toString();
 145  
     }
 146  
 
 147  
 }
 148  
 
 149  
 
 150  
 

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.