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.Column; |
19 | |
import javax.persistence.Entity; |
20 | |
import javax.persistence.FetchType; |
21 | |
import javax.persistence.Id; |
22 | |
import javax.persistence.JoinColumn; |
23 | |
import javax.persistence.ManyToOne; |
24 | |
import javax.persistence.Table; |
25 | |
import javax.persistence.Transient; |
26 | |
|
27 | |
import org.kuali.rice.kim.bo.entity.KimEntityEmail; |
28 | |
import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences; |
29 | |
import org.kuali.rice.kim.bo.reference.EmailType; |
30 | |
import org.kuali.rice.kim.bo.reference.impl.EmailTypeImpl; |
31 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
32 | |
import org.kuali.rice.kim.util.KimConstants; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
@Entity |
38 | |
@Table(name = "KRIM_ENTITY_EMAIL_T") |
39 | 0 | public class KimEntityEmailImpl extends KimDefaultableEntityDataBase implements KimEntityEmail { |
40 | |
|
41 | |
private static final long serialVersionUID = 1L; |
42 | |
|
43 | |
@Id |
44 | |
@Column(name = "ENTITY_EMAIL_ID") |
45 | |
protected String entityEmailId; |
46 | |
|
47 | |
@Column(name = "ENTITY_ID") |
48 | |
protected String entityId; |
49 | |
|
50 | |
@Column(name = "ENT_TYP_CD") |
51 | |
protected String entityTypeCode; |
52 | |
|
53 | |
@Column(name = "EMAIL_TYP_CD") |
54 | |
protected String emailTypeCode; |
55 | |
|
56 | |
@Column(name = "EMAIL_ADDR") |
57 | |
protected String emailAddress; |
58 | |
|
59 | |
@ManyToOne(targetEntity=EmailTypeImpl.class, fetch=FetchType.EAGER, cascade={}) |
60 | |
@JoinColumn(name = "EMAIL_TYP_CD", insertable = false, updatable = false) |
61 | |
protected EmailType emailType; |
62 | |
|
63 | |
@Transient |
64 | |
protected Boolean suppressEmail; |
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
public String getEmailAddress() { |
70 | 0 | if (isSuppressEmail()) { |
71 | 0 | return KimConstants.RESTRICTED_DATA_MASK; |
72 | |
} |
73 | 0 | return emailAddress; |
74 | |
} |
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
public String getEmailTypeCode() { |
80 | 0 | return emailTypeCode; |
81 | |
} |
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
public String getEntityEmailId() { |
87 | 0 | return entityEmailId; |
88 | |
} |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public void setEmailAddress(String emailAddress) { |
94 | 0 | this.emailAddress = emailAddress; |
95 | 0 | } |
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public void setEmailTypeCode(String emailTypeCode) { |
101 | 0 | this.emailTypeCode = emailTypeCode; |
102 | 0 | } |
103 | |
|
104 | |
|
105 | |
|
106 | |
|
107 | |
public String getEntityTypeCode() { |
108 | 0 | return entityTypeCode; |
109 | |
} |
110 | |
|
111 | |
|
112 | |
|
113 | |
|
114 | |
public void setEntityTypeCode(String entityTypeCode) { |
115 | 0 | this.entityTypeCode = entityTypeCode; |
116 | 0 | } |
117 | |
|
118 | |
public String getEntityId() { |
119 | 0 | return this.entityId; |
120 | |
} |
121 | |
|
122 | |
public void setEntityId(String entityId) { |
123 | 0 | this.entityId = entityId; |
124 | 0 | } |
125 | |
|
126 | |
public void setEntityEmailId(String entityEmailId) { |
127 | 0 | this.entityEmailId = entityEmailId; |
128 | 0 | } |
129 | |
|
130 | |
public EmailType getEmailType() { |
131 | 0 | return this.emailType; |
132 | |
} |
133 | |
|
134 | |
public void setEmailType(EmailType emailType) { |
135 | 0 | this.emailType = emailType; |
136 | 0 | } |
137 | |
|
138 | |
public boolean isSuppressEmail() { |
139 | 0 | if (suppressEmail != null) { |
140 | 0 | return suppressEmail.booleanValue(); |
141 | |
} |
142 | 0 | KimEntityPrivacyPreferences privacy = KIMServiceLocator.getIdentityService().getEntityPrivacyPreferences(getEntityId()); |
143 | |
|
144 | 0 | suppressEmail = false; |
145 | 0 | if (privacy != null) { |
146 | 0 | suppressEmail = privacy.isSuppressEmail(); |
147 | |
} |
148 | 0 | return suppressEmail.booleanValue(); |
149 | |
} |
150 | |
|
151 | |
|
152 | |
|
153 | |
|
154 | |
public String getEmailAddressUnmasked() { |
155 | 0 | return this.emailAddress; |
156 | |
} |
157 | |
|
158 | |
} |