Coverage Report - org.kuali.rice.kew.api.document.attribute.WorkflowAttributeValidationError
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkflowAttributeValidationError
0%
0/16
0%
0/4
1.8
WorkflowAttributeValidationError$Constants
0%
0/1
N/A
1.8
WorkflowAttributeValidationError$Elements
0%
0/1
N/A
1.8
 
 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.document.attribute;
 17  
 
 18  
 import java.util.Collection;
 19  
 
 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  
 
 27  
 import org.apache.commons.lang.StringUtils;
 28  
 import org.kuali.rice.core.api.CoreConstants;
 29  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 30  
 import org.w3c.dom.Element;
 31  
 
 32  
 /**
 33  
  * Defines a validation error generated from some portion of the workflow system.
 34  
  *
 35  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 36  
  */
 37  
 @XmlRootElement(name = WorkflowAttributeValidationError.Constants.ROOT_ELEMENT_NAME)
 38  
 @XmlAccessorType(XmlAccessType.NONE)
 39  
 @XmlType(name = WorkflowAttributeValidationError.Constants.TYPE_NAME, propOrder = {
 40  
         WorkflowAttributeValidationError.Elements.KEY,
 41  
         WorkflowAttributeValidationError.Elements.MESSAGE,
 42  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 43  
 })
 44  
 public final class WorkflowAttributeValidationError extends AbstractDataTransferObject {
 45  
 
 46  
     private static final long serialVersionUID = 3323649177455266977L;
 47  
 
 48  
     @XmlElement(name = Elements.KEY, required = true)
 49  
     private final String key;
 50  
     
 51  
     @XmlElement(name = Elements.MESSAGE, required = true)
 52  
     private final String message;
 53  
     
 54  0
     @SuppressWarnings("unused")
 55  
     @XmlAnyElement
 56  
     private final Collection<Element> _futureElements = null;
 57  
 
 58  
     /**
 59  
      * Private constructor used only by JAXB.
 60  
      */
 61  0
     private WorkflowAttributeValidationError() {
 62  0
             this.key = null;
 63  0
             this.message = null;
 64  0
     }
 65  
     
 66  0
     private WorkflowAttributeValidationError(String key, String message) {
 67  0
         if (StringUtils.isBlank(key)) {
 68  0
             throw new IllegalArgumentException("key was null or blank");
 69  
         }
 70  0
         if (StringUtils.isBlank(message)) {
 71  0
             throw new IllegalArgumentException("message was null or blank");
 72  
         }
 73  0
         this.key = key;
 74  0
         this.message = message;
 75  0
     }
 76  
 
 77  
     /**
 78  
      * Constructs a new validation error with the given error key and message values.  Both the key and the message
 79  
      * must be non-null and non-blank values
 80  
      *
 81  
      * @param key the key of the validation error
 82  
      * @param message the message associated with the validation error
 83  
      *
 84  
      * @return an instance of a {@code WorkflowValidationError} containing the given key and message
 85  
      *
 86  
      * @throws IllegalArgumentException if either key or message is a null or blank value
 87  
      */
 88  
     public static WorkflowAttributeValidationError create(String key, String message) {
 89  0
         return new WorkflowAttributeValidationError(key, message);
 90  
     }
 91  
 
 92  
     /**
 93  
      * Returns the key this validation error.
 94  
      *
 95  
      * @return the key of this validation error
 96  
      */
 97  
     public String getKey() {
 98  0
         return key;
 99  
     }
 100  
 
 101  
     /**
 102  
      * Returns the message for this validation error.
 103  
      *
 104  
      * @return the messate for this validation error
 105  
      */
 106  
     public String getMessage() {
 107  0
         return message;
 108  
     }
 109  
 
 110  
     /**
 111  
      * Defines some internal constants used on this class.
 112  
      */
 113  0
     static class Constants {
 114  
         final static String ROOT_ELEMENT_NAME = "workflowAttributeValidationError";
 115  
         final static String TYPE_NAME = "WorkflowAttributeValidationErrorType";
 116  
     }
 117  
 
 118  
     /**
 119  
      * A private class which exposes constants which define the XML element names to use when this
 120  
      * object is marshalled to XML.
 121  
      */
 122  0
     static class Elements {
 123  
         final static String KEY = "key";
 124  
         final static String MESSAGE = "message";
 125  
     }
 126  
     
 127  
 }