1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
package org.kuali.student.common.dto; |
10 | |
|
11 | |
import java.io.Serializable; |
12 | |
import java.util.Date; |
13 | |
import java.util.List; |
14 | |
|
15 | |
import javax.xml.bind.annotation.XmlAccessType; |
16 | |
import javax.xml.bind.annotation.XmlAccessorType; |
17 | |
import javax.xml.bind.annotation.XmlAnyElement; |
18 | |
import javax.xml.bind.annotation.XmlAttribute; |
19 | |
import javax.xml.bind.annotation.XmlElement; |
20 | |
import javax.xml.bind.annotation.XmlType; |
21 | |
|
22 | |
import org.kuali.student.common.infc.ModelBuilder; |
23 | |
import org.kuali.student.common.infc.State; |
24 | |
import org.w3c.dom.Element; |
25 | |
|
26 | |
@SuppressWarnings("serial") |
27 | |
@XmlAccessorType(XmlAccessType.FIELD) |
28 | |
@XmlType(name = "StateInfo", propOrder = {"key", "name", "descr", "effectiveDate", "expirationDate", "attributes", "_futureElements"}) |
29 | 0 | public class StateInfo extends HasAttributesInfo implements State, Serializable { |
30 | |
|
31 | |
@XmlAttribute |
32 | |
private final String key; |
33 | |
|
34 | |
@XmlElement |
35 | |
private final String name; |
36 | |
|
37 | |
@XmlElement |
38 | |
private final String descr; |
39 | |
|
40 | |
@XmlElement |
41 | |
private final Date effectiveDate; |
42 | |
|
43 | |
@XmlElement |
44 | |
private final Date expirationDate; |
45 | |
|
46 | |
@XmlAnyElement |
47 | |
private final List<Element> _futureElements; |
48 | |
|
49 | 0 | private StateInfo() { |
50 | 0 | key = null; |
51 | 0 | name = null; |
52 | 0 | descr = null; |
53 | 0 | effectiveDate = null; |
54 | 0 | expirationDate = null; |
55 | 0 | _futureElements = null; |
56 | 0 | } |
57 | |
|
58 | |
private StateInfo(State builder) { |
59 | 0 | super(builder); |
60 | 0 | this.key = builder.getKey(); |
61 | 0 | this.name = builder.getName(); |
62 | 0 | this.descr = builder.getDescr(); |
63 | 0 | this.effectiveDate = null != builder.getEffectiveDate() ? new Date(builder.getEffectiveDate().getTime()) : null; |
64 | 0 | this.expirationDate = null != builder.getExpirationDate() ? new Date(builder.getExpirationDate().getTime()) : null; |
65 | 0 | this._futureElements = null; |
66 | 0 | } |
67 | |
|
68 | |
@Override |
69 | |
public String getKey() { |
70 | 0 | return key; |
71 | |
} |
72 | |
|
73 | |
@Override |
74 | |
public String getName() { |
75 | 0 | return name; |
76 | |
} |
77 | |
|
78 | |
@Override |
79 | |
public String getDescr() { |
80 | 0 | return descr; |
81 | |
} |
82 | |
|
83 | |
@Override |
84 | |
public Date getEffectiveDate() { |
85 | 0 | return effectiveDate; |
86 | |
} |
87 | |
|
88 | |
@Override |
89 | |
public Date getExpirationDate() { |
90 | 0 | return expirationDate; |
91 | |
} |
92 | |
|
93 | 0 | public static class Builder extends HasAttributesInfo.Builder implements ModelBuilder<StateInfo>, State { |
94 | |
private String key; |
95 | |
private String name; |
96 | |
private String descr; |
97 | |
private Date effectiveDate; |
98 | |
private Date expirationDate; |
99 | |
|
100 | 0 | public Builder() {} |
101 | |
|
102 | 0 | public Builder(State stateInfo) { |
103 | 0 | this.key = stateInfo.getKey(); |
104 | 0 | this.name = stateInfo.getName(); |
105 | 0 | this.descr = stateInfo.getDescr(); |
106 | 0 | this.effectiveDate = stateInfo.getEffectiveDate(); |
107 | 0 | this.expirationDate = stateInfo.getExpirationDate(); |
108 | 0 | } |
109 | |
|
110 | |
public StateInfo build() { |
111 | 0 | return new StateInfo(this); |
112 | |
} |
113 | |
|
114 | |
public String getKey() { |
115 | 0 | return key; |
116 | |
} |
117 | |
|
118 | |
public void setKey(String key) { |
119 | 0 | this.key = key; |
120 | 0 | } |
121 | |
|
122 | |
public String getName() { |
123 | 0 | return name; |
124 | |
} |
125 | |
|
126 | |
public void setName(String name) { |
127 | 0 | this.name = name; |
128 | 0 | } |
129 | |
|
130 | |
public String getDescr() { |
131 | 0 | return descr; |
132 | |
} |
133 | |
|
134 | |
public void setDescr(String descr) { |
135 | 0 | this.descr = descr; |
136 | 0 | } |
137 | |
|
138 | |
public Date getEffectiveDate() { |
139 | 0 | return effectiveDate; |
140 | |
} |
141 | |
|
142 | |
public void setEffectiveDate(Date effectiveDate) { |
143 | 0 | this.effectiveDate = effectiveDate; |
144 | 0 | } |
145 | |
|
146 | |
public Date getExpirationDate() { |
147 | 0 | return expirationDate; |
148 | |
} |
149 | |
|
150 | |
public void setExpirationDate(Date expirationDate) { |
151 | 0 | this.expirationDate = expirationDate; |
152 | 0 | } |
153 | |
|
154 | |
} |
155 | |
} |