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 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 if (isSuppressPersonal()) {
61 return KimConstants.RESTRICTED_DATA_MASK;
62 }
63 return ethnicityCode;
64 }
65
66
67
68
69 public String getEthnicityCodeUnmasked() {
70 return this.ethnicityCode;
71 }
72
73
74
75
76 public String getSubEthnicityCode() {
77 if (isSuppressPersonal()) {
78 return KimConstants.RESTRICTED_DATA_MASK;
79 }
80 return subEthnicityCode;
81 }
82
83
84
85
86 public String getSubEthnicityCodeUnmasked() {
87 return this.subEthnicityCode;
88 }
89
90
91
92
93 public String getId() {
94 return entityId;
95 }
96
97
98
99
100 @Override
101 protected LinkedHashMap<String, String> toStringMapper() {
102 LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();
103 m.put("entityId", entityId);
104 m.put("ethnicityCode", ethnicityCode);
105 m.put("subEthnicityCode", subEthnicityCode);
106 return m;
107 }
108
109 public String getEntityId() {
110 return this.entityId;
111 }
112
113 public void setEntityId(String entityId) {
114 this.entityId = entityId;
115 }
116
117 public void setEthnicityCode(String ethnicityCode) {
118 this.ethnicityCode = ethnicityCode;
119 }
120
121 public void setSubEthnicityCode(String subEthnicityCode) {
122 this.subEthnicityCode = subEthnicityCode;
123 }
124
125 public boolean isSuppressPersonal() {
126 if (suppressPersonal != null) {
127 return suppressPersonal.booleanValue();
128 }
129 KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId());
130
131 suppressPersonal = false;
132 if (privacy != null) {
133 suppressPersonal = privacy.isSuppressPersonal();
134 }
135 return suppressPersonal.booleanValue();
136 }
137
138 }