View Javadoc

1   /**
2    * Copyright 2004-2013 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.student.contract.model.test.source;
17  
18  import java.io.Serializable;
19  import java.util.Date;
20  import java.util.List;
21  
22  import javax.xml.bind.annotation.XmlAccessType;
23  import javax.xml.bind.annotation.XmlAccessorType;
24  import javax.xml.bind.annotation.XmlAnyElement;
25  import javax.xml.bind.annotation.XmlElement;
26  import javax.xml.bind.annotation.XmlType;
27  
28  import org.kuali.student.contract.model.test.source.Meta;
29  import org.kuali.student.contract.model.test.source.ModelBuilder;
30  import org.w3c.dom.Element;
31  
32  @XmlAccessorType(XmlAccessType.FIELD)
33  @XmlType(name = "MetaInfo", propOrder = {"versionInd", "createTime", "createId", "updateTime", "updateId", "_futureElements"})
34  public class MetaInfo implements Meta, Serializable {
35  
36      private static final long serialVersionUID = 1L;
37      @XmlElement
38      private final String versionInd;
39      @XmlElement
40      private final Date createTime;
41      @XmlElement
42      private final String createId;
43      @XmlElement
44      private final Date updateTime;
45      @XmlElement
46      private final String updateId;
47      @XmlAnyElement
48      private final List<Element> _futureElements;
49      
50      private MetaInfo() {
51          versionInd = null;
52          createTime = null;
53          createId = null;
54          updateTime = null;
55          updateId = null;
56          _futureElements = null;
57      }
58  
59      private MetaInfo(Meta builder) {
60          this.versionInd = builder.getVersionInd();
61          this.createTime = null != builder.getCreateTime() ? new Date(builder.getCreateTime().getTime()) : null;
62          this.createId = builder.getCreateId();
63          this.updateTime = null != builder.getUpdateTime() ? new Date(builder.getUpdateTime().getTime()) : null;
64          this.updateId = builder.getUpdateId();
65          this._futureElements = null;
66      }
67  
68      @Override
69      public String getVersionInd() {
70          return versionInd;
71      }
72  
73      @Override
74      public Date getCreateTime() {
75          return createTime;
76      }
77  
78      @Override
79      public String getCreateId() {
80          return createId;
81      }
82  
83      @Override
84      public Date getUpdateTime() {
85          return updateTime;
86      }
87  
88      @Override
89      public String getUpdateId() {
90          return updateId;
91      }
92  
93      public static class Builder implements ModelBuilder<MetaInfo>, Meta {
94  
95          private String versionInd;
96          private Date createTime;
97          private String createId;
98          private Date updateTime;
99          private String updateId;
100 
101         public Builder() {
102         }
103 
104         public Builder(Meta metaInfo) {
105             if (null != metaInfo) {
106                 this.versionInd = metaInfo.getVersionInd();
107                 this.createTime = metaInfo.getCreateTime();
108                 this.createId = metaInfo.getCreateId();
109                 this.updateTime = metaInfo.getUpdateTime();
110                 this.updateId = metaInfo.getUpdateId();
111             }
112         }
113 
114         public MetaInfo build() {
115             return new MetaInfo(this);
116         }
117 
118         @Override
119         public String getVersionInd() {
120             return versionInd;
121         }
122 
123         @Override
124         public Date getCreateTime() {
125             return createTime;
126         }
127 
128         @Override
129         public String getCreateId() {
130             return createId;
131         }
132 
133         @Override
134         public Date getUpdateTime() {
135             return updateTime;
136         }
137 
138         @Override
139         public String getUpdateId() {
140             return updateId;
141         }
142 
143         public void setVersionInd(String versionInd) {
144             this.versionInd = versionInd;
145         }
146 
147         public void setCreateTime(Date createTime) {
148             this.createTime = createTime;
149         }
150 
151         public void setCreateId(String createId) {
152             this.createId = createId;
153         }
154 
155         public void setUpdateTime(Date updateTime) {
156             this.updateTime = updateTime;
157         }
158 
159         public void setUpdateId(String updateId) {
160             this.updateId = updateId;
161         }  
162     }
163 }