1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.r2.core.enumerationmanagement.dto; |
17 | |
|
18 | |
import org.kuali.student.r2.common.dto.MetaInfo; |
19 | |
import org.kuali.student.r2.common.infc.HasMeta; |
20 | |
import org.kuali.student.r2.common.infc.Meta; |
21 | |
import org.kuali.student.r2.core.enumerationmanagement.infc.EnumContextValue; |
22 | |
import org.kuali.student.r2.core.enumerationmanagement.infc.EnumeratedValue; |
23 | |
|
24 | |
import javax.xml.bind.Element; |
25 | |
import javax.xml.bind.annotation.XmlAccessType; |
26 | |
import javax.xml.bind.annotation.XmlAccessorType; |
27 | |
import javax.xml.bind.annotation.XmlAnyElement; |
28 | |
import javax.xml.bind.annotation.XmlAttribute; |
29 | |
import javax.xml.bind.annotation.XmlElement; |
30 | |
import javax.xml.bind.annotation.XmlType; |
31 | |
import java.io.Serializable; |
32 | |
import java.util.ArrayList; |
33 | |
import java.util.Date; |
34 | |
import java.util.List; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
@XmlAccessorType(XmlAccessType.FIELD) |
40 | |
@XmlType(name = "EnumeratedValueInfo", propOrder = {"code", "abbrevValue", "value", "sortKey", "contexts", "enumerationKey", |
41 | |
"effectiveDate", "expirationDate", "meta", "_futureElements"}) |
42 | |
public class EnumeratedValueInfo implements EnumeratedValue, Serializable { |
43 | |
|
44 | |
private static final long serialVersionUID = 1L; |
45 | |
|
46 | |
@XmlElement |
47 | |
private String code; |
48 | |
@XmlElement |
49 | |
private String abbrevValue; |
50 | |
@XmlElement |
51 | |
private String value; |
52 | |
@XmlElement |
53 | |
private String sortKey; |
54 | |
@XmlElement |
55 | |
private List<EnumContextValueInfo> contexts; |
56 | |
@XmlAttribute |
57 | |
private String enumerationKey; |
58 | |
@XmlElement |
59 | |
private Date effectiveDate; |
60 | |
@XmlElement |
61 | |
private Date expirationDate; |
62 | |
|
63 | |
@XmlElement |
64 | |
private MetaInfo meta; |
65 | |
|
66 | |
@XmlAnyElement |
67 | |
private List<Element> _futureElements; |
68 | |
|
69 | 0 | public EnumeratedValueInfo() { |
70 | 0 | } |
71 | |
|
72 | 0 | public EnumeratedValueInfo(EnumeratedValue enumeratedValue) { |
73 | 0 | if (null != enumeratedValue) { |
74 | 0 | this.meta = new MetaInfo(enumeratedValue.getMeta()); |
75 | 0 | this.code = enumeratedValue.getCode(); |
76 | 0 | this.abbrevValue = enumeratedValue.getAbbrevValue(); |
77 | 0 | this.value = enumeratedValue.getValue(); |
78 | 0 | this.sortKey = enumeratedValue.getSortKey(); |
79 | 0 | this.contexts = new ArrayList<EnumContextValueInfo>(); |
80 | 0 | for (EnumContextValue enumContextValue : enumeratedValue.getContexts()) { |
81 | 0 | this.contexts.add(new EnumContextValueInfo(enumContextValue)); |
82 | |
} |
83 | 0 | this.effectiveDate = (null != enumeratedValue.getEffectiveDate()) ? new Date(enumeratedValue.getEffectiveDate().getTime()) : null; |
84 | 0 | this.expirationDate = (null != enumeratedValue.getExpirationDate()) ? new Date(enumeratedValue.getExpirationDate().getTime()) : null; |
85 | |
} |
86 | 0 | } |
87 | |
|
88 | |
@Override |
89 | |
public String getCode() { |
90 | 0 | return code; |
91 | |
} |
92 | |
|
93 | |
public void setCode(String code) { |
94 | 0 | this.code = code; |
95 | 0 | } |
96 | |
|
97 | |
@Override |
98 | |
public String getAbbrevValue() { |
99 | 0 | return abbrevValue; |
100 | |
} |
101 | |
|
102 | |
public void setAbbrevValue(String abbrevValue) { |
103 | 0 | this.abbrevValue = abbrevValue; |
104 | 0 | } |
105 | |
|
106 | |
@Override |
107 | |
public String getValue() { |
108 | 0 | return value; |
109 | |
} |
110 | |
|
111 | |
public void setValue(String value) { |
112 | 0 | this.value = value; |
113 | 0 | } |
114 | |
|
115 | |
@Override |
116 | |
public Date getEffectiveDate() { |
117 | 0 | return effectiveDate; |
118 | |
} |
119 | |
|
120 | |
public void setEffectiveDate(Date effectiveDate) { |
121 | 0 | this.effectiveDate = effectiveDate; |
122 | 0 | } |
123 | |
|
124 | |
@Override |
125 | |
public Date getExpirationDate() { |
126 | 0 | return expirationDate; |
127 | |
} |
128 | |
|
129 | |
public void setExpirationDate(Date expirationDate) { |
130 | 0 | this.expirationDate = expirationDate; |
131 | 0 | } |
132 | |
|
133 | |
@Override |
134 | |
public String getSortKey() { |
135 | 0 | return sortKey; |
136 | |
} |
137 | |
|
138 | |
public void setSortKey(String sortKey) { |
139 | 0 | this.sortKey = sortKey; |
140 | 0 | } |
141 | |
|
142 | |
@Override |
143 | |
public List<EnumContextValueInfo> getContexts() { |
144 | 0 | if (contexts == null) { |
145 | 0 | contexts = new ArrayList<EnumContextValueInfo>(); |
146 | |
} |
147 | 0 | return contexts; |
148 | |
} |
149 | |
|
150 | |
public void setContexts(List<EnumContextValueInfo> contexts) { |
151 | 0 | this.contexts = contexts; |
152 | 0 | } |
153 | |
|
154 | |
@Override |
155 | |
public String getEnumerationKey() { |
156 | 0 | return enumerationKey; |
157 | |
} |
158 | |
|
159 | |
public void setEnumerationKey(String enumerationKey) { |
160 | 0 | this.enumerationKey = enumerationKey; |
161 | 0 | } |
162 | |
|
163 | |
@Override |
164 | |
public Meta getMeta() { |
165 | 0 | return meta; |
166 | |
} |
167 | |
|
168 | |
public void setMeta(MetaInfo meta) { |
169 | 0 | this.meta = meta; |
170 | 0 | } |
171 | |
|
172 | |
} |