1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.bo.ui;
17
18 import javax.persistence.CascadeType;
19 import javax.persistence.Column;
20 import javax.persistence.Entity;
21 import javax.persistence.GeneratedValue;
22 import javax.persistence.Id;
23 import javax.persistence.JoinColumn;
24 import javax.persistence.ManyToOne;
25 import javax.persistence.Table;
26
27 import org.apache.commons.lang.StringUtils;
28 import org.eclipse.persistence.annotations.JoinFetch;
29 import org.eclipse.persistence.annotations.JoinFetchType;
30 import org.kuali.rice.kim.impl.identity.phone.EntityPhoneTypeBo;
31 import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
32
33
34
35
36
37
38
39 @Entity
40 @Table(name = "KRIM_PND_PHONE_MT")
41 public class PersonDocumentPhone extends PersonDocumentBoDefaultBase {
42 private static final long serialVersionUID = 1L;
43
44 @PortableSequenceGenerator(name = "KRIM_ENTITY_PHONE_ID_S")
45 @GeneratedValue(generator = "KRIM_ENTITY_PHONE_ID_S")
46 @Id
47 @Column(name = "ENTITY_PHONE_ID")
48 protected String entityPhoneId;
49
50 @Column(name = "ENT_TYP_CD")
51 protected String entityTypeCode;
52
53 @Column(name = "PHONE_TYP_CD")
54 protected String phoneTypeCode;
55
56 @Column(name = "PHONE_NBR")
57 protected String phoneNumber;
58
59 @Column(name = "PHONE_EXTN_NBR")
60 protected String extensionNumber;
61
62 @Column(name = "POSTAL_CNTRY_CD")
63 protected String countryCode;
64
65 @JoinFetch(value= JoinFetchType.OUTER)
66 @ManyToOne(targetEntity = EntityPhoneTypeBo.class, cascade = { CascadeType.REFRESH })
67 @JoinColumn(name = "PHONE_TYP_CD", referencedColumnName = "PHONE_TYP_CD", insertable = false, updatable = false)
68 protected EntityPhoneTypeBo phoneType;
69
70
71
72 public PersonDocumentPhone() {
73 this.active = true;
74 }
75
76
77
78
79 public String getCountryCode() {
80 return countryCode;
81 }
82
83
84
85
86 public String getEntityPhoneId() {
87 return entityPhoneId;
88 }
89
90
91
92
93 public String getExtensionNumber() {
94 return extensionNumber;
95 }
96
97
98
99
100 public String getPhoneNumber() {
101 return phoneNumber;
102 }
103
104
105
106
107 public String getPhoneTypeCode() {
108 return phoneTypeCode;
109 }
110
111
112
113
114 public void setCountryCode(String countryCode) {
115 this.countryCode = countryCode;
116 }
117
118
119
120
121 public void setExtensionNumber(String extensionNumber) {
122 this.extensionNumber = extensionNumber;
123 }
124
125
126
127
128 public void setPhoneNumber(String phoneNumber) {
129 this.phoneNumber = phoneNumber;
130 }
131
132
133
134
135 public void setPhoneTypeCode(String phoneTypeCode) {
136 this.phoneTypeCode = phoneTypeCode;
137 }
138
139
140
141
142 public String getEntityTypeCode() {
143 return entityTypeCode;
144 }
145
146
147
148
149 public void setEntityTypeCode(String entityTypeCode) {
150 this.entityTypeCode = entityTypeCode;
151 }
152
153 public EntityPhoneTypeBo getPhoneType() {
154 return this.phoneType;
155 }
156
157 public void setPhoneType(EntityPhoneTypeBo phoneType) {
158 this.phoneType = phoneType;
159 }
160
161 public void setEntityPhoneId(String entityPhoneId) {
162 this.entityPhoneId = entityPhoneId;
163 }
164
165 public String getFormattedPhoneNumber() {
166 StringBuilder sb = new StringBuilder(30);
167
168
169 sb.append(getPhoneNumber());
170 if (StringUtils.isNotBlank(getExtensionNumber())) {
171 sb.append(" x");
172 sb.append(getExtensionNumber());
173 }
174 return sb.toString();
175 }
176 }