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 java.util.LinkedHashMap; |
19 | |
|
20 | |
import javax.persistence.Column; |
21 | |
import javax.persistence.Entity; |
22 | |
import javax.persistence.Id; |
23 | |
import javax.persistence.Table; |
24 | |
import javax.persistence.Transient; |
25 | |
|
26 | |
import org.kuali.rice.kim.bo.entity.KimEntityEthnicity; |
27 | |
import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences; |
28 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
29 | |
import org.kuali.rice.kim.util.KimConstants; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
@Entity |
35 | |
@Table(name = "KRIM_ENTITY_ETHNIC_T") |
36 | 0 | public class KimEntityEthnicityImpl extends KimEntityDataBase implements KimEntityEthnicity { |
37 | |
|
38 | |
private static final long serialVersionUID = 4870141334376945160L; |
39 | |
|
40 | |
@Id |
41 | |
@Column(name = "ID") |
42 | |
protected String id; |
43 | |
|
44 | |
@Column(name = "ENTITY_ID") |
45 | |
protected String entityId; |
46 | |
|
47 | |
@Column(name = "ETHNCTY_CD") |
48 | |
protected String ethnicityCode; |
49 | |
|
50 | |
@Column(name = "SUB_ETHNCTY_CD") |
51 | |
protected String subEthnicityCode; |
52 | |
|
53 | |
@Transient |
54 | |
protected Boolean suppressPersonal; |
55 | |
|
56 | |
|
57 | |
|
58 | |
|
59 | |
public String getEthnicityCode() { |
60 | 0 | if (isSuppressPersonal()) { |
61 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
62 | |
} |
63 | 0 | return ethnicityCode; |
64 | |
} |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
public String getEthnicityCodeUnmasked() { |
70 | 0 | return this.ethnicityCode; |
71 | |
} |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
public String getSubEthnicityCode() { |
77 | 0 | if (isSuppressPersonal()) { |
78 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
79 | |
} |
80 | 0 | return subEthnicityCode; |
81 | |
} |
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public String getSubEthnicityCodeUnmasked() { |
87 | 0 | return this.subEthnicityCode; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public String getId() { |
94 | 0 | return entityId; |
95 | |
} |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
@Override |
101 | |
protected LinkedHashMap<String, String> toStringMapper() { |
102 | 0 | LinkedHashMap<String, String> m = new LinkedHashMap<String, String>(); |
103 | 0 | m.put("entityId", entityId); |
104 | 0 | m.put("ethnicityCode", ethnicityCode); |
105 | 0 | m.put("subEthnicityCode", subEthnicityCode); |
106 | 0 | return m; |
107 | |
} |
108 | |
|
109 | |
public String getEntityId() { |
110 | 0 | return this.entityId; |
111 | |
} |
112 | |
|
113 | |
public void setEntityId(String entityId) { |
114 | 0 | this.entityId = entityId; |
115 | 0 | } |
116 | |
|
117 | |
public void setEthnicityCode(String ethnicityCode) { |
118 | 0 | this.ethnicityCode = ethnicityCode; |
119 | 0 | } |
120 | |
|
121 | |
public void setSubEthnicityCode(String subEthnicityCode) { |
122 | 0 | this.subEthnicityCode = subEthnicityCode; |
123 | 0 | } |
124 | |
|
125 | |
public boolean isSuppressPersonal() { |
126 | 0 | if (suppressPersonal != null) { |
127 | 0 | return suppressPersonal.booleanValue(); |
128 | |
} |
129 | 0 | KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId()); |
130 | |
|
131 | 0 | suppressPersonal = false; |
132 | 0 | if (privacy != null) { |
133 | 0 | suppressPersonal = privacy.isSuppressPersonal(); |
134 | |
} |
135 | 0 | return suppressPersonal.booleanValue(); |
136 | |
} |
137 | |
|
138 | |
} |