From 4919756da514672fd4dcd6a0f0fa1450afad7411 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Sat, 10 Oct 2015 23:16:41 +0200 Subject: [PATCH] Also phone, fax and cell phone numbers can now be linked here, too. ;-) --- .../branch/BranchOffice.java | 10 ++++---- .../branch/CompanyBranchOffice.java | 23 +++++++++++-------- .../employee/CompanyEmployee.java | 20 +++++++++------- .../jcontactsbusiness/employee/Employee.java | 9 ++++---- 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java index b7cde6e..1117f98 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java @@ -18,6 +18,8 @@ package org.mxchange.jcontactsbusiness.branch; import java.io.Serializable; import org.mxchange.jcountry.data.Country; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; /** * A POJI for branch offices @@ -59,14 +61,14 @@ public interface BranchOffice extends Serializable { *

* @return Branch office's fax number */ - public String getBranchFaxNumber (); + public DialableFaxNumber getBranchFaxNumber (); /** * Setter for branch office's fax number *

* @param branchFaxNumber Branch office's fax number */ - public void setBranchFaxNumber (String branchFaxNumber); + public void setBranchFaxNumber (final DialableFaxNumber branchFaxNumber); /** * Getter for branch office's house number @@ -87,14 +89,14 @@ public interface BranchOffice extends Serializable { *

* @return Branch office's phone number */ - public String getBranchPhoneNumber (); + public DialableLandLineNumber getBranchPhoneNumber (); /** * Setter for branch office's phone number *

* @param branchPhoneNumber Branch office's phone number */ - public void setBranchPhoneNumber (final String branchPhoneNumber); + public void setBranchPhoneNumber (final DialableLandLineNumber branchPhoneNumber); /** * Getter for branch office's store diff --git a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java index 621e353..223fe5d 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java @@ -28,6 +28,9 @@ import javax.persistence.OneToOne; import javax.persistence.Table; import org.mxchange.jcountry.data.Country; import org.mxchange.jcountry.data.CountryData; +import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; +import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; +import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; /** * A POJO for company branch offices @@ -95,20 +98,22 @@ public class CompanyBranchOffice implements BranchOffice, Comparable { /** * Employee's business mobile number */ - @Column (name = "employee_mobile_number", length = 20) - private String employeeMobileNumber; + @JoinColumn (name = "employee_mobile_number_id") + @OneToOne(targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL) + private DialableCellphoneNumber employeeMobileNumber; /** * Employee's number @@ -97,8 +101,8 @@ public class CompanyEmployee implements Employee, Comparable { /** * Employee's phone extension (or number if different) */ - @Column (name = "employee_phone_extension", length = 20) - private String employeePhoneExtension; + @Column (name = "employee_phone_extension", length = 10) + private Integer employeePhoneExtension; /** * Employee's position (example: CEO) @@ -153,12 +157,12 @@ public class CompanyEmployee implements Employee, Comparable { } @Override - public String getEmployeeMobileNumber () { + public DialableCellphoneNumber getEmployeeMobileNumber () { return this.employeeMobileNumber; } @Override - public void setEmployeeMobileNumber (final String employeeMobileNumber) { + public void setEmployeeMobileNumber (final DialableCellphoneNumber employeeMobileNumber) { this.employeeMobileNumber = employeeMobileNumber; } @@ -183,12 +187,12 @@ public class CompanyEmployee implements Employee, Comparable { } @Override - public String getEmployeePhoneExtension () { + public Integer getEmployeePhoneExtension () { return this.employeePhoneExtension; } @Override - public void setEmployeePhoneExtension (final String employeePhoneExtension) { + public void setEmployeePhoneExtension (final Integer employeePhoneExtension) { this.employeePhoneExtension = employeePhoneExtension; } diff --git a/src/org/mxchange/jcontactsbusiness/employee/Employee.java b/src/org/mxchange/jcontactsbusiness/employee/Employee.java index 04f0aa8..1c14cba 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/Employee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/Employee.java @@ -20,6 +20,7 @@ import java.io.Serializable; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.department.Department; +import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; /** * A POJI for employees @@ -89,14 +90,14 @@ public interface Employee extends Serializable { *

* @return Employee's mobile number */ - public String getEmployeeMobileNumber (); + public DialableCellphoneNumber getEmployeeMobileNumber (); /** * Setter for employee's mobile number *

* @param employeeMobileNumber Employee's mobile number */ - public void setEmployeeMobileNumber (final String employeeMobileNumber); + public void setEmployeeMobileNumber (final DialableCellphoneNumber employeeMobileNumber); /** * Getter for employee's number @@ -131,14 +132,14 @@ public interface Employee extends Serializable { *

* @return Employee's phone number/extension */ - public String getEmployeePhoneExtension (); + public Integer getEmployeePhoneExtension (); /** * Setter for employee's phone number/extension *

* @param employeePhoneExtension Employee's phone number/extension */ - public void setEmployeePhoneExtension (final String employeePhoneExtension); + public void setEmployeePhoneExtension (final Integer employeePhoneExtension); /** * Getter for employee's position -- 2.39.5