1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.bo.entity.impl; |
17 | |
|
18 | |
import javax.persistence.CascadeType; |
19 | |
import javax.persistence.Column; |
20 | |
import javax.persistence.Entity; |
21 | |
import javax.persistence.FetchType; |
22 | |
import javax.persistence.Id; |
23 | |
import javax.persistence.JoinColumn; |
24 | |
import javax.persistence.ManyToOne; |
25 | |
import javax.persistence.Table; |
26 | |
import javax.persistence.Transient; |
27 | |
|
28 | |
import org.kuali.rice.kim.bo.entity.KimEntityAddress; |
29 | |
import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences; |
30 | |
import org.kuali.rice.kim.bo.reference.AddressType; |
31 | |
import org.kuali.rice.kim.bo.reference.impl.AddressTypeImpl; |
32 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
33 | |
import org.kuali.rice.kim.util.KimConstants; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
@Entity |
39 | |
@Table(name = "KRIM_ENTITY_ADDR_T") |
40 | 0 | public class KimEntityAddressImpl extends KimDefaultableEntityDataBase implements KimEntityAddress { |
41 | |
|
42 | |
private static final long serialVersionUID = 1L; |
43 | |
|
44 | |
@Id |
45 | |
@Column(name = "ENTITY_ADDR_ID") |
46 | |
protected String entityAddressId; |
47 | |
|
48 | |
@Column(name = "ENTITY_ID") |
49 | |
protected String entityId; |
50 | |
|
51 | |
@Column(name = "ADDR_TYP_CD") |
52 | |
protected String addressTypeCode; |
53 | |
|
54 | |
@Column(name = "ENT_TYP_CD") |
55 | |
protected String entityTypeCode; |
56 | |
|
57 | |
@Column(name = "CITY_NM") |
58 | |
protected String cityName; |
59 | |
|
60 | |
@Column(name = "POSTAL_STATE_CD") |
61 | |
protected String stateCode; |
62 | |
|
63 | |
@Column(name = "POSTAL_CD") |
64 | |
protected String postalCode; |
65 | |
|
66 | |
@Column(name = "POSTAL_CNTRY_CD") |
67 | |
protected String countryCode; |
68 | |
|
69 | |
@Column(name = "ADDR_LINE_1") |
70 | |
protected String line1; |
71 | |
|
72 | |
@Column(name = "ADDR_LINE_2") |
73 | |
protected String line2; |
74 | |
|
75 | |
@Column(name = "ADDR_LINE_3") |
76 | |
protected String line3; |
77 | |
|
78 | |
@ManyToOne(targetEntity=AddressTypeImpl.class, fetch=FetchType.EAGER, cascade={CascadeType.ALL}) |
79 | |
@JoinColumn(name = "ADDR_TYP_CD", insertable = false, updatable = false) |
80 | |
protected AddressType addressType; |
81 | |
|
82 | |
@Transient |
83 | |
protected Boolean suppressAddress; |
84 | |
|
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public String getAddressTypeCode() { |
94 | 0 | return addressTypeCode; |
95 | |
} |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public String getCityName() { |
101 | 0 | if (isSuppressAddress()) { |
102 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
103 | |
} |
104 | 0 | return cityName; |
105 | |
} |
106 | |
|
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
public String getCountryCode() { |
112 | 0 | if (isSuppressAddress()) { |
113 | 0 | return "XX"; |
114 | |
} |
115 | 0 | return countryCode; |
116 | |
} |
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
|
122 | |
|
123 | |
public String getEntityAddressId() { |
124 | 0 | return entityAddressId; |
125 | |
} |
126 | |
|
127 | |
|
128 | |
|
129 | |
|
130 | |
public String getLine1() { |
131 | 0 | if (isSuppressAddress()) { |
132 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
133 | |
} |
134 | 0 | return line1; |
135 | |
} |
136 | |
|
137 | |
|
138 | |
|
139 | |
|
140 | |
public String getLine2() { |
141 | 0 | if (isSuppressAddress()) { |
142 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
143 | |
} |
144 | 0 | return line2; |
145 | |
} |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
public String getLine3() { |
151 | 0 | if (isSuppressAddress()) { |
152 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
153 | |
} |
154 | 0 | return line3; |
155 | |
} |
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
public String getPostalCode() { |
161 | 0 | if (isSuppressAddress()) { |
162 | 0 | return "00000"; |
163 | |
} |
164 | 0 | return postalCode; |
165 | |
} |
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
public String getStateCode() { |
171 | 0 | if (isSuppressAddress()) { |
172 | 0 | return "XX"; |
173 | |
} |
174 | 0 | return stateCode; |
175 | |
} |
176 | |
|
177 | |
|
178 | |
|
179 | |
|
180 | |
public void setAddressTypeCode(String addressTypeCode) { |
181 | 0 | this.addressTypeCode = addressTypeCode; |
182 | 0 | } |
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
public void setCityName(String cityName) { |
188 | 0 | this.cityName = cityName; |
189 | 0 | } |
190 | |
|
191 | |
|
192 | |
|
193 | |
|
194 | |
public void setCountryCode(String countryCode) { |
195 | 0 | this.countryCode = countryCode; |
196 | 0 | } |
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
public void setLine1(String line1) { |
202 | 0 | this.line1 = line1; |
203 | 0 | } |
204 | |
|
205 | |
|
206 | |
|
207 | |
|
208 | |
public void setLine2(String line2) { |
209 | 0 | this.line2 = line2; |
210 | 0 | } |
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
public void setLine3(String line3) { |
216 | 0 | this.line3 = line3; |
217 | 0 | } |
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
public void setPostalCode(String postalCode) { |
223 | 0 | this.postalCode = postalCode; |
224 | 0 | } |
225 | |
|
226 | |
|
227 | |
|
228 | |
|
229 | |
public void setStateCode(String stateCode) { |
230 | 0 | this.stateCode = stateCode; |
231 | 0 | } |
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
public String getEntityTypeCode() { |
237 | 0 | return entityTypeCode; |
238 | |
} |
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
public void setEntityTypeCode(String entityTypeCode) { |
244 | 0 | this.entityTypeCode = entityTypeCode; |
245 | 0 | } |
246 | |
|
247 | |
public String getEntityId() { |
248 | 0 | return this.entityId; |
249 | |
} |
250 | |
|
251 | |
public void setEntityId(String entityId) { |
252 | 0 | this.entityId = entityId; |
253 | 0 | } |
254 | |
|
255 | |
public void setEntityAddressId(String entityAddressId) { |
256 | 0 | this.entityAddressId = entityAddressId; |
257 | 0 | } |
258 | |
|
259 | |
public AddressType getAddressType() { |
260 | 0 | return this.addressType; |
261 | |
} |
262 | |
|
263 | |
public void setAddressType(AddressType addressType) { |
264 | 0 | this.addressType = addressType; |
265 | 0 | } |
266 | |
|
267 | |
|
268 | |
|
269 | |
|
270 | |
public boolean isSuppressAddress() { |
271 | 0 | if (suppressAddress != null) { |
272 | 0 | return suppressAddress.booleanValue(); |
273 | |
} |
274 | 0 | KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId()); |
275 | |
|
276 | 0 | suppressAddress = false; |
277 | 0 | if (privacy != null) { |
278 | 0 | suppressAddress = privacy.isSuppressAddress(); |
279 | |
} |
280 | 0 | return suppressAddress.booleanValue(); |
281 | |
} |
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
public String getCityNameUnmasked() { |
287 | 0 | return this.cityName; |
288 | |
} |
289 | |
|
290 | |
|
291 | |
|
292 | |
|
293 | |
public String getCountryCodeUnmasked() { |
294 | 0 | return this.countryCode; |
295 | |
} |
296 | |
|
297 | |
|
298 | |
|
299 | |
|
300 | |
public String getLine1Unmasked() { |
301 | 0 | return this.line1; |
302 | |
} |
303 | |
|
304 | |
|
305 | |
|
306 | |
|
307 | |
public String getLine2Unmasked() { |
308 | 0 | return this.line2; |
309 | |
} |
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
public String getLine3Unmasked() { |
315 | 0 | return this.line3; |
316 | |
} |
317 | |
|
318 | |
|
319 | |
|
320 | |
|
321 | |
public String getPostalCodeUnmasked() { |
322 | 0 | return this.postalCode; |
323 | |
} |
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
public String getStateCodeUnmasked() { |
329 | 0 | return this.stateCode; |
330 | |
} |
331 | |
} |