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