Coverage Report - org.kuali.rice.kew.api.rule.RuleExpression
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleExpression
0%
0/21
N/A
1.095
RuleExpression$1
N/A
N/A
1.095
RuleExpression$Builder
0%
0/29
0%
0/2
1.095
RuleExpression$Constants
0%
0/1
N/A
1.095
RuleExpression$Elements
0%
0/1
N/A
1.095
 
 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.kew.api.rule;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.Collection;
 20  
 import javax.xml.bind.annotation.XmlAccessType;
 21  
 import javax.xml.bind.annotation.XmlAccessorType;
 22  
 import javax.xml.bind.annotation.XmlAnyElement;
 23  
 import javax.xml.bind.annotation.XmlElement;
 24  
 import javax.xml.bind.annotation.XmlRootElement;
 25  
 import javax.xml.bind.annotation.XmlType;
 26  
 import org.kuali.rice.core.api.CoreConstants;
 27  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 28  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 29  
 import org.w3c.dom.Element;
 30  
 
 31  
 @XmlRootElement(name = RuleExpression.Constants.ROOT_ELEMENT_NAME)
 32  
 @XmlAccessorType(XmlAccessType.NONE)
 33  
 @XmlType(name = RuleExpression.Constants.TYPE_NAME, propOrder = {
 34  
     RuleExpression.Elements.TYPE,
 35  
     RuleExpression.Elements.EXPRESSION,
 36  
     RuleExpression.Elements.ID,
 37  
     CoreConstants.CommonElements.VERSION_NUMBER,
 38  
     CoreConstants.CommonElements.OBJECT_ID,
 39  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 40  
 })
 41  0
 public final class RuleExpression
 42  
     extends AbstractDataTransferObject
 43  
     implements RuleExpressionContract
 44  
 {
 45  
 
 46  
     @XmlElement(name = Elements.TYPE, required = false)
 47  
     private final String type;
 48  
     @XmlElement(name = Elements.EXPRESSION, required = false)
 49  
     private final String expression;
 50  
     @XmlElement(name = Elements.ID, required = false)
 51  
     private final String id;
 52  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
 53  
     private final Long versionNumber;
 54  
     @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
 55  
     private final String objectId;
 56  0
     @SuppressWarnings("unused")
 57  
     @XmlAnyElement
 58  
     private final Collection<Element> _futureElements = null;
 59  
 
 60  
     /**
 61  
      * Private constructor used only by JAXB.
 62  
      * 
 63  
      */
 64  0
     private RuleExpression() {
 65  0
         this.type = null;
 66  0
         this.expression = null;
 67  0
         this.id = null;
 68  0
         this.versionNumber = null;
 69  0
         this.objectId = null;
 70  0
     }
 71  
 
 72  0
     private RuleExpression(Builder builder) {
 73  0
         this.type = builder.getType();
 74  0
         this.expression = builder.getExpression();
 75  0
         this.id = builder.getId();
 76  0
         this.versionNumber = builder.getVersionNumber();
 77  0
         this.objectId = builder.getObjectId();
 78  0
     }
 79  
 
 80  
     @Override
 81  
     public String getType() {
 82  0
         return this.type;
 83  
     }
 84  
 
 85  
     @Override
 86  
     public String getExpression() {
 87  0
         return this.expression;
 88  
     }
 89  
 
 90  
     @Override
 91  
     public String getId() {
 92  0
         return this.id;
 93  
     }
 94  
 
 95  
     @Override
 96  
     public Long getVersionNumber() {
 97  0
         return this.versionNumber;
 98  
     }
 99  
 
 100  
     @Override
 101  
     public String getObjectId() {
 102  0
         return this.objectId;
 103  
     }
 104  
 
 105  
 
 106  
     /**
 107  
      * A builder which can be used to construct {@link RuleExpression} instances.  Enforces the constraints of the {@link RuleExpressionContract}.
 108  
      * 
 109  
      */
 110  0
     public final static class Builder
 111  
         implements Serializable, ModelBuilder, RuleExpressionContract
 112  
     {
 113  
 
 114  
         private String type;
 115  
         private String expression;
 116  
         private String id;
 117  
         private Long versionNumber;
 118  
         private String objectId;
 119  
 
 120  0
         private Builder() {
 121  
             // TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods
 122  0
         }
 123  
 
 124  
         public static Builder create() {
 125  
             // TODO modify as needed to pass any required values and add them to the signature of the 'create' method
 126  0
             return new Builder();
 127  
         }
 128  
 
 129  
         public static Builder create(RuleExpressionContract contract) {
 130  0
             if (contract == null) {
 131  0
                 throw new IllegalArgumentException("contract was null");
 132  
             }
 133  
             // TODO if create() is modified to accept required parameters, this will need to be modified
 134  0
             Builder builder = create();
 135  0
             builder.setType(contract.getType());
 136  0
             builder.setExpression(contract.getExpression());
 137  0
             builder.setId(contract.getId());
 138  0
             builder.setVersionNumber(contract.getVersionNumber());
 139  0
             builder.setObjectId(contract.getObjectId());
 140  0
             return builder;
 141  
         }
 142  
 
 143  
         public RuleExpression build() {
 144  0
             return new RuleExpression(this);
 145  
         }
 146  
 
 147  
         @Override
 148  
         public String getType() {
 149  0
             return this.type;
 150  
         }
 151  
 
 152  
         @Override
 153  
         public String getExpression() {
 154  0
             return this.expression;
 155  
         }
 156  
 
 157  
         @Override
 158  
         public String getId() {
 159  0
             return this.id;
 160  
         }
 161  
 
 162  
         @Override
 163  
         public Long getVersionNumber() {
 164  0
             return this.versionNumber;
 165  
         }
 166  
 
 167  
         @Override
 168  
         public String getObjectId() {
 169  0
             return this.objectId;
 170  
         }
 171  
 
 172  
         public void setType(String type) {
 173  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 174  0
             this.type = type;
 175  0
         }
 176  
 
 177  
         public void setExpression(String expression) {
 178  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 179  0
             this.expression = expression;
 180  0
         }
 181  
 
 182  
         public void setId(String id) {
 183  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 184  0
             this.id = id;
 185  0
         }
 186  
 
 187  
         public void setVersionNumber(Long versionNumber) {
 188  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 189  0
             this.versionNumber = versionNumber;
 190  0
         }
 191  
 
 192  
         public void setObjectId(String objectId) {
 193  
             // TODO add validation of input value if required and throw IllegalArgumentException if needed
 194  0
             this.objectId = objectId;
 195  0
         }
 196  
 
 197  
     }
 198  
 
 199  
 
 200  
     /**
 201  
      * Defines some internal constants used on this class.
 202  
      * 
 203  
      */
 204  0
     static class Constants {
 205  
 
 206  
         final static String ROOT_ELEMENT_NAME = "ruleExpression";
 207  
         final static String TYPE_NAME = "RuleExpressionType";
 208  
 
 209  
     }
 210  
 
 211  
 
 212  
     /**
 213  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 214  
      * 
 215  
      */
 216  0
     static class Elements {
 217  
 
 218  
         final static String TYPE = "type";
 219  
         final static String EXPRESSION = "expression";
 220  
         final static String ID = "id";
 221  
 
 222  
     }
 223  
 
 224  
 }