Coverage Report - org.kuali.rice.kew.api.document.attribute.AttributeFields
 
Classes in this File Line Coverage Branch Coverage Complexity
AttributeFields
0%
0/18
0%
0/6
2
AttributeFields$Constants
0%
0/1
N/A
2
AttributeFields$Elements
0%
0/1
N/A
2
 
 1  
 /*
 2  
  * Copyright 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/ecl1.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 org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.core.api.CoreConstants;
 20  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 21  
 import org.kuali.rice.core.api.uif.RemotableAttributeField;
 22  
 import org.kuali.rice.kew.api.action.ActionType;
 23  
 import org.w3c.dom.Element;
 24  
 
 25  
 import javax.xml.bind.annotation.XmlAccessType;
 26  
 import javax.xml.bind.annotation.XmlAccessorType;
 27  
 import javax.xml.bind.annotation.XmlAnyElement;
 28  
 import javax.xml.bind.annotation.XmlElement;
 29  
 import javax.xml.bind.annotation.XmlElementWrapper;
 30  
 import javax.xml.bind.annotation.XmlRootElement;
 31  
 import javax.xml.bind.annotation.XmlType;
 32  
 import java.util.ArrayList;
 33  
 import java.util.Collection;
 34  
 import java.util.Collections;
 35  
 import java.util.List;
 36  
 
 37  
 @XmlRootElement(name = AttributeFields.Constants.ROOT_ELEMENT_NAME)
 38  
 @XmlAccessorType(XmlAccessType.NONE)
 39  
 @XmlType(name = AttributeFields.Constants.TYPE_NAME, propOrder = {
 40  
     AttributeFields.Elements.ATTRIBUTE_NAME,
 41  
     AttributeFields.Elements.REMOTABLE_ATTRIBUTE_FIELDS,
 42  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 43  
 })
 44  
 public final class AttributeFields extends AbstractDataTransferObject {
 45  
 
 46  
         @XmlElement(name = Elements.ATTRIBUTE_NAME, required = true)
 47  
     private final String attributeName;
 48  
 
 49  
     @XmlElementWrapper(name = Elements.REMOTABLE_ATTRIBUTE_FIELDS, required = true)
 50  
     @XmlElement(name = Elements.REMOTABLE_ATTRIBUTE_FIELD, required = false)
 51  
     private final List<RemotableAttributeField> remotableAttributeFields;
 52  
 
 53  0
     @SuppressWarnings("unused")
 54  
     @XmlAnyElement
 55  
     private final Collection<Element> _futureElements = null;
 56  
 
 57  
     /**
 58  
      * Private constructor used only by JAXB.
 59  
      *
 60  
      */
 61  0
     private AttributeFields() {
 62  0
         this.attributeName = null;
 63  0
         this.remotableAttributeFields = null;
 64  0
     }
 65  
 
 66  0
     private AttributeFields(String attributeName, List<RemotableAttributeField> remotableAttributeFields) {
 67  0
         if (StringUtils.isBlank(attributeName)) {
 68  0
             throw new IllegalArgumentException("attributeName was blank or null");
 69  
         }
 70  0
         if (remotableAttributeFields == null) {
 71  0
             throw new IllegalArgumentException("attributeFields was blank or null");
 72  
         }
 73  0
         this.attributeName = attributeName;
 74  0
         this.remotableAttributeFields = Collections.unmodifiableList(new ArrayList<RemotableAttributeField>(remotableAttributeFields));
 75  0
     }
 76  
 
 77  
     public static AttributeFields create(String attributeName, List<RemotableAttributeField> attributeFields) {
 78  0
         if (attributeFields == null) {
 79  0
             attributeFields = Collections.emptyList();
 80  
         }
 81  0
         return new AttributeFields(attributeName, attributeFields);
 82  
     }
 83  
 
 84  
     public String getAttributeName() {
 85  0
         return attributeName;
 86  
     }
 87  
 
 88  
     public List<RemotableAttributeField> getRemotableAttributeFields() {
 89  0
         return remotableAttributeFields;
 90  
     }
 91  
 
 92  
     /**
 93  
      * Defines some internal constants used on this class.
 94  
      */
 95  0
     static class Constants {
 96  
         final static String ROOT_ELEMENT_NAME = "attributeFields";
 97  
         final static String TYPE_NAME = "AttributeFieldsType";
 98  
     }
 99  
 
 100  
 
 101  
     /**
 102  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 103  
      */
 104  0
     static class Elements {
 105  
         final static String ATTRIBUTE_NAME = "attributeName";
 106  
         final static String REMOTABLE_ATTRIBUTE_FIELDS = "remotableAttributeFields";
 107  
         final static String REMOTABLE_ATTRIBUTE_FIELD = "remotableAttributeField";
 108  
     }
 109  
 
 110  
 }