]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sun, 18 Mar 2018 23:35:01 +0000 (00:35 +0100)
committerRoland Häder <roland@mxchange.org>
Sun, 18 Mar 2018 23:50:17 +0000 (00:50 +0100)
- added new depdendency Apache Commons Lang3
- used their StringUtils class for null-safe comparisons
- but their NumberUtils class' compare() methods are not null-safe, so have to
  take own CoreNumberUtils class instead.

Signed-off-by: Roland Häder <roland@mxchange.org>
lib/nblibraries.properties
nbproject/project.properties
src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java
src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java

index 8d00141fd7458a9da3e4bf3eb846cbb5cebf83d2..679f57622371bcc80bec477513e78cf826a2c225 100644 (file)
@@ -1,3 +1,8 @@
+libs.commons-lang3.classpath=\
+    ${base}/commons-lang3/commons-lang3-3.5.jar
+libs.commons-lang3.displayName=Commons Lang3 3.5
+libs.commons-lang3.javadoc=\
+    https://commons.apache.org/proper/commons-lang/javadocs/api-release/
 libs.CopyLibs.classpath=\
     ${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
 libs.CopyLibs.displayName=CopyLibs Task
index f07f0a8305dd56c1272368ccecb40a692a0d563b..a1897633fa236eeaa8e3235735b129d566c56e93 100644 (file)
@@ -45,6 +45,7 @@ javac.classpath=\
     ${file.reference.jphone-core.jar}:\
     ${file.reference.juser-core.jar}:\
     ${file.reference.jcoreee.jar}:\
+    ${libs.commons-lang3.classpath}:\
     ${libs.jpa20-persistence.classpath}
 # Space-separated list of extra javac options
 javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
index 1efd780901fa15e389d916ada0219376b6365088..ec5415bb8fe30de04c9e46b60bffdfd7622f2c53 100644 (file)
@@ -35,6 +35,7 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.apache.commons.lang3.StringUtils;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
@@ -44,7 +45,6 @@ import org.mxchange.jcontactsbusiness.model.headquarter.Headquarters;
 import org.mxchange.jcontactsbusiness.model.logo.BusinessLogo;
 import org.mxchange.jcontactsbusiness.model.logo.Logo;
 import org.mxchange.jcoreee.utils.Comparables;
-import org.mxchange.jcoreee.utils.StringUtils;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
@@ -217,9 +217,9 @@ public class BusinessBasicData implements BasicData {
                        // First compare company name
                        this.getCompanyName().compareToIgnoreCase(basicData.getCompanyName()),
                        // ... next tax number
-                       StringUtils.compareToIgnoreCase(this.getCompanyTaxNumber(), basicData.getCompanyTaxNumber()),
+                       StringUtils.compareIgnoreCase(this.getCompanyTaxNumber(), basicData.getCompanyTaxNumber()),
                        // ... and email address
-                       StringUtils.compareToIgnoreCase(this.getCompanyEmailAddress(), basicData.getCompanyEmailAddress()),
+                       StringUtils.compareIgnoreCase(this.getCompanyEmailAddress(), basicData.getCompanyEmailAddress()),
                        // ... head quarter data
                        Headquarters.compare(this.getCompanyHeadquarterData(), basicData.getCompanyHeadquarterData())
                };
index 12815f077453ebc589b4cea8a9450bf6d5f9a992..79b76c7e8608702945a406e4f8cfe39b19091d5d 100644 (file)
@@ -37,6 +37,7 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.apache.commons.lang3.StringUtils;
 import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
@@ -45,8 +46,7 @@ import org.mxchange.jcontactsbusiness.model.employee.Employees;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreee.utils.Comparables;
-import org.mxchange.jcoreee.utils.NumberUtils;
-import org.mxchange.jcoreee.utils.StringUtils;
+import org.mxchange.jcoreee.utils.CoreNumberUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -169,7 +169,9 @@ public class BusinessBranchOffice implements BranchOffice {
        /**
         * Opening times for this branch office
         */
-       @JoinTable (name = "branch_opening_times", joinColumns = @JoinColumn(name = "branch_opening_id", referencedColumnName = "branch_id"), inverseJoinColumns = @JoinColumn(name = "opening_branch_id", referencedColumnName = "opening_times_id"))
+       @JoinTable (name = "branch_opening_times", joinColumns =
+                                                                                          @JoinColumn (name = "branch_opening_id", referencedColumnName = "branch_id"), inverseJoinColumns =
+                                                                                                                                                                                                                                                        @JoinColumn (name = "opening_branch_id", referencedColumnName = "opening_times_id"))
        @ManyToMany (targetEntity = BusinessOpeningTime.class, cascade = CascadeType.ALL)
        private List<OpeningTime> branchOpeningTimes;
 
@@ -306,7 +308,7 @@ public class BusinessBranchOffice implements BranchOffice {
                        // First compare basic data
                        this.getBranchCompany().compareTo(branchOffice.getBranchCompany()),
                        // ... branch office number
-                       NumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
+                       CoreNumberUtils.compare(this.getBranchNumber(), branchOffice.getBranchNumber()),
                        // ... contact person
                        Employees.compare(this.getBranchContactEmployee(), branchOffice.getBranchContactEmployee()),
                        // ... then country
@@ -320,13 +322,13 @@ public class BusinessBranchOffice implements BranchOffice {
                        // ... and house number
                        this.getBranchHouseNumber().compareTo(branchOffice.getBranchHouseNumber()),
                        // ... and house number
-                       NumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
+                       CoreNumberUtils.compare(this.getBranchLastHouseNumber(), branchOffice.getBranchLastHouseNumber()),
                        // ... and extension
-                       StringUtils.compareToIgnoreCase(this.getBranchHouseNumberExtension(), branchOffice.getBranchHouseNumberExtension()),
+                       StringUtils.compareIgnoreCase(this.getBranchHouseNumberExtension(), branchOffice.getBranchHouseNumberExtension()),
                        // ... store ...
-                       NumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
+                       CoreNumberUtils.compare(this.getBranchStore(), branchOffice.getBranchStore()),
                        // ... suite number ...
-                       NumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
+                       CoreNumberUtils.compare(this.getBranchSuiteNumber(), branchOffice.getBranchSuiteNumber())
                };
 
                // Check all values
index cf87e934774919401979e29b8ec96853328cb67d..b0e34a749a75ca7912dc86f2cee4059af7621efa 100644 (file)
@@ -33,6 +33,7 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.apache.commons.lang3.StringUtils;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.Contacts;
 import org.mxchange.jcontacts.model.contact.UserContact;
@@ -51,7 +52,6 @@ import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition;
 import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
 import org.mxchange.jcontactsbusiness.model.jobposition.JobPositions;
 import org.mxchange.jcoreee.utils.Comparables;
-import org.mxchange.jcoreee.utils.StringUtils;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jusercore.model.user.LoginUser;
@@ -224,9 +224,9 @@ public class BusinessEmployee implements Employable {
                        // ... job position
                        JobPositions.compare(this.getEmployeeJobPosition(), employable.getEmployeeJobPosition()),
                        // ... employee's number
-                       StringUtils.compareToIgnoreCase(this.getEmployeeNumber(), employable.getEmployeeNumber()),
+                       StringUtils.compareIgnoreCase(this.getEmployeeNumber(), employable.getEmployeeNumber()),
                        // ... employee's email address
-                       StringUtils.compareToIgnoreCase(this.getEmployeeEmailAddress(), employable.getEmployeeEmailAddress()),
+                       StringUtils.compareIgnoreCase(this.getEmployeeEmailAddress(), employable.getEmployeeEmailAddress()),
                        // ... finally contact data
                        Contacts.compare(this.getEmployeePersonalData(), employable.getEmployeePersonalData())
                };
index 04e225a864900cdda19522ba0ed98226e34386bb..21f36cf8b9fa4ac6380932c2d33b7dc280e1cc7c 100644 (file)
@@ -37,13 +37,13 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.apache.commons.lang3.StringUtils;
 import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.opening_time.BusinessOpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcoreee.utils.Comparables;
-import org.mxchange.jcoreee.utils.NumberUtils;
-import org.mxchange.jcoreee.utils.StringUtils;
+import org.mxchange.jcoreee.utils.CoreNumberUtils;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -288,23 +288,23 @@ public class BusinessHeadquarter implements Headquarter {
                        // ... next country
                        this.getHeadquarterCountry().compareTo(headquarter.getHeadquarterCountry()),
                        // ... then ZIP code
-                       NumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
+                       CoreNumberUtils.compare(this.getHeadquarterZipCode(), headquarter.getHeadquarterZipCode()),
                        // ... and city
                        this.getHeadquarterCity().compareTo(headquarter.getHeadquarterCity()),
                        // ... street name
-                       StringUtils.compareToIgnoreCase(this.getHeadquarterStreet(), headquarter.getHeadquarterStreet()),
+                       StringUtils.compareIgnoreCase(this.getHeadquarterStreet(), headquarter.getHeadquarterStreet()),
                        // ... house number
-                       NumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
+                       CoreNumberUtils.compare(this.getHeadquarterHouseNumber(), headquarter.getHeadquarterHouseNumber()),
                        // ... last house number
-                       NumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
+                       CoreNumberUtils.compare(this.getHeadquarterLastHouseNumber(), headquarter.getHeadquarterLastHouseNumber()),
                        // ... extension
-                       StringUtils.compareToIgnoreCase(this.getHeadquarterHouseNumberExtension(), headquarter.getHeadquarterHouseNumberExtension()),
+                       StringUtils.compareIgnoreCase(this.getHeadquarterHouseNumberExtension(), headquarter.getHeadquarterHouseNumberExtension()),
                        // ... store number
-                       NumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
+                       CoreNumberUtils.compare(this.getHeadquarterStore(), headquarter.getHeadquarterStore()),
                        // ... suite number
-                       NumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
+                       CoreNumberUtils.compare(this.getHeadquarterSuiteNumber(), headquarter.getHeadquarterSuiteNumber()),
                        // ... last email address
-                       StringUtils.compareToIgnoreCase(this.getHeadquarterEmailAddress(), headquarter.getHeadquarterEmailAddress())
+                       StringUtils.compareIgnoreCase(this.getHeadquarterEmailAddress(), headquarter.getHeadquarterEmailAddress())
                };
 
                // Check all values