From: Roland Häder Date: Mon, 9 May 2016 09:23:04 +0000 (+0200) Subject: used interface for target entities (much better) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c1c4e72b4c9c6bdf3927fc764651c2d72dea0639;p=jcontacts-business-core.git used interface for target entities (much better) --- diff --git a/src/org/mxchange/jcontactsbusiness/CompanyContact.java b/src/org/mxchange/jcontactsbusiness/CompanyContact.java index b542c40..ca28ec5 100644 --- a/src/org/mxchange/jcontactsbusiness/CompanyContact.java +++ b/src/org/mxchange/jcontactsbusiness/CompanyContact.java @@ -37,9 +37,7 @@ import org.mxchange.jcontactsbusiness.basicdata.CompanyBasicData; import org.mxchange.jcontactsbusiness.branch.BranchOffice; import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -104,14 +102,14 @@ public class CompanyContact implements BusinessContact { * User owner instance */ @JoinColumn (name = "company_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User contactUserOwner; /** * Reference to headquarters data */ @JoinColumn (name = "company_headquarters_data_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL, optional = false) + @OneToOne (targetEntity = HeadQuartersData.class, cascade = CascadeType.ALL, optional = false) private HeadQuartersData headQuartersData; @Override diff --git a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java index 38cced0..bc2aa3e 100644 --- a/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java +++ b/src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java @@ -32,12 +32,8 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jcontactsbusiness.logo.BusinessLogo; -import org.mxchange.jcontactsbusiness.logo.CompanyLogo; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -67,7 +63,7 @@ public class CompanyBasicData implements BusinessBasicData { * User owner instance */ @JoinColumn (name = "company_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User basicUserOwner; /** @@ -95,7 +91,7 @@ public class CompanyBasicData implements BusinessBasicData { * Company's main fax numbers: +ccxxxxxxxxxx */ @JoinColumn (name = "company_fax_number_id") - @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableFaxNumber.class, cascade = CascadeType.ALL) private DialableFaxNumber companyFaxNumber; /** @@ -109,7 +105,7 @@ public class CompanyBasicData implements BusinessBasicData { * Id number of company logo */ @JoinColumn (name = "company_logo_id") - @OneToOne (targetEntity = CompanyLogo.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = BusinessLogo.class, cascade = CascadeType.ALL) private BusinessLogo companyLogo; /** @@ -123,7 +119,7 @@ public class CompanyBasicData implements BusinessBasicData { * Company's main phone number: +ccxxxxxxxxxx */ @JoinColumn (name = "company_phone_number_id") - @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableLandLineNumber.class, cascade = CascadeType.ALL) private DialableLandLineNumber companyPhoneNumber; /** diff --git a/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java index 340bf11..cbef376 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java @@ -18,6 +18,7 @@ package org.mxchange.jcontactsbusiness.branch; import java.io.Serializable; import java.util.Calendar; +import org.mxchange.jcontactsbusiness.BusinessContact; import org.mxchange.jcountry.data.Country; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; @@ -189,14 +190,14 @@ public interface BranchOffice extends Serializable { *

* @return Branch office's company */ - Long getBranchCompanyContact (); + BusinessContact getBranchCompanyContact (); /** * Setter for branch office's company *

* @param branchCompanyContact Branch office's company */ - void setBranchCompanyContact (final Long branchCompanyContact); + void setBranchCompanyContact (final BusinessContact branchCompanyContact); /** * Getter for user owner instance diff --git a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java index e9b7721..9e1af17 100644 --- a/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java +++ b/src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java @@ -30,14 +30,10 @@ import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.mxchange.jcontactsbusiness.CompanyContact; +import org.mxchange.jcontactsbusiness.BusinessContact; import org.mxchange.jcountry.data.Country; -import org.mxchange.jcountry.data.CountryData; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -66,14 +62,14 @@ public class CompanyBranchOffice implements BranchOffice { * Company that has this branch office */ @JoinColumn (name = "branch_company_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyContact.class, optional = false, cascade = CascadeType.ALL) - private Long branchCompanyContact; + @OneToOne (targetEntity = BusinessContact.class, optional = false, cascade = CascadeType.ALL) + private BusinessContact branchCompanyContact; /** * Branch office's country code */ @JoinColumn (name = "branch_country_id", nullable = false) - @OneToOne (targetEntity = CountryData.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = Country.class, cascade = CascadeType.REFRESH, optional = false) private Country branchCountry; /** @@ -94,7 +90,7 @@ public class CompanyBranchOffice implements BranchOffice { * Branch office's main fax number: +ccxxxxxxxxxx */ @JoinColumn (name = "branch_fax_number_id") - @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableFaxNumber.class, cascade = CascadeType.ALL) private DialableFaxNumber branchFaxNumber; /** @@ -116,7 +112,7 @@ public class CompanyBranchOffice implements BranchOffice { * Branch office's main phone number: +ccxxxxxxxxxx */ @JoinColumn (name = "branch_phone_number_id") - @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableLandLineNumber.class, cascade = CascadeType.ALL) private DialableLandLineNumber branchPhoneNumber; /** @@ -142,7 +138,7 @@ public class CompanyBranchOffice implements BranchOffice { * User owner instance */ @JoinColumn (name = "branch_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User branchUserOwner; /** @@ -205,12 +201,12 @@ public class CompanyBranchOffice implements BranchOffice { } @Override - public Long getBranchCompanyContact () { + public BusinessContact getBranchCompanyContact () { return this.branchCompanyContact; } @Override - public void setBranchCompanyContact (final Long branchCompanyContact) { + public void setBranchCompanyContact (final BusinessContact branchCompanyContact) { this.branchCompanyContact = branchCompanyContact; } diff --git a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java index cf335c9..2e928bf 100644 --- a/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java +++ b/src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java @@ -32,14 +32,9 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jcontactsbusiness.CompanyContact; import org.mxchange.jcontactsbusiness.branch.BranchOffice; -import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; -import org.mxchange.jcontactsbusiness.employee.CompanyEmployee; import org.mxchange.jcontactsbusiness.employee.Employee; -import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -61,21 +56,21 @@ public class CompanyDepartment implements Department { * Where this department is located */ @JoinColumn (name = "department_headquarters_id") - @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = HeadQuartersData.class, cascade = CascadeType.ALL) private HeadQuartersData departentHeadquarters; /** * Where this department is located */ @JoinColumn (name = "department_branch_id") - @ManyToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) + @ManyToOne (targetEntity = BranchOffice.class, cascade = CascadeType.ALL) private BranchOffice departmentBranchOffice; /** * Connection to company contact */ @JoinColumn (name = "department_company_id", nullable = false, updatable = false) - @ManyToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL, optional = false) + @ManyToOne (targetEntity = BusinessContact.class, cascade = CascadeType.ALL, optional = false) private BusinessContact departmentCompany; /** @@ -98,7 +93,7 @@ public class CompanyDepartment implements Department { * Department lead employee */ @JoinColumn (name = "department_lead_id", nullable = false) - @OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = Employee.class, cascade = CascadeType.ALL) private Employee departmentLead; /** @@ -112,7 +107,7 @@ public class CompanyDepartment implements Department { * User owner instance */ @JoinColumn (name = "department_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User departmentUserOwner; @Override diff --git a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java index 2a7ed33..bc296bb 100644 --- a/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java +++ b/src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java @@ -31,20 +31,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.mxchange.jcontacts.contact.Contact; -import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcontactsbusiness.BusinessContact; -import org.mxchange.jcontactsbusiness.CompanyContact; import org.mxchange.jcontactsbusiness.branch.BranchOffice; -import org.mxchange.jcontactsbusiness.branch.CompanyBranchOffice; -import org.mxchange.jcontactsbusiness.department.CompanyDepartment; import org.mxchange.jcontactsbusiness.department.Department; -import org.mxchange.jcontactsbusiness.headquarters.CompanyHeadQuartersData; import org.mxchange.jcontactsbusiness.headquarters.HeadQuartersData; -import org.mxchange.jcontactsbusiness.jobposition.EmployeePosition; import org.mxchange.jcontactsbusiness.jobposition.JobPosition; -import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber; import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -66,14 +58,14 @@ public class CompanyEmployee implements Employee { * Branch office (if the employee works there) */ @JoinColumn (name = "employee_branch_id") - @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = BranchOffice.class, cascade = CascadeType.ALL) private BranchOffice employeeBranchOffice; /** * Company the employee is working at */ @JoinColumn (name = "employee_company_id", nullable = false, updatable = false) - @OneToOne (targetEntity = CompanyContact.class, cascade = CascadeType.ALL, optional = false) + @OneToOne (targetEntity = BusinessContact.class, cascade = CascadeType.ALL, optional = false) private BusinessContact employeeCompany; /** @@ -88,7 +80,7 @@ public class CompanyEmployee implements Employee { * Department the employee works at */ @JoinColumn (name = "employee_department_id") - @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = Department.class, cascade = CascadeType.ALL) private Department employeeDepartment; /** @@ -101,7 +93,7 @@ public class CompanyEmployee implements Employee { * Head quarters id number (if the employee works there) */ @JoinColumn (name = "employee_headquarters_id") - @OneToOne (targetEntity = CompanyHeadQuartersData.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = HeadQuartersData.class, cascade = CascadeType.ALL) private HeadQuartersData employeeHeadquarter; /** @@ -116,7 +108,7 @@ public class CompanyEmployee implements Employee { * Employee's business mobile number */ @JoinColumn (name = "employee_mobile_number_id") - @OneToOne (targetEntity = CellphoneNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableCellphoneNumber.class, cascade = CascadeType.ALL) private DialableCellphoneNumber employeeMobileNumber; /** @@ -129,7 +121,7 @@ public class CompanyEmployee implements Employee { * Employee's personal data */ @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) + @OneToOne (targetEntity = Contact.class, cascade = CascadeType.ALL, optional = false) private Contact employeePersonalData; /** @@ -142,14 +134,14 @@ public class CompanyEmployee implements Employee { * Employee's position (example: CEO) */ @JoinColumn (name = "employee_position_id") - @OneToOne (targetEntity = EmployeePosition.class, cascade = CascadeType.REFRESH) + @OneToOne (targetEntity = JobPosition.class, cascade = CascadeType.REFRESH) private JobPosition employeePosition; /** * User owner instance */ @JoinColumn (name = "employee_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User employeeUserOwner; @Override diff --git a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java index 5c5753b..8b88acf 100644 --- a/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java +++ b/src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java @@ -33,10 +33,7 @@ import javax.persistence.TemporalType; import org.mxchange.jcountry.data.Country; import org.mxchange.jcountry.data.CountryData; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; -import org.mxchange.jphone.phonenumbers.fax.FaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; -import org.mxchange.jphone.phonenumbers.landline.LandLineNumber; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -80,7 +77,7 @@ public class CompanyHeadQuartersData implements HeadQuartersData { * Headquarters' fax number */ @JoinColumn (name = "headquarters_fax_number_id") - @OneToOne (targetEntity = FaxNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableFaxNumber.class, cascade = CascadeType.ALL) private DialableFaxNumber headquartersFaxNumber; /** @@ -102,7 +99,7 @@ public class CompanyHeadQuartersData implements HeadQuartersData { * Headquarters' phone number */ @JoinColumn (name = "headquarters_phone_number_id") - @OneToOne (targetEntity = LandLineNumber.class, cascade = CascadeType.ALL) + @OneToOne (targetEntity = DialableLandLineNumber.class, cascade = CascadeType.ALL) private DialableLandLineNumber headquartersPhoneNumber; /** @@ -128,7 +125,7 @@ public class CompanyHeadQuartersData implements HeadQuartersData { * User owner instance */ @JoinColumn (name = "headquarters_user_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User headquartersUserOwner; /** diff --git a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java index 439f9f9..65407df 100644 --- a/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java +++ b/src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java @@ -30,7 +30,6 @@ import javax.persistence.OneToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; /** @@ -75,7 +74,7 @@ public class CompanyLogo implements BusinessLogo { * Logo uploader user instance */ @JoinColumn (name = "logo_uploader_id", nullable = false, updatable = false) - @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false) + @OneToOne (targetEntity = User.class, cascade = CascadeType.REFRESH, optional = false) private User logoUploader; @Override