View Javadoc

1   /*
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  package org.kuali.student.contract.model.test.source;
16  
17  import java.io.Serializable;
18  import java.util.Date;
19  import java.util.List;
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.XmlType;
26  
27  import org.kuali.student.contract.model.test.source.Meta;
28  import org.kuali.student.contract.model.test.source.ModelBuilder;
29  import org.w3c.dom.Element;
30  
31  @XmlAccessorType(XmlAccessType.FIELD)
32  @XmlType(name = "MetaInfo", propOrder = {"versionInd", "createTime", "createId", "updateTime", "updateId", "_futureElements"})
33  public class MetaInfo implements Meta, Serializable {
34  
35      private static final long serialVersionUID = 1L;
36      @XmlElement
37      private final String versionInd;
38      @XmlElement
39      private final Date createTime;
40      @XmlElement
41      private final String createId;
42      @XmlElement
43      private final Date updateTime;
44      @XmlElement
45      private final String updateId;
46      @XmlAnyElement
47      private final List<Element> _futureElements;
48      
49      private MetaInfo() {
50          versionInd = null;
51          createTime = null;
52          createId = null;
53          updateTime = null;
54          updateId = null;
55          _futureElements = null;
56      }
57  
58      private MetaInfo(Meta builder) {
59          this.versionInd = builder.getVersionInd();
60          this.createTime = null != builder.getCreateTime() ? new Date(builder.getCreateTime().getTime()) : null;
61          this.createId = builder.getCreateId();
62          this.updateTime = null != builder.getUpdateTime() ? new Date(builder.getUpdateTime().getTime()) : null;
63          this.updateId = builder.getUpdateId();
64          this._futureElements = null;
65      }
66  
67      @Override
68      public String getVersionInd() {
69          return versionInd;
70      }
71  
72      @Override
73      public Date getCreateTime() {
74          return createTime;
75      }
76  
77      @Override
78      public String getCreateId() {
79          return createId;
80      }
81  
82      @Override
83      public Date getUpdateTime() {
84          return updateTime;
85      }
86  
87      @Override
88      public String getUpdateId() {
89          return updateId;
90      }
91  
92      public static class Builder implements ModelBuilder<MetaInfo>, Meta {
93  
94          private String versionInd;
95          private Date createTime;
96          private String createId;
97          private Date updateTime;
98          private String updateId;
99  
100         public Builder() {
101         }
102 
103         public Builder(Meta metaInfo) {
104             if (null != metaInfo) {
105                 this.versionInd = metaInfo.getVersionInd();
106                 this.createTime = metaInfo.getCreateTime();
107                 this.createId = metaInfo.getCreateId();
108                 this.updateTime = metaInfo.getUpdateTime();
109                 this.updateId = metaInfo.getUpdateId();
110             }
111         }
112 
113         public MetaInfo build() {
114             return new MetaInfo(this);
115         }
116 
117         @Override
118         public String getVersionInd() {
119             return versionInd;
120         }
121 
122         @Override
123         public Date getCreateTime() {
124             return createTime;
125         }
126 
127         @Override
128         public String getCreateId() {
129             return createId;
130         }
131 
132         @Override
133         public Date getUpdateTime() {
134             return updateTime;
135         }
136 
137         @Override
138         public String getUpdateId() {
139             return updateId;
140         }
141 
142         public void setVersionInd(String versionInd) {
143             this.versionInd = versionInd;
144         }
145 
146         public void setCreateTime(Date createTime) {
147             this.createTime = createTime;
148         }
149 
150         public void setCreateId(String createId) {
151             this.createId = createId;
152         }
153 
154         public void setUpdateTime(Date updateTime) {
155             this.updateTime = updateTime;
156         }
157 
158         public void setUpdateId(String updateId) {
159             this.updateId = updateId;
160         }  
161     }
162 }