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