1
2
3
4 package de.tivsource.page.entity.embeddable;
5
6 import javax.persistence.Embeddable;
7
8
9
10
11
12 @Embeddable
13 public class ContactDetails {
14
15
16
17
18 private String mobile;
19
20
21
22
23 private String telephone;
24
25
26
27
28 private String fax;
29
30
31
32
33 private String email;
34
35
36
37
38 private String homepage;
39
40 public String getMobile() {
41 return mobile;
42 }
43
44 public void setMobile(String mobile) {
45 this.mobile = mobile;
46 }
47
48 public String getTelephone() {
49 return telephone;
50 }
51
52 public void setTelephone(String telephone) {
53 this.telephone = telephone;
54 }
55
56 public String getFax() {
57 return fax;
58 }
59
60 public void setFax(String fax) {
61 this.fax = fax;
62 }
63
64 public String getEmail() {
65 return email;
66 }
67
68 public void setEmail(String email) {
69 this.email = email;
70 }
71
72 public String getHomepage() {
73 return homepage;
74 }
75
76 public void setHomepage(String homepage) {
77 this.homepage = homepage;
78 }
79
80
81
82
83
84
85 public String getTelephoneAsLink() {
86 StringBuilder stringBuilder = new StringBuilder("tel:+49");
87 String digits = telephone.replaceAll("[^0-9]", "");
88 if(digits.length()>0) {
89 char c = digits.charAt(0);
90 if (c == '0') {
91 return stringBuilder.append(digits.substring(1)).toString();
92 }
93 }
94 return stringBuilder.append(digits).toString();
95 }
96
97 }