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 org.hibernate.annotations.GenericGenerator; |
19 | |
import org.hibernate.annotations.Parameter; |
20 | |
import org.kuali.rice.kim.api.entity.privacy.EntityPrivacyPreferences; |
21 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
22 | |
import org.kuali.rice.kim.bo.entity.KimEntityEthnicity; |
23 | |
import org.kuali.rice.kim.util.KimConstants; |
24 | |
|
25 | |
import javax.persistence.Column; |
26 | |
import javax.persistence.Entity; |
27 | |
import javax.persistence.GeneratedValue; |
28 | |
import javax.persistence.Id; |
29 | |
import javax.persistence.Table; |
30 | |
import javax.persistence.Transient; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
@Entity |
36 | |
@Table(name = "KRIM_ENTITY_ETHNIC_T") |
37 | 0 | public class KimEntityEthnicityImpl extends KimEntityDataBase implements KimEntityEthnicity { |
38 | |
|
39 | |
private static final long serialVersionUID = 4870141334376945160L; |
40 | |
|
41 | |
@Id |
42 | |
@GeneratedValue(generator="KRIM_ENTITY_ETHNIC_ID_S") |
43 | |
@GenericGenerator(name="KRIM_ENTITY_ETHNIC_ID_S",strategy="org.kuali.rice.core.jpa.spring.RiceNumericStringSequenceStyleGenerator",parameters={ |
44 | |
@Parameter(name="sequence_name",value="KRIM_ENTITY_ETHNIC_ID_S"), |
45 | |
@Parameter(name="value_column",value="id") |
46 | |
}) |
47 | |
@Column(name = "ID") |
48 | |
protected String id; |
49 | |
|
50 | |
@Column(name = "ENTITY_ID") |
51 | |
protected String entityId; |
52 | |
|
53 | |
@Column(name = "ETHNCTY_CD") |
54 | |
protected String ethnicityCode; |
55 | |
|
56 | |
@Column(name = "SUB_ETHNCTY_CD") |
57 | |
protected String subEthnicityCode; |
58 | |
|
59 | |
@Transient |
60 | |
protected Boolean suppressPersonal; |
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
@Override |
66 | |
public String getEthnicityCode() { |
67 | 0 | if (isSuppressPersonal()) { |
68 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
69 | |
} |
70 | 0 | return ethnicityCode; |
71 | |
} |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
@Override |
77 | |
public String getEthnicityCodeUnmasked() { |
78 | 0 | return this.ethnicityCode; |
79 | |
} |
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
@Override |
85 | |
public String getSubEthnicityCode() { |
86 | 0 | if (isSuppressPersonal()) { |
87 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
88 | |
} |
89 | 0 | return subEthnicityCode; |
90 | |
} |
91 | |
|
92 | |
|
93 | |
|
94 | |
|
95 | |
@Override |
96 | |
public String getSubEthnicityCodeUnmasked() { |
97 | 0 | return this.subEthnicityCode; |
98 | |
} |
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
@Override |
104 | |
public String getId() { |
105 | 0 | return entityId; |
106 | |
} |
107 | |
|
108 | |
@Override |
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 | |
@Override |
126 | |
public boolean isSuppressPersonal() { |
127 | 0 | if (suppressPersonal != null) { |
128 | 0 | return suppressPersonal.booleanValue(); |
129 | |
} |
130 | 0 | EntityPrivacyPreferences privacy = KimApiServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId()); |
131 | |
|
132 | 0 | suppressPersonal = false; |
133 | 0 | if (privacy != null) { |
134 | 0 | suppressPersonal = privacy.isSuppressPersonal(); |
135 | |
} |
136 | 0 | return suppressPersonal.booleanValue(); |
137 | |
} |
138 | |
|
139 | |
} |