]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Sat, 21 Jan 2023 09:05:54 +0000 (10:05 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 21 Jan 2023 09:05:54 +0000 (10:05 +0100)
- always (null == variable) to avoid accidental assignments
- okay, Java doesn't support this anyway, maybe I just took this over
  from PHP?
- also always invoke simplier  constructors

src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java
src/org/mxchange/jcontactsbusiness/model/headquarter/BusinessHeadquarter.java
src/org/mxchange/jcontactsbusiness/model/jobposition/EmployeePosition.java
src/org/mxchange/jcontactsbusiness/model/logo/BusinessLogo.java

index 38308b7a482d23361ae3052fdc7e4834bd5bd86d..f4d404735d61bc91b98a3b17fb315fed6b3cdbd0 100644 (file)
@@ -206,8 +206,11 @@ public class BusinessBasicData implements BasicData {
         * @param companyShortName Company short name
         */
        public BusinessBasicData (final String companyShortName) {
+               // Call other constructor
+               this();
+
                // First, validate all parameter
-               if (companyShortName == null) {
+               if (null == companyShortName) {
                        // Is null
                        throw new NullPointerException("companyShortName is null"); //NOI18N
                } else if (companyShortName.isEmpty()) {
index 386f25ba1732eafa1daf8aa73c11f22ec2709944..8cae86b4c229b379c14f9eea0a6fb20d9a04c19d 100644 (file)
@@ -239,7 +239,7 @@ public class BusinessHeadquarter implements Headquarter {
                this();
 
                // First, validate all parameter
-               if (headquarterCompanyName == null) {
+               if (null == headquarterCompanyName) {
                        // Is null
                        throw new NullPointerException("headquarterCompanyName is null"); //NOI18N
                } else if (headquarterCompanyName.isEmpty()) {
index b94ed3cc700b7807360064d8452e7244e6d10837..e9cd81f6ef00a424199f4791c3d7a5bbff56938b 100644 (file)
@@ -132,6 +132,44 @@ public class EmployeePosition implements HireableJobPosition {
        @Enumerated (EnumType.STRING)
        private JobPositionStatus jobPositionStatus;
 
+       /**
+        * Default constructor is for the entity manager
+        */
+       public EmployeePosition () {
+       }
+
+       /**
+        * Constructor with all mandatory entity properties
+        * <p>
+        * @param jobPositionName   Job name
+        * @param jobPositionStart  When the job starts
+        * @param jobPositionStatus Status of the job
+        */
+       public EmployeePosition (final String jobPositionName, final Date jobPositionStart, final JobPositionStatus jobPositionStatus) {
+               // Invoke simplier constructor
+               this();
+
+               // Validate all parameter
+               if (null == jobPositionName) {
+                       // Throw NPE
+                       throw new NullPointerException("Parameter 'jobPositionName' is null"); //NOI18N
+               } else if (jobPositionName.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("Parameter 'jobPositionName' is empty"); //NOI18N
+               } else if (null == jobPositionStart) {
+                       // Throw NPE again
+                       throw new NullPointerException("Parameter 'jobPositionStart' is null"); //NOI18N
+               } else if (null == jobPositionStatus) {
+                       // Throw it again
+                       throw new NullPointerException("Parameter 'jobPositionStatus' is null"); //NOI18N
+               }
+
+               // Set all parameter
+               this.jobPositionName = jobPositionName;
+               this.jobPositionStart = jobPositionStart;
+               this.jobPositionStatus = jobPositionStatus;
+       }
+
        @Override
        public int compareTo (final HireableJobPosition jobPosition) {
                // Check parameter on null-reference and equality to this
index 3ff722aa7f80aff9497c1b1e4d9606903572da46..cae9b7204d7a7625403a9196fcf0c6ea29e8cf7f 100644 (file)
@@ -103,11 +103,10 @@ public class BusinessLogo implements Logo {
 
                // Init comparisons
                final int[] comparators = {
-                       // First file name ...
                        // First file name ...
                        StringUtils.compareIgnoreCase(this.getLogoFileName(), logo.getLogoFileName()),
                        // ... then uploader instance
-UserUtils.compare(this.getLogoUploaderUser(), logo.getLogoUploaderUser())
+                       UserUtils.compare(this.getLogoUploaderUser(), logo.getLogoUploaderUser())
                };
 
                // Check all values