1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.core.academiccalendar.dto; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.Date; |
20 | |
import java.util.List; |
21 | |
import org.w3c.dom.Element; |
22 | |
|
23 | |
import javax.xml.bind.annotation.XmlAccessType; |
24 | |
import javax.xml.bind.annotation.XmlAccessorType; |
25 | |
import javax.xml.bind.annotation.XmlAnyElement; |
26 | |
import javax.xml.bind.annotation.XmlAttribute; |
27 | |
import javax.xml.bind.annotation.XmlElement; |
28 | |
import javax.xml.bind.annotation.XmlType; |
29 | |
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; |
30 | |
|
31 | |
import org.kuali.student.common.infc.ModelBuilder; |
32 | |
import org.kuali.student.r2.common.dto.KeyEntityInfo; |
33 | |
import org.kuali.student.core.academiccalendar.infc.KeyDate; |
34 | |
|
35 | |
import org.kuali.student.core.ws.binding.JaxbAttributeMapListAdapter; |
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
@XmlAccessorType(XmlAccessType.FIELD) |
46 | |
@XmlType(name = "KeyDateInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "isDateRange", "startDate", "endDate", "metaInfo", "attributes", "_futureElements"}) |
47 | |
|
48 | |
public class KeyDateInfo extends KeyEntityInfo implements KeyDate, Serializable { |
49 | |
|
50 | |
private static final long serialVersionUID = 1L; |
51 | |
|
52 | |
@XmlElement |
53 | |
private final Boolean isDateRange; |
54 | |
|
55 | |
@XmlElement |
56 | |
private final Date startDate; |
57 | |
|
58 | |
@XmlElement |
59 | |
private final Date endDate; |
60 | |
|
61 | |
@XmlAnyElement |
62 | |
private final List<Element> _futureElements; |
63 | |
|
64 | 0 | private KeyDateInfo() { |
65 | 0 | isDateRange = false; |
66 | 0 | startDate = null; |
67 | 0 | endDate = null; |
68 | 0 | _futureElements = null; |
69 | 0 | } |
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
public KeyDateInfo(KeyDate keyDate) { |
77 | 0 | super(keyDate); |
78 | 0 | this.isDateRange = keyDate.getIsDateRange(); |
79 | 0 | this.startDate = null != keyDate.getStartDate() ? new Date(keyDate.getStartDate().getTime()) : null; |
80 | 0 | this.endDate = null != keyDate.getEndDate() ? new Date(keyDate.getEndDate().getTime()) : null; |
81 | 0 | _futureElements = null; |
82 | 0 | } |
83 | |
|
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
@Override |
92 | |
public Boolean getIsDateRange() { |
93 | 0 | return isDateRange; |
94 | |
} |
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
@Override |
102 | |
public Date getStartDate() { |
103 | 0 | return startDate; |
104 | |
} |
105 | |
|
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
@Override |
112 | |
public Date getEndDate() { |
113 | 0 | return endDate; |
114 | |
} |
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<KeyDateInfo>, KeyDate { |
120 | |
|
121 | |
private Boolean isDateRange; |
122 | |
private Date startDate; |
123 | |
private Date endDate; |
124 | |
|
125 | |
|
126 | |
|
127 | |
|
128 | 0 | public Builder() { |
129 | 0 | } |
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
public Builder(KeyDate keyDate) { |
136 | 0 | super(keyDate); |
137 | 0 | this.isDateRange = keyDate.getIsDateRange(); |
138 | 0 | this.startDate = null != keyDate.getStartDate() ? new Date(keyDate.getStartDate().getTime()) : null; |
139 | 0 | this.endDate = null != keyDate.getEndDate() ? new Date(keyDate.getEndDate().getTime()) : null; |
140 | 0 | } |
141 | |
|
142 | |
|
143 | |
|
144 | |
|
145 | |
|
146 | |
|
147 | |
public KeyDateInfo build() { |
148 | 0 | return new KeyDateInfo(this); |
149 | |
} |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
@Override |
159 | |
public Boolean getIsDateRange() { |
160 | 0 | return isDateRange; |
161 | |
} |
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
public void dateRange(Boolean isDateRange) { |
171 | 0 | this.isDateRange = isDateRange; |
172 | 0 | } |
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
@Override |
180 | |
public Date getStartDate() { |
181 | 0 | return startDate; |
182 | |
} |
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
public void setStartDate(Date startDate) { |
190 | 0 | this.startDate = new Date(startDate.getTime()); |
191 | 0 | } |
192 | |
|
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
@Override |
199 | |
public Date getEndDate() { |
200 | 0 | return endDate; |
201 | |
} |
202 | |
|
203 | |
|
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
public void setEndDate(Date endDate) { |
209 | 0 | this.endDate = new Date(endDate.getTime()); |
210 | 0 | } |
211 | |
} |
212 | |
} |