1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
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  
36  
37  
38  
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  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  	@SuppressWarnings("unused")
54      @XmlAnyElement
55      private final Collection<Element> _futureElements = null;
56  	
57  	
58  
59  
60  
61  	private DisplayParameters(){
62  		this.frameHeight = null;
63  	}
64  	
65  	
66  
67  
68  
69  
70  
71  	private DisplayParameters(Builder builder){
72  		this.frameHeight = builder.getFrameHeight();
73  	}
74  	
75  	@Override
76  	public Integer getFrameHeight() {
77  		return this.frameHeight;
78  	}
79  	
80      
81  
82  
83      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  
91  
92          private Builder(Integer frameHeight){
93          	setFrameHeight(frameHeight);
94          }
95      
96          public static Builder create(Integer frameHeight){
97          	return new Builder(frameHeight);
98          }
99          
100         
101 
102 
103 
104 
105 
106         public static Builder create(DisplayParametersContract contract){
107         	 if (contract == null) {
108                  throw new IllegalArgumentException("contract was null");
109              }
110              Builder builder = create(contract.getFrameHeight());
111              return builder;
112         }
113         
114         
115 
116 
117 
118 
119         @Override
120         public DisplayParameters build() {
121             return new DisplayParameters(this);
122         }
123         
124         @Override
125         public Integer getFrameHeight() {
126             return this.frameHeight;
127         }
128         
129         public void setFrameHeight(Integer frameHeight){
130             if (frameHeight == null) {
131                 throw new IllegalArgumentException("frameHeight is null");
132             }
133         	this.frameHeight = frameHeight;
134         }
135     }
136     
137     
138 
139 
140     static class Constants {
141 
142         final static String ROOT_ELEMENT_NAME = "displayParameters";
143         final static String TYPE_NAME = "DisplayParametersType";
144     }
145     
146 
147 
148     static class Elements {
149 
150         final static String FRAME_HEIGHT = "frameHeight";
151     }
152 }