]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Tue, 13 Oct 2015 13:01:23 +0000 (15:01 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 13 Oct 2015 13:01:23 +0000 (15:01 +0200)
- added equals()/hashCode() for easy comparison
- updated jar(s)
Signed-off-by:Roland Häder <roland@mxchange.org>

19 files changed:
lib/jcontacts-core.jar
lib/jcountry-core.jar
lib/jphone-core.jar
src/org/mxchange/jcontactsbusiness/BusinessContact.java
src/org/mxchange/jcontactsbusiness/CompanyContact.java
src/org/mxchange/jcontactsbusiness/basicdata/BusinessBasicData.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/department/Department.java
src/org/mxchange/jcontactsbusiness/employee/CompanyEmployee.java
src/org/mxchange/jcontactsbusiness/employee/Employee.java
src/org/mxchange/jcontactsbusiness/headquarters/CompanyHeadQuartersData.java
src/org/mxchange/jcontactsbusiness/headquarters/HeadQuartersData.java
src/org/mxchange/jcontactsbusiness/jobposition/EmployeePosition.java
src/org/mxchange/jcontactsbusiness/jobposition/JobPosition.java
src/org/mxchange/jcontactsbusiness/logo/BusinessLogo.java
src/org/mxchange/jcontactsbusiness/logo/CompanyLogo.java

index 680b3d15b6eb6b3dff401aa9542f41578fb194ee..a135b3e153b7ed6f0b5f5d406f2306092bbb2e73 100644 (file)
Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ
index 049ef5f9ea049cecb9bb874ec9b9c5518d6aec4c..7166776ede488c2c9e08be75ae1f7ff182548993 100644 (file)
Binary files a/lib/jcountry-core.jar and b/lib/jcountry-core.jar differ
index 5fc37624f0e952d722990706c34aa17b065d2bef..c2ea571cf165c20b792f0bffd69afb5d0a49ba30 100644 (file)
Binary files a/lib/jphone-core.jar and b/lib/jphone-core.jar differ
index 2cf5953f4800c59ffc2940333fb228a5653d2403..f0f95798d25dd4ed9acbe8bc95934610cd123384 100644 (file)
@@ -127,4 +127,10 @@ public interface BusinessContact extends Serializable {
         * @param headQuartersData Headquarters data
         */
        public void setHeadQuartersData (final HeadQuartersData headQuartersData);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 7685c6c9fd669d4be4938fe9034874e5e6751165..57142c5d957b53722351027f7627eb28dbeac19b 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jcontactsbusiness;
 
 import java.util.List;
+import java.util.Objects;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -105,6 +106,19 @@ public class CompanyContact implements BusinessContact, Comparable<BusinessConta
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final BusinessContact other = (BusinessContact) object;
+
+               return Objects.equals(this.getBasicBusinessData(), other.getBasicBusinessData());
+       }
+
        @Override
        public BusinessBasicData getBasicBusinessData () {
                return this.basicBusinessData;
@@ -174,4 +188,11 @@ public class CompanyContact implements BusinessContact, Comparable<BusinessConta
        public void setHeadQuartersData (final HeadQuartersData headQuartersData) {
                this.headQuartersData = headQuartersData;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 3;
+               hash = 37 * hash + Objects.hashCode(this.getBasicBusinessData());
+               return hash;
+       }
 }
index 89645636f5e748eae855762303557a7cb07d0c84..075c77df9e2e5b45cb6ef4deeee546f553874046 100644 (file)
@@ -168,4 +168,10 @@ public interface BusinessBasicData extends Serializable {
         * @param companyWebsiteUrl Website URL
         */
        public void setCompanyWebsiteUrl (final String companyWebsiteUrl);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index b67e721bcf02d0bf6e3bad0cf377daf67c1b6508..3444b3e30a0e3eccf3c3186a1860ce9bae7c0a4c 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jcontactsbusiness.basicdata;
 
 import java.util.List;
+import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -124,6 +125,27 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final BusinessBasicData other = (BusinessBasicData) object;
+
+               if (!Objects.equals(this.getCompanyLegalStatus(), other.getCompanyLegalStatus())) {
+                       return false;
+               } else if (!Objects.equals(this.getCompanyName(), other.getCompanyName())) {
+                       return false;
+               } else if (!Objects.equals(this.getCompanyTaxNumber(), other.getCompanyTaxNumber())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public Long getCompanyBasicId () {
                return this.companyBasicId;
@@ -223,4 +245,13 @@ public class CompanyBasicData implements BusinessBasicData, Comparable<BusinessB
        public void setCompanyWebsiteUrl (final String companyWebsiteUrl) {
                this.companyWebsiteUrl = companyWebsiteUrl;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 5;
+               hash = 53 * hash + Objects.hashCode(this.getCompanyLegalStatus());
+               hash = 53 * hash + Objects.hashCode(this.getCompanyName());
+               hash = 53 * hash + Objects.hashCode(this.getCompanyTaxNumber());
+               return hash;
+       }
 }
index 1117f98232e15a98f67a955242a6c5c797b237d5..fc2262c0cf2a004f61313398ebccdeb7d7c59cda 100644 (file)
@@ -181,4 +181,10 @@ public interface BranchOffice extends Serializable {
         * @param branchCountryCode Branch office's country code
         */
        public void setBranchCountry (final Country branchCountryCode);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 80a1ca47f6d11adceb4193d9fb5ff545b145d54b..0826881e4bf8999b082dac9ef6a49b5f9f934ae7 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.branch;
 
+import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -128,6 +129,40 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final BranchOffice other = (BranchOffice) object;
+
+               if (!Objects.equals(this.getBranchCity(), other.getBranchCity())) {
+                       return false;
+               }
+               if (!Objects.equals(this.getBranchCountry(), other.getBranchCountry())) {
+                       return false;
+               }
+               if (!Objects.equals(this.getBranchHouseNumber(), other.getBranchHouseNumber())) {
+                       return false;
+               }
+               if (!Objects.equals(this.getBranchStore(), other.getBranchStore())) {
+                       return false;
+               }
+               if (!Objects.equals(this.getBranchStreet(), other.getBranchStreet())) {
+                       return false;
+               }
+               if (!Objects.equals(this.getBranchSuiteNumber(), other.getBranchSuiteNumber())) {
+                       return false;
+               }
+               if (!Objects.equals(this.getBranchZipCode(), other.getBranchZipCode())) {
+                       return false;
+               }
+               return true;
+       }
+
        @Override
        public String getBranchCity () {
                return this.branchCity;
@@ -237,4 +272,17 @@ public class CompanyBranchOffice implements BranchOffice, Comparable<BranchOffic
        public void setBranchZipCode (final Integer branchZipCode) {
                this.branchZipCode = branchZipCode;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 53 * hash + Objects.hashCode(this.getBranchCity());
+               hash = 53 * hash + Objects.hashCode(this.getBranchCountry());
+               hash = 53 * hash + Objects.hashCode(this.getBranchHouseNumber());
+               hash = 53 * hash + Objects.hashCode(this.getBranchStore());
+               hash = 53 * hash + Objects.hashCode(this.getBranchStreet());
+               hash = 53 * hash + Objects.hashCode(this.getBranchSuiteNumber());
+               hash = 53 * hash + Objects.hashCode(this.getBranchZipCode());
+               return hash;
+       }
 }
index a55f58a747a2636f0aff57870917e5e1c78f7478..f85badf917a1a589931cac295c5655015191f54d 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.department;
 
+import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -81,6 +82,25 @@ public class CompanyDepartment implements Department, Comparable<Department> {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final Department other = (Department) object;
+
+               if (!Objects.equals(this.getDepartmentCompany(), other.getDepartmentCompany())) {
+                       return false;
+               } else if (!Objects.equals(this.getDepartmentName(), other.getDepartmentName())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public BusinessContact getDepartmentCompany () {
                return this.departmentCompany;
@@ -120,4 +140,12 @@ public class CompanyDepartment implements Department, Comparable<Department> {
        public void setDepartmentName (final String departmentName) {
                this.departmentName = departmentName;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 5;
+               hash = 53 * hash + Objects.hashCode(this.getDepartmentCompany());
+               hash = 53 * hash + Objects.hashCode(this.getDepartmentName());
+               return hash;
+       }
 }
index 6eca9b83c2229f07554f0a76e3c7de77090ae1e2..22a065a9a92c8151d4208eaf5b5a8ea01b8abfda 100644 (file)
@@ -82,4 +82,10 @@ public interface Department extends Serializable {
         * @param departmentName Department name
         */
        public void setDepartmentName (final String departmentName);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 757a4f0a2e14a917f45ac3258330fac390422cbd..792208376d5281d636a532b15460549c6d2fcbb1 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.employee;
 
+import java.util.Objects;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -28,6 +29,8 @@ import javax.persistence.OneToOne;
 import javax.persistence.Table;
 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;
@@ -58,6 +61,13 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        @OneToOne (targetEntity = CompanyBranchOffice.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)
+       private BusinessContact employeeCompany;
+
        /**
         * Department the employee works at
         */
@@ -117,6 +127,27 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final Employee other = (Employee) object;
+
+               if (!Objects.equals(this.getEmployeeCompany(), other.getEmployeeCompany())) {
+                       return false;
+               } else if (!Objects.equals(this.getEmployeeNumber(), other.getEmployeeNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getEmployeePersonalData(), other.getEmployeePersonalData())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public BranchOffice getEmployeeBranchOffice () {
                return this.employeeBranchOffice;
@@ -127,6 +158,16 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
                this.employeeBranchOffice = employeeBranchOffice;
        }
 
+       @Override
+       public BusinessContact getEmployeeCompany () {
+               return this.employeeCompany;
+       }
+
+       @Override
+       public void setEmployeeCompany (final BusinessContact employeeCompany) {
+               this.employeeCompany = employeeCompany;
+       }
+
        @Override
        public Department getEmployeeDepartment () {
                return this.employeeDepartment;
@@ -206,4 +247,13 @@ public class CompanyEmployee implements Employee, Comparable<Employee> {
        public void setEmployeePosition (final JobPosition employeePosition) {
                this.employeePosition = employeePosition;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 3;
+               hash = 97 * hash + Objects.hashCode(this.getEmployeeCompany());
+               hash = 97 * hash + Objects.hashCode(this.getEmployeeNumber());
+               hash = 97 * hash + Objects.hashCode(this.getEmployeePersonalData());
+               return hash;
+       }
 }
index ea64f1e44ca0aee995e903f0edb50faf2cb4b681..da67f3d871696ae1701c3d18233ac1b8d89950f1 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jcontactsbusiness.employee;
 
 import java.io.Serializable;
 import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontactsbusiness.BusinessContact;
 import org.mxchange.jcontactsbusiness.branch.BranchOffice;
 import org.mxchange.jcontactsbusiness.department.Department;
 import org.mxchange.jcontactsbusiness.jobposition.JobPosition;
@@ -44,6 +45,20 @@ public interface Employee extends Serializable {
         */
        public void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice);
 
+       /**
+        * Getter for employee's company
+        * <p>
+        * @return Company instance
+        */
+       public BusinessContact getEmployeeCompany ();
+
+       /**
+        * Setter for employee's company
+        * <p>
+        * @param employeeCompany Company instance
+        */
+       public void setEmployeeCompany (final BusinessContact employeeCompany);
+
        /**
         * Getter for employee's department
         * <p>
@@ -155,4 +170,10 @@ public interface Employee extends Serializable {
         * @param employeePosition Employee's position
         */
        public void setEmployeePosition (final JobPosition employeePosition);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 259d69159c0a4f5007f504fb66fc3efe5463910b..5395fb7592a84869641d376bec3dc4372a9276c3 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.headquarters;
 
+import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
@@ -122,6 +123,35 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final HeadQuartersData other = (HeadQuartersData) object;
+
+               if (!Objects.equals(this.getHeadquartersCity(), other.getHeadquartersCity())) {
+                       return false;
+               } else if (!Objects.equals(this.getHeadquartersCountry(), other.getHeadquartersCountry())) {
+                       return false;
+               } else if (!Objects.equals(this.getHeadquartersHouseNumber(), other.getHeadquartersHouseNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getHeadquartersStore(), other.getHeadquartersStore())) {
+                       return false;
+               } else if (!Objects.equals(this.getHeadquartersStreet(), other.getHeadquartersStreet())) {
+                       return false;
+               } else if (!Objects.equals(this.getHeadquartersSuiteNumber(), other.getHeadquartersSuiteNumber())) {
+                       return false;
+               } else if (!Objects.equals(this.getHeadquartersZipCode(), other.getHeadquartersZipCode())) {
+                       return false;
+               }
+
+               return true;
+       }
+
        @Override
        public String getHeadquartersCity () {
                return this.headquartersCity;
@@ -221,4 +251,17 @@ public class CompanyHeadQuartersData implements HeadQuartersData, Comparable<Hea
        public void setHeadquartersZipCode (final Integer headquartersZipCode) {
                this.headquartersZipCode = headquartersZipCode;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersCity());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersCountry());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersHouseNumber());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersStore());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersStreet());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersSuiteNumber());
+               hash = 47 * hash + Objects.hashCode(this.getHeadquartersZipCode());
+               return hash;
+       }
 }
index 8d8645bbbe31f5988bb703ff95dfdb35246248b3..66985b5472b164f17772ef6299e3bcfdca7c96cb 100644 (file)
@@ -167,4 +167,10 @@ public interface HeadQuartersData extends Serializable {
         * @param headquartersFaxNumber Headquarters' fax number
         */
        public void setHeadquartersFaxNumber (final DialableFaxNumber headquartersFaxNumber);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 68f2876a079e3a20bad451163fdd84782c7b0c83..d17272bc68c14d94bf244e69565d7888b96b5729 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.jobposition;
 
+import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -58,6 +59,22 @@ public class EmployeePosition implements JobPosition, Comparable<JobPosition> {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final JobPosition other = (JobPosition) object;
+
+               if (!Objects.equals(this.getJobPositionName(), other.getJobPositionName())) {
+                       return false;
+               }
+               return true;
+       }
+
        @Override
        public Long getJobPositionId () {
                return this.jobPositionId;
@@ -78,4 +95,11 @@ public class EmployeePosition implements JobPosition, Comparable<JobPosition> {
                this.jobPositionName = jobPositionName;
        }
 
+       @Override
+       public int hashCode () {
+               int hash = 7;
+               hash = 37 * hash + Objects.hashCode(this.getJobPositionName());
+               return hash;
+       }
+
 }
index e9dc8f90eee0298808477041daf42455e3389bfb..6a117ad17fcad595bf5f27f4d2912b038866c547 100644 (file)
@@ -52,4 +52,10 @@ public interface JobPosition extends Serializable {
         * @param jobPositionName Job position name
         */
        public void setJobPositionName (final String jobPositionName);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 062259e0ffc0001c9a0a18f15c9dfc697e5f915b..e76ce1830ff3b632f36df641fd0226f5a8b34445 100644 (file)
@@ -52,4 +52,10 @@ public interface BusinessLogo extends Serializable {
         * @param logoId Logo's id number
         */
        public void setLogoId (final Long logoId);
+
+       @Override
+       public boolean equals (final Object object);
+
+       @Override
+       public int hashCode ();
 }
index 59b3b860d33007db585681b4d0bd443818491054..9cb53fd67d55038eb681846a9721a71cb66833c0 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcontactsbusiness.logo;
 
+import java.util.Objects;
 import javax.persistence.Basic;
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -58,6 +59,19 @@ public class CompanyLogo implements BusinessLogo, Comparable<BusinessLogo> {
                throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }
 
+       @Override
+       public boolean equals (final Object object) {
+               if (object == null) {
+                       return false;
+               } else if (getClass() != object.getClass()) {
+                       return false;
+               }
+
+               final BusinessLogo other = (BusinessLogo) object;
+
+               return Objects.equals(this.getLogoFileName(), other.getLogoFileName());
+       }
+
        @Override
        public String getLogoFileName () {
                return this.logoFileName;
@@ -77,4 +91,11 @@ public class CompanyLogo implements BusinessLogo, Comparable<BusinessLogo> {
        public void setLogoId (final Long logoId) {
                this.logoId = logoId;
        }
+
+       @Override
+       public int hashCode () {
+               int hash = 3;
+               hash = 53 * hash + Objects.hashCode(this.getLogoFileName());
+               return hash;
+       }
 }