1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
package org.kuali.student.enrollment.classII.academiccalendar.dto; |
16 | |
|
17 | |
import java.io.Serializable; |
18 | |
import java.util.Date; |
19 | |
import java.util.List; |
20 | |
import org.w3c.dom.Element; |
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 | |
|
27 | |
import javax.xml.bind.annotation.XmlType; |
28 | |
|
29 | |
import org.kuali.student.r2.common.dto.KeyEntityInfo; |
30 | |
import org.kuali.student.r2.common.infc.ModelBuilder; |
31 | |
import org.kuali.student.enrollment.classII.academiccalendar.infc.Term; |
32 | |
|
33 | |
@XmlAccessorType(XmlAccessType.FIELD) |
34 | |
@XmlType(name = "TermInfo", propOrder = {"key", "typeKey", "stateKey", "name", "descr", "startDate", "endDate", "metaInfo", "attributes", "_futureElements"}) |
35 | |
|
36 | |
public class TermInfo extends KeyEntityInfo implements Term, Serializable { |
37 | |
private static final long serialVersionUID = 1L; |
38 | |
|
39 | |
@XmlElement |
40 | |
private final Date startDate; |
41 | |
|
42 | |
@XmlElement |
43 | |
private final Date endDate; |
44 | |
|
45 | |
@XmlAnyElement |
46 | |
private final List<Element> _futureElements; |
47 | |
|
48 | 0 | private TermInfo() { |
49 | 0 | startDate = null; |
50 | 0 | endDate = null; |
51 | 0 | _futureElements = null; |
52 | 0 | } |
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | |
public TermInfo(Term term) { |
61 | 0 | super(term); |
62 | |
|
63 | 0 | this.startDate = null != term.getStartDate() ? new Date(term.getStartDate().getTime()) : null; |
64 | 0 | this.endDate = null != term.getEndDate() ? new Date(term.getEndDate().getTime()) : null; |
65 | |
|
66 | 0 | _futureElements = null; |
67 | 0 | } |
68 | |
|
69 | |
|
70 | |
@Override |
71 | |
public Date getStartDate() { |
72 | 0 | return startDate; |
73 | |
} |
74 | |
|
75 | |
|
76 | |
@Override |
77 | |
public Date getEndDate() { |
78 | 0 | return endDate; |
79 | |
} |
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | 0 | public static class Builder extends KeyEntityInfo.Builder implements ModelBuilder<TermInfo>, Term { |
85 | |
|
86 | |
private Date startDate; |
87 | |
private Date endDate; |
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | 0 | public Builder() { |
93 | 0 | } |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
public Builder(Term term) { |
99 | 0 | super(term); |
100 | 0 | this.startDate = term.getStartDate(); |
101 | 0 | this.startDate = term.getEndDate(); |
102 | 0 | } |
103 | |
|
104 | |
@Override |
105 | |
public TermInfo build() { |
106 | 0 | return new TermInfo(this); |
107 | |
} |
108 | |
|
109 | |
@Override |
110 | |
public Date getStartDate() { |
111 | 0 | return startDate; |
112 | |
} |
113 | |
|
114 | |
public void setStartDate(Date startDate) { |
115 | 0 | this.startDate = startDate; |
116 | 0 | } |
117 | |
|
118 | |
@Override |
119 | |
public Date getEndDate() { |
120 | 0 | return endDate; |
121 | |
} |
122 | |
|
123 | |
public void setEndDate(Date endDate) { |
124 | 0 | this.endDate = endDate; |
125 | 0 | } |
126 | |
} |
127 | |
} |