]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
used interface for target entities (much better)
authorRoland Häder <roland@mxchange.org>
Mon, 9 May 2016 09:23:04 +0000 (11:23 +0200)
committerRoland Häder <roland@mxchange.org>
Mon, 9 May 2016 09:23:04 +0000 (11:23 +0200)
src/org/mxchange/jcontactsbusiness/CompanyContact.java
src/org/mxchange/jcontactsbusiness/basicdata/CompanyBasicData.java
src/org/mxchange/jcontactsbusiness/branch/BranchOffice.java
src/org/mxchange/jcontactsbusiness/branch/CompanyBranchOffice.java
src/org/mxchange/jcontactsbusiness/department/CompanyDepartment.java
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java
src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java

index b542c40060afbf809b58f574cc58726670e4c9c8..ca28ec52330670a69e048b2c0240c7fe4a99de29 100644 (file)
@@ -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
index 38cced0fd2290a2d364f5e47eae32cdd37939add..bc2aa3eaa57319569b2e3bde01384dbdaedda7a9 100644 (file)
@@ -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;
 
        /**
index 340bf1113be59e50c07c0b2443493439b100389c..cbef376299a2ebb8e8c90e55b7eba14cb68a23b3 100644 (file)
@@ -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 {
         * <p>
         * @return Branch office's company
         */
-       Long getBranchCompanyContact ();
+       BusinessContact getBranchCompanyContact ();
 
        /**
         * Setter for branch office's company
         * <p>
         * @param branchCompanyContact Branch office's company
         */
-       void setBranchCompanyContact (final Long branchCompanyContact);
+       void setBranchCompanyContact (final BusinessContact branchCompanyContact);
 
        /**
         * Getter for user owner instance
index e9b77215cfe22d827643f37741cc81126c21074a..9e1af178414f2f8bd8c151da15b863173667119a 100644 (file)
@@ -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;
        }
 
index cf335c939acf7e8f966973dfc1c15763ba6409a7..2e928bfe8ea80bb19c876c025efaae35f1b73af3 100644 (file)
@@ -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
index 2a7ed336186ff40c50a709879394f7306cd6e9d8..bc296bbb489137aef6056ae67071c761b97b7924 100644 (file)
@@ -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
index 5c5753ba1dbfec1f10948bb86fafce731576421a..8b88acf59e6f6dff47763aee0900fd9eca7c8ba5 100644 (file)
@@ -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;
 
        /**
index 439f9f9b74f464d24709bb4908806c5e68126050..65407dfe1e512273786a3d8e95538618696d671a 100644 (file)
@@ -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