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 java.util.LinkedHashMap;
19
20 import javax.persistence.Column;
21 import javax.persistence.Entity;
22 import javax.persistence.FetchType;
23 import javax.persistence.Id;
24 import javax.persistence.JoinColumn;
25 import javax.persistence.ManyToOne;
26 import javax.persistence.Table;
27
28 import org.apache.commons.lang.StringUtils;
29 import org.kuali.rice.kim.bo.reference.PhoneType;
30 import org.kuali.rice.kim.bo.reference.impl.PhoneTypeImpl;
31
32
33
34
35
36
37
38 @Entity
39 @Table(name = "KRIM_PND_PHONE_MT")
40 public class PersonDocumentPhone extends PersonDocumentBoDefaultBase {
41 @Id
42 @Column(name = "ENTITY_PHONE_ID")
43 protected String entityPhoneId;
44
45 @Column(name = "ENT_TYP_CD")
46 protected String entityTypeCode;
47
48 @Column(name = "PHONE_TYP_CD")
49 protected String phoneTypeCode;
50
51 @Column(name = "PHONE_NBR")
52 protected String phoneNumber;
53
54 @Column(name = "PHONE_EXTN_NBR")
55 protected String extensionNumber;
56
57 @Column(name = "POSTAL_CNTRY_CD")
58 protected String countryCode;
59
60 @ManyToOne(targetEntity=PhoneTypeImpl.class, fetch = FetchType.EAGER, cascade = {})
61 @JoinColumn(name = "PHONE_TYP_CD", insertable = false, updatable = false)
62 protected PhoneType phoneType;
63
64
65
66 public PersonDocumentPhone() {
67 this.active = true;
68 }
69
70
71
72
73 public String getCountryCode() {
74 return countryCode;
75 }
76
77
78
79
80 public String getEntityPhoneId() {
81 return entityPhoneId;
82 }
83
84
85
86
87 public String getExtensionNumber() {
88 return extensionNumber;
89 }
90
91
92
93
94 public String getPhoneNumber() {
95 return phoneNumber;
96 }
97
98
99
100
101 public String getPhoneTypeCode() {
102 return phoneTypeCode;
103 }
104
105
106
107
108 public void setCountryCode(String countryCode) {
109 this.countryCode = countryCode;
110 }
111
112
113
114
115 public void setExtensionNumber(String extensionNumber) {
116 this.extensionNumber = extensionNumber;
117 }
118
119
120
121
122 public void setPhoneNumber(String phoneNumber) {
123 this.phoneNumber = phoneNumber;
124 }
125
126
127
128
129 public void setPhoneTypeCode(String phoneTypeCode) {
130 this.phoneTypeCode = phoneTypeCode;
131 }
132
133
134
135
136 public String getEntityTypeCode() {
137 return entityTypeCode;
138 }
139
140
141
142
143 public void setEntityTypeCode(String entityTypeCode) {
144 this.entityTypeCode = entityTypeCode;
145 }
146
147
148
149
150 @SuppressWarnings("unchecked")
151 @Override
152 protected LinkedHashMap toStringMapper() {
153 LinkedHashMap m = super.toStringMapper();
154 m.put( "entityPhoneId", entityPhoneId );
155 m.put( "phoneNumber", phoneNumber );
156 m.put( "extensionNumber", extensionNumber );
157 m.put( "countryCode", countryCode );
158 return m;
159 }
160
161 public PhoneType getPhoneType() {
162 return this.phoneType;
163 }
164
165 public void setPhoneType(PhoneType phoneType) {
166 this.phoneType = phoneType;
167 }
168
169 public void setEntityPhoneId(String entityPhoneId) {
170 this.entityPhoneId = entityPhoneId;
171 }
172
173 public String getFormattedPhoneNumber() {
174 StringBuffer sb = new StringBuffer( 30 );
175
176
177
178 sb.append( getPhoneNumber() );
179 if ( StringUtils.isNotBlank( getExtensionNumber() ) ) {
180 sb.append( " x" );
181 sb.append( getExtensionNumber() );
182 }
183
184 return sb.toString();
185 }
186
187 @Override
188 public boolean isActive(){
189 return this.active;
190 }
191
192 }