Coverage Report - org.kuali.rice.kew.api.actionlist.DisplayParameters
 
Classes in this File Line Coverage Branch Coverage Complexity
DisplayParameters
0%
0/9
N/A
1.444
DisplayParameters$1
N/A
N/A
1.444
DisplayParameters$Builder
0%
0/15
0%
0/4
1.444
DisplayParameters$Constants
0%
0/1
N/A
1.444
DisplayParameters$Elements
0%
0/1
N/A
1.444
 
 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.actionlist;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.util.Collection;
 20  
 
 21  
 import javax.xml.bind.annotation.XmlAccessType;
 22  
 import javax.xml.bind.annotation.XmlAccessorType;
 23  
 import javax.xml.bind.annotation.XmlAnyElement;
 24  
 import javax.xml.bind.annotation.XmlElement;
 25  
 import javax.xml.bind.annotation.XmlRootElement;
 26  
 import javax.xml.bind.annotation.XmlType;
 27  
 
 28  
 import org.apache.commons.lang.StringUtils;
 29  
 import org.kuali.rice.core.api.CoreConstants;
 30  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 31  
 import org.kuali.rice.kew.api.repository.type.KewAttributeDefinitionContract;
 32  
 import org.w3c.dom.Element;
 33  
 
 34  
 /**
 35  
  * Represents the display params of the inline action list view.  This dictates 
 36  
  * how the inline frame will look height-wise.
 37  
  *
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  */
 40  
 @XmlRootElement(name = DisplayParameters.Constants.ROOT_ELEMENT_NAME)
 41  
 @XmlAccessorType(XmlAccessType.NONE)
 42  
 @XmlType(name = DisplayParameters.Constants.TYPE_NAME, propOrder = {
 43  
         DisplayParameters.Elements.FRAME_HEIGHT,
 44  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 45  
 })
 46  0
 public final class DisplayParameters implements Serializable, DisplayParametersContract {
 47  
 
 48  
         private static final long serialVersionUID = 8859107918934290768L;
 49  
         
 50  
         @XmlElement(name = Elements.FRAME_HEIGHT, required = true)
 51  
         private final Integer frameHeight;
 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 DisplayParameters(){
 62  0
                 this.frameHeight = null;
 63  0
         }
 64  
         
 65  
         /**
 66  
      * Constructs a DisplayParameters from the given builder.  This constructor is private and should only
 67  
      * ever be invoked from the builder.
 68  
      * 
 69  
      * @param builder the Builder from which to construct the DisplayParameters
 70  
      */
 71  0
         private DisplayParameters(Builder builder){
 72  0
                 this.frameHeight = builder.getFrameHeight();
 73  0
         }
 74  
         
 75  
         @Override
 76  
         public Integer getFrameHeight() {
 77  0
                 return this.frameHeight;
 78  
         }
 79  
         
 80  
     /**
 81  
      * A builder which can be used to construct {@link DisplayParameters} instances.  Enforces the constraints of the {@link DocumentContentContract}.
 82  
      */
 83  0
     public final static class Builder implements Serializable, ModelBuilder, DisplayParametersContract {
 84  
 
 85  
         private static final long serialVersionUID = 2709781019428490297L;
 86  
 
 87  
         private Integer frameHeight;
 88  
         
 89  
         /**
 90  
          * Private constructor for creating a builder with all of it's required attributes.
 91  
          */
 92  0
         private Builder(Integer frameHeight){
 93  0
                 setFrameHeight(frameHeight);
 94  0
         }
 95  
     
 96  
         public static Builder create(Integer frameHeight){
 97  0
                 return new Builder(frameHeight);
 98  
         }
 99  
         
 100  
         /**
 101  
          * Creates a builder by populating it with data from the given {@linkDisplayParametersContract}.
 102  
          * 
 103  
          * @param contract the contract from which to populate this builder
 104  
          * @return an instance of the builder populated with data from the contract
 105  
          */
 106  
         public static Builder create(DisplayParametersContract contract){
 107  0
                  if (contract == null) {
 108  0
                  throw new IllegalArgumentException("contract was null");
 109  
              }
 110  0
              Builder builder = create(contract.getFrameHeight());
 111  0
              return builder;
 112  
         }
 113  
         
 114  
         /**
 115  
          * Builds an instance of a DisplayParameters based on the current state of the builder.
 116  
          * 
 117  
          * @return the fully-constructed CampusType
 118  
          */
 119  
         @Override
 120  
         public DisplayParameters build() {
 121  0
             return new DisplayParameters(this);
 122  
         }
 123  
         
 124  
         @Override
 125  
         public Integer getFrameHeight() {
 126  0
             return this.frameHeight;
 127  
         }
 128  
         
 129  
         public void setFrameHeight(Integer frameHeight){
 130  0
             if (frameHeight == null) {
 131  0
                 throw new IllegalArgumentException("frameHeight is null");
 132  
             }
 133  0
                 this.frameHeight = frameHeight;
 134  0
         }
 135  
     }
 136  
     
 137  
     /**
 138  
      * Defines some internal constants used on this class.
 139  
      */
 140  0
     static class Constants {
 141  
 
 142  
         final static String ROOT_ELEMENT_NAME = "displayParameters";
 143  
         final static String TYPE_NAME = "DisplayParametersType";
 144  
     }
 145  
     /**
 146  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 147  
      */
 148  0
     static class Elements {
 149  
 
 150  
         final static String FRAME_HEIGHT = "frameHeight";
 151  
     }
 152  
 }