1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.dto; |
17 | |
|
18 | |
import java.io.Serializable; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import javax.xml.bind.annotation.XmlAccessType; |
22 | |
import javax.xml.bind.annotation.XmlAccessorType; |
23 | |
import javax.xml.bind.annotation.XmlAnyElement; |
24 | |
import javax.xml.bind.annotation.XmlElement; |
25 | |
import javax.xml.bind.annotation.XmlType; |
26 | |
|
27 | |
import org.kuali.student.common.infc.Context; |
28 | |
import org.kuali.student.common.infc.ModelBuilder; |
29 | |
import org.w3c.dom.Element; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
@XmlAccessorType(XmlAccessType.FIELD) |
35 | |
@XmlType(name = "ContextInfo", propOrder = {"principalId", "localeLanguage", "localeVariant", "localeRegion", "localeScript", "timeZone", "attributes", "_futureElements"}) |
36 | 0 | public class ContextInfo extends HasAttributesInfo implements Context, Serializable { |
37 | |
|
38 | |
private static final long serialVersionUID = 1L; |
39 | |
@XmlElement |
40 | |
private final String principalId; |
41 | |
@XmlElement |
42 | |
private final String localeLanguage; |
43 | |
@XmlElement |
44 | |
private final String localeVariant; |
45 | |
@XmlElement |
46 | |
private final String localeRegion; |
47 | |
@XmlElement |
48 | |
private final String localeScript; |
49 | |
@XmlElement |
50 | |
private final String timeZone; |
51 | |
@XmlAnyElement |
52 | |
private final List<Element> _futureElements; |
53 | |
|
54 | 0 | private ContextInfo() { |
55 | 0 | principalId = null; |
56 | 0 | localeLanguage = null; |
57 | 0 | localeVariant = null; |
58 | 0 | localeRegion = null; |
59 | 0 | localeScript = null; |
60 | 0 | timeZone = null; |
61 | 0 | _futureElements = null; |
62 | 0 | } |
63 | |
|
64 | |
private ContextInfo(Context builder) { |
65 | 0 | super(builder); |
66 | 0 | this.principalId = builder.getPrincipalId(); |
67 | 0 | this.localeLanguage = builder.getLocaleLanguage(); |
68 | 0 | this.localeVariant = builder.getLocaleVariant(); |
69 | 0 | this.localeRegion = builder.getLocaleRegion(); |
70 | 0 | this.localeScript = builder.getLocaleScript(); |
71 | 0 | this.timeZone = builder.getTimeZone(); |
72 | 0 | this._futureElements = null; |
73 | 0 | } |
74 | |
|
75 | |
@Override |
76 | |
public String getPrincipalId() { |
77 | 0 | return principalId; |
78 | |
} |
79 | |
|
80 | |
@Override |
81 | |
public String getLocaleLanguage() { |
82 | 0 | return localeLanguage; |
83 | |
} |
84 | |
|
85 | |
@Override |
86 | |
public String getLocaleVariant() { |
87 | 0 | return localeVariant; |
88 | |
} |
89 | |
|
90 | |
@Override |
91 | |
public String getLocaleRegion() { |
92 | 0 | return localeRegion; |
93 | |
} |
94 | |
|
95 | |
@Override |
96 | |
public String getLocaleScript() { |
97 | 0 | return localeScript; |
98 | |
} |
99 | |
|
100 | |
@Override |
101 | |
public String getTimeZone() { |
102 | 0 | return timeZone; |
103 | |
} |
104 | |
|
105 | 0 | public static class Builder extends HasAttributesInfo.Builder implements ModelBuilder<ContextInfo>, Context { |
106 | |
|
107 | |
private String principalId; |
108 | |
private String localeLanguage; |
109 | |
private String localeVariant; |
110 | |
private String localeRegion; |
111 | |
private String localeScript; |
112 | |
private String timeZone; |
113 | |
|
114 | 0 | public Builder() { |
115 | 0 | } |
116 | |
|
117 | |
public Builder(Context ctxInfo) { |
118 | 0 | super(ctxInfo); |
119 | 0 | this.principalId = ctxInfo.getPrincipalId(); |
120 | 0 | this.localeLanguage = ctxInfo.getLocaleLanguage(); |
121 | 0 | this.localeVariant = ctxInfo.getLocaleVariant(); |
122 | 0 | this.localeRegion = ctxInfo.getLocaleRegion(); |
123 | 0 | this.localeScript = ctxInfo.getLocaleScript(); |
124 | 0 | this.timeZone = ctxInfo.getTimeZone(); |
125 | 0 | } |
126 | |
|
127 | |
public ContextInfo build() { |
128 | 0 | return new ContextInfo(this); |
129 | |
} |
130 | |
|
131 | |
@Override |
132 | |
public String getPrincipalId() { |
133 | 0 | return principalId; |
134 | |
} |
135 | |
|
136 | |
@Override |
137 | |
public String getLocaleLanguage() { |
138 | 0 | return localeLanguage; |
139 | |
} |
140 | |
|
141 | |
@Override |
142 | |
public String getLocaleVariant() { |
143 | 0 | return localeVariant; |
144 | |
} |
145 | |
|
146 | |
@Override |
147 | |
public String getLocaleRegion() { |
148 | 0 | return localeRegion; |
149 | |
} |
150 | |
|
151 | |
@Override |
152 | |
public String getLocaleScript() { |
153 | 0 | return localeScript; |
154 | |
} |
155 | |
|
156 | |
@Override |
157 | |
public String getTimeZone() { |
158 | 0 | return timeZone; |
159 | |
} |
160 | |
|
161 | |
public Builder principalId(String principalId) { |
162 | 0 | this.principalId = principalId; |
163 | 0 | return this; |
164 | |
} |
165 | |
|
166 | |
public Builder localeLanguage(String localeLanguage) { |
167 | 0 | this.localeLanguage = localeLanguage; |
168 | 0 | return this; |
169 | |
} |
170 | |
|
171 | |
public Builder localeRegion(String localeRegion) { |
172 | 0 | this.localeRegion = localeRegion; |
173 | 0 | return this; |
174 | |
} |
175 | |
|
176 | |
public Builder localeVariant(String localeVariant) { |
177 | 0 | this.localeVariant = localeVariant; |
178 | 0 | return this; |
179 | |
} |
180 | |
|
181 | |
public Builder localeScript(String localeScript) { |
182 | 0 | this.localeScript = localeScript; |
183 | 0 | return this; |
184 | |
} |
185 | |
|
186 | |
public Builder timeZone(String timeZone) { |
187 | 0 | this.timeZone = timeZone; |
188 | 0 | return this; |
189 | |
} |
190 | |
} |
191 | |
} |