View Javadoc
1   package org.kuali.ole.deliver.api;
2   
3   import org.apache.commons.lang.StringUtils;
4   import org.kuali.rice.core.api.CoreConstants;
5   import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
6   import org.kuali.rice.core.api.mo.ModelBuilder;
7   import org.kuali.rice.kim.api.KimConstants;
8   import org.w3c.dom.Element;
9   
10  import javax.xml.bind.annotation.*;
11  import java.io.Serializable;
12  import java.util.Collection;
13  
14  /**
15   * Created with IntelliJ IDEA.
16   * User: ?
17   * Date: 5/24/12
18   * Time: 8:26 PM
19   * To change this template use File | Settings | File Templates.
20   */
21  @XmlRootElement(name = OleStatisticalCategoryDefinition.Constants.ROOT_ELEMENT_NAME)
22  @XmlAccessorType(XmlAccessType.NONE)
23  @XmlType(name = OleStatisticalCategoryDefinition.Constants.TYPE_NAME, propOrder = {
24          OleStatisticalCategoryDefinition.Elements.OLE_STATISTICAL_CATEGORY_ID,
25          OleStatisticalCategoryDefinition.Elements.OLE_STATISTICAL_CATEGORY_CODE,
26          OleStatisticalCategoryDefinition.Elements.OLE_STATISTICAL_CATEGORY_NAME,
27          OleStatisticalCategoryDefinition.Elements.OLE_STATISTICAL_CATEGORY_DESC,
28          OleStatisticalCategoryDefinition.Elements.ACTIVE_INDICATOR,
29  
30          CoreConstants.CommonElements.VERSION_NUMBER,
31          //CoreConstants.CommonElements.OBJECT_ID,
32          CoreConstants.CommonElements.FUTURE_ELEMENTS
33  })
34  public final class OleStatisticalCategoryDefinition extends AbstractDataTransferObject implements org.kuali.ole.deliver.api.OleStatisticalCategoryContract {
35  
36      private static final long serialVersionUID = 1L;
37  
38  
39      @XmlElement(name = Elements.OLE_STATISTICAL_CATEGORY_ID, required = false)
40      private final String oleStatisticalCategoryId;
41  
42      @XmlElement(name = Elements.OLE_STATISTICAL_CATEGORY_CODE, required = false)
43      private final String oleStatisticalCategoryCode;
44  
45      @XmlElement(name = Elements.OLE_STATISTICAL_CATEGORY_NAME, required = false)
46      private final String oleStatisticalCategoryName;
47  
48      @XmlElement(name = Elements.OLE_STATISTICAL_CATEGORY_DESC, required = false)
49      private final String oleStatisticalCategoryDesc;
50  
51      @XmlElement(name = Elements.ACTIVE_INDICATOR, required = false)
52      private final boolean active;
53  
54      @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
55      private final Long versionNumber;
56  
57      /*@XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false)
58      private final String objectId;*/
59      @SuppressWarnings("unused")
60      @XmlAnyElement
61      private final Collection<Element> _futureElements = null;
62  
63      public OleStatisticalCategoryDefinition() {
64          this.oleStatisticalCategoryId = null;
65          this.oleStatisticalCategoryCode = null;
66          this.oleStatisticalCategoryName = null;
67          this.active = false;
68          this.oleStatisticalCategoryDesc = null;
69          this.versionNumber = null;
70          //this.objectId = null;
71      }
72  
73  
74      private OleStatisticalCategoryDefinition(Builder builder) {
75          this.oleStatisticalCategoryId = builder.getOleStatisticalCategoryId();
76          this.oleStatisticalCategoryCode = builder.getOleStatisticalCategoryCode();
77          this.oleStatisticalCategoryName = builder.getOleStatisticalCategoryName();
78          this.oleStatisticalCategoryDesc = builder.getOleStatisticalCategoryDesc();
79          this.active = builder.isActive();
80  
81          this.versionNumber = builder.getVersionNumber();
82          //this.objectId = builder.getObjectId();
83      }
84  
85  
86      @Override
87      public String getOleStatisticalCategoryId() {
88          return this.oleStatisticalCategoryId;
89      }
90  
91      @Override
92      public String getOleStatisticalCategoryCode() {
93          return this.oleStatisticalCategoryCode;
94      }
95  
96      @Override
97      public String getOleStatisticalCategoryName() {
98          return this.oleStatisticalCategoryName;
99      }
100 
101     @Override
102     public String getOleStatisticalCategoryDesc() {
103         return this.oleStatisticalCategoryDesc;
104     }
105 
106     @Override
107     public boolean isActive() {
108         return this.active;
109     }
110 
111     ;
112 
113 
114     @Override
115     public String getId() {
116         return this.oleStatisticalCategoryId;
117     }
118 
119 
120     @Override
121     public Long getVersionNumber() {
122         return this.versionNumber;
123     }
124 
125 
126     //@Override
127     /*public OleBorrowerTypeDefinition getOleBorrowerType() {
128         return this.oleBorrowerType;
129     }*/
130 
131     public static class Builder
132             implements Serializable, ModelBuilder, org.kuali.ole.deliver.api.OleStatisticalCategoryContract {
133 
134         private String oleStatisticalCategoryId;
135         private String oleStatisticalCategoryCode;
136         private String oleStatisticalCategoryName;
137         private String oleStatisticalCategoryDesc;
138         private boolean active;
139 
140         private Long versionNumber;
141         private String objectId;
142 
143         private Builder() {
144         }
145 
146         public static Builder create() {
147             return new Builder();
148         }
149 
150         public static Builder create(OleStatisticalCategoryContract contract) {
151             if (contract == null) {
152                 throw new IllegalArgumentException("contract was null");
153             }
154             Builder builder = create();
155             if (contract.getOleStatisticalCategoryId() != null) {
156                 builder.setOleStatisticalCategoryId(contract.getOleStatisticalCategoryId());
157             }
158             if (contract.getOleStatisticalCategoryCode() != null) {
159                 builder.setOleStatisticalCategoryCode(contract.getOleStatisticalCategoryCode());
160             }
161             if (contract.getOleStatisticalCategoryName() != null) {
162                 builder.setOleStatisticalCategoryName(contract.getOleStatisticalCategoryName());
163             }
164             if (contract.isActive()) {
165                 builder.setActive(contract.isActive());
166             }
167             if (contract.getOleStatisticalCategoryDesc() != null) {
168                 builder.setOleStatisticalCategoryDesc(contract.getOleStatisticalCategoryDesc());
169             }
170 
171             builder.setVersionNumber(contract.getVersionNumber());
172             /*builder.setObjectId(contract.getObjectId());
173             builder.setActive(contract.isActive());*/
174             builder.setId(contract.getId());
175             return builder;
176         }
177 
178 
179         public OleStatisticalCategoryDefinition build() {
180             return new OleStatisticalCategoryDefinition(this);
181         }
182 
183         public String getOleStatisticalCategoryId() {
184             return oleStatisticalCategoryId;
185         }
186 
187         public void setOleStatisticalCategoryId(String oleStatisticalCategoryId) {
188             this.oleStatisticalCategoryId = oleStatisticalCategoryId;
189         }
190 
191         public String getOleStatisticalCategoryCode() {
192             return oleStatisticalCategoryCode;
193         }
194 
195         public void setOleStatisticalCategoryCode(String oleStatisticalCategoryCode) {
196             this.oleStatisticalCategoryCode = oleStatisticalCategoryCode;
197         }
198 
199         public String getOleStatisticalCategoryName() {
200             return oleStatisticalCategoryName;
201         }
202 
203         public void setOleStatisticalCategoryName(String oleStatisticalCategoryName) {
204             this.oleStatisticalCategoryName = oleStatisticalCategoryName;
205         }
206 
207         public String getOleStatisticalCategoryDesc() {
208             return oleStatisticalCategoryDesc;
209         }
210 
211         public void setOleStatisticalCategoryDesc(String oleStatisticalCategoryDesc) {
212             this.oleStatisticalCategoryDesc = oleStatisticalCategoryDesc;
213         }
214 
215         public boolean isActive() {
216             return active;
217         }
218 
219         public void setActive(boolean active) {
220             this.active = active;
221         }
222 
223         @Override
224         public Long getVersionNumber() {
225             return versionNumber;
226         }
227 
228         public void setVersionNumber(Long versionNumber) {
229             this.versionNumber = versionNumber;
230         }
231 
232         /*@Override
233         public String getObjectId() {
234             return objectId;
235         }*/
236 
237         public void setObjectId(String objectId) {
238             this.objectId = objectId;
239         }
240 
241         @Override
242         public String getId() {
243             return this.oleStatisticalCategoryId;
244         }
245 
246 
247         public void setId(String id) {
248             if (StringUtils.isWhitespace(id)) {
249                 throw new IllegalArgumentException("id is blank");
250             }
251             this.oleStatisticalCategoryId = id;
252         }
253     }
254 
255     static class Constants {
256 
257         final static String ROOT_ELEMENT_NAME = "oleStatisticalCategory";
258         final static String TYPE_NAME = "oleStatisticalCategoryType";
259         final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[]{CoreConstants.CommonElements.FUTURE_ELEMENTS};
260     }
261 
262     static class Elements {
263         final static String OLE_STATISTICAL_CATEGORY_ID = "oleStatisticalCategoryId";
264         final static String OLE_STATISTICAL_CATEGORY_CODE = "oleStatisticalCategoryCode";
265         final static String OLE_STATISTICAL_CATEGORY_NAME = "oleStatisticalCategoryName";
266         final static String OLE_STATISTICAL_CATEGORY_DESC = "oleStatisticalCategoryDesc";
267         final static String ACTIVE_INDICATOR = "active";
268         //final static String ENTITY_ID = "entityId";
269 
270     }
271 
272     public static class Cache {
273         public static final String NAME = KimConstants.Namespaces.KIM_NAMESPACE_2_0 + "/" + Constants.TYPE_NAME;
274     }
275 }