]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 16 Apr 2020 15:45:14 +0000 (17:45 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 16 Apr 2020 15:45:14 +0000 (17:45 +0200)
- renamed openingId to openingTimeId to have it more consistent
- "validated" parameter of 2nd constructor of same entity
- tpzo fixed

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java
src/org/mxchange/jcontactsbusiness/model/employee/Employable.java
src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java
src/org/mxchange/jcontactsbusiness/model/opening_time/OpeningTime.java

index 59183381b11bc74b1fc3452d30a149b350153a07..526688320cb33d2bc81128a37b46740d48d44ac6 100644 (file)
@@ -47,12 +47,12 @@ public class OpeningTimeAddedEvent implements ObservableOpeningTimeAddedEvent {
                if (null == openingTime) {
                        // Throw NPE
                        throw new NullPointerException("openingTime is null"); //NOI18N
-               } else if (openingTime.getOpeningId() == null) {
+               } else if (openingTime.getOpeningTimeId() == null) {
                        // Throw NPE again
                        throw new NullPointerException("openingTime.openingId is null"); //NOI18N
-               } else if (openingTime.getOpeningId() < 1) {
+               } else if (openingTime.getOpeningTimeId() < 1) {
                        // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("openingTime.openingId={0} is not valid", openingTime.getOpeningId())); //NOI18N
+                       throw new NullPointerException(MessageFormat.format("openingTime.openingId={0} is not valid", openingTime.getOpeningTimeId())); //NOI18N
                }
 
                // Set it
index e29fb183b7f4e3d88c8ad77cd26447ffd10a0f84..4d4d3574582983e41f614a40a3d413880ef563dc 100644 (file)
@@ -37,14 +37,14 @@ public interface Employable extends Comparable<Employable>, Serializable {
        /**
         * Getter for employee's branch office
         * <p>
-        * @return Employable's branch office
+        * @return Employee's branch office
         */
        BranchOffice getEmployeeBranchOffice ();
 
        /**
         * Setter for employee's branch office
         * <p>
-        * @param employeeBranchOffice Employable's branch office
+        * @param employeeBranchOffice Employee's branch office
         */
        void setEmployeeBranchOffice (final BranchOffice employeeBranchOffice);
 
@@ -65,126 +65,126 @@ public interface Employable extends Comparable<Employable>, Serializable {
        /**
         * Getter for employee's department
         * <p>
-        * @return Employable's department
+        * @return Employee's department
         */
        Department getEmployeeDepartment ();
 
        /**
         * Setter for employee's department
         * <p>
-        * @param employeeDepartment Employable's department
+        * @param employeeDepartment Employee's department
         */
        void setEmployeeDepartment (final Department employeeDepartment);
 
        /**
         * Getter for employee's head quarters
         * <p>
-        * @return Employable's head quarters
+        * @return Employee's head quarters
         */
        Headquarter getEmployeeHeadquarter ();
 
        /**
         * Getter for employee's head quarters
         * <p>
-        * @param employeeHeadquarter Employable's head quarters
+        * @param employeeHeadquarter Employee's head quarters
         */
        void setEmployeeHeadquarter (final Headquarter employeeHeadquarter);
 
        /**
         * Getter for employee's email address
         * <p>
-        * @return Employable's email address
+        * @return Employee's email address
         */
        String getEmployeeEmailAddress ();
 
        /**
         * Setter for employee's email address
         * <p>
-        * @param employeeEmailAddress Employable's email address
+        * @param employeeEmailAddress Employee's email address
         */
        void setEmployeeEmailAddress (final String employeeEmailAddress);
 
        /**
         * Getter for employee's id number
         * <p>
-        * @return Employable's id number
+        * @return Employee's id number
         */
        Long getEmployeeId ();
 
        /**
         * Setter for employee's id number
         * <p>
-        * @param employeeId Employable's id number
+        * @param employeeId Employee's id number
         */
        void setEmployeeId (final Long employeeId);
 
        /**
         * Getter for employee's mobile number
         * <p>
-        * @return Employable's mobile number
+        * @return Employee's mobile number
         */
        DialableMobileNumber getEmployeeMobileNumber ();
 
        /**
         * Setter for employee's mobile number
         * <p>
-        * @param employeeMobileNumber Employable's mobile number
+        * @param employeeMobileNumber Employee's mobile number
         */
        void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber);
 
        /**
         * Getter for employee's number
         * <p>
-        * @return Employable's number
+        * @return Employee's number
         */
        String getEmployeeNumber ();
 
        /**
         * Setter for employee's number
         * <p>
-        * @param employeeNumber Employable's number
+        * @param employeeNumber Employee's number
         */
        void setEmployeeNumber (final String employeeNumber);
 
        /**
         * Getter for employee's personal data
         * <p>
-        * @return Employable's personal data
+        * @return Employee's personal data
         */
        Contact getEmployeePersonalData ();
 
        /**
         * Setter for employee's personal data
         * <p>
-        * @param employeePersonalData Employable's personal data
+        * @param employeePersonalData Employee's personal data
         */
        void setEmployeePersonalData (final Contact employeePersonalData);
 
        /**
         * Getter for employee's phone number/extension
         * <p>
-        * @return Employable's phone number/extension
+        * @return Employee's phone number/extension
         */
        Integer getEmployeePhoneExtension ();
 
        /**
         * Setter for employee's phone number/extension
         * <p>
-        * @param employeePhoneExtension Employable's phone number/extension
+        * @param employeePhoneExtension Employee's phone number/extension
         */
        void setEmployeePhoneExtension (final Integer employeePhoneExtension);
 
        /**
         * Getter for employee's position
         * <p>
-        * @return Employable's position
+        * @return Employee's position
         */
        HireableJobPosition getEmployeeJobPosition ();
 
        /**
         * Setter for employee's position
         * <p>
-        * @param employeePosition Employable's position
+        * @param employeePosition Employee's position
         */
        void setEmployeeJobPosition (final HireableJobPosition employeePosition);
 
index b42bf30805379d7c5a004d5b869fcafe865b7286..611f77474da7aac54d9469b76ebaa6afc8a38c0e 100644 (file)
@@ -80,14 +80,6 @@ public class BusinessOpeningTime implements OpeningTime {
        @Temporal (TemporalType.TIME)
        private Date openingEndTime;
 
-       /**
-        * Id number
-        */
-       @Id
-       @Column (name = "opening_times_id", nullable = false, updatable = false)
-       @GeneratedValue (strategy = GenerationType.IDENTITY)
-       private Long openingId;
-
        /**
         * Starting day of opening times
         */
@@ -104,6 +96,14 @@ public class BusinessOpeningTime implements OpeningTime {
        @Temporal (TemporalType.TIME)
        private Date openingStartTime;
 
+       /**
+        * Id number
+        */
+       @Id
+       @Column (name = "opening_times_id", nullable = false, updatable = false)
+       @GeneratedValue (strategy = GenerationType.IDENTITY)
+       private Long openingTimeId;
+
        /**
         * Default constructor
         */
@@ -119,6 +119,24 @@ public class BusinessOpeningTime implements OpeningTime {
         * @param openingStartTime Start time
         */
        public BusinessOpeningTime (final DayOfTheWeek openingEndDay, final Date openingEndTime, final DayOfTheWeek openingStartDay, final Date openingStartTime) {
+               // Invoke default constructor
+               this();
+
+               // Validate parameter
+               if (null == openingEndDay) {
+                       // Throw NPE
+                       throw new NullPointerException("openingEndDay is null"); //NOI18N
+               } else if (null == openingEndTime) {
+                       // Throw NPE
+                       throw new NullPointerException("openingEndTime is null"); //NOI18N
+               } else if (null == openingStartDay) {
+                       // Throw NPE
+                       throw new NullPointerException("openingStartDay is null"); //NOI18N
+               } else if (null == openingStartTime) {
+                       // Throw NPE
+                       throw new NullPointerException("openingStartTime is null"); //NOI18N
+               }
+
                // Set all fields
                this.openingEndDay = openingEndDay;
                this.openingEndTime = openingEndTime;
@@ -165,7 +183,7 @@ public class BusinessOpeningTime implements OpeningTime {
 
                final OpeningTime openingTimes = (OpeningTime) obj;
 
-               if (!Objects.equals(this.getOpeningId(), openingTimes.getOpeningId())) {
+               if (!Objects.equals(this.getOpeningTimeId(), openingTimes.getOpeningTimeId())) {
                        return false;
                } else if (this.getOpeningStartDay() != openingTimes.getOpeningStartDay()) {
                        return false;
@@ -214,16 +232,6 @@ public class BusinessOpeningTime implements OpeningTime {
                this.openingEndTime = openingEndTime;
        }
 
-       @Override
-       public Long getOpeningId () {
-               return this.openingId;
-       }
-
-       @Override
-       public void setOpeningId (final Long openingId) {
-               this.openingId = openingId;
-       }
-
        @Override
        public DayOfTheWeek getOpeningStartDay () {
                return this.openingStartDay;
@@ -246,11 +254,21 @@ public class BusinessOpeningTime implements OpeningTime {
                this.openingStartTime = openingStartTime;
        }
 
+       @Override
+       public Long getOpeningTimeId () {
+               return this.openingTimeId;
+       }
+
+       @Override
+       public void setOpeningTimeId (final Long openingTimeId) {
+               this.openingTimeId = openingTimeId;
+       }
+
        @Override
        public int hashCode () {
                int hash = 7;
 
-               hash = 97 * hash + Objects.hashCode(this.getOpeningId());
+               hash = 97 * hash + Objects.hashCode(this.getOpeningTimeId());
                hash = 97 * hash + Objects.hashCode(this.getOpeningStartDay());
                hash = 97 * hash + Objects.hashCode(this.getOpeningEndDay());
                hash = 97 * hash + Objects.hashCode(this.getOpeningStartTime());
index 404f635a94a80c8c5e12745345ca960d5cbccff7..e8b2ea91703303521693ffc49211cd1e7d7c9ae1 100644 (file)
@@ -46,14 +46,14 @@ public interface OpeningTime extends Comparable<OpeningTime>, Serializable {
         * <p>
         * @return Id number
         */
-       Long getOpeningId ();
+       Long getOpeningTimeId ();
 
        /**
         * Setter for id number
         * <p>
-        * @param openingId Id number
+        * @param openingTimeId Id number
         */
-       void setOpeningId (final Long openingId);
+       void setOpeningTimeId (final Long openingTimeId);
 
        /**
         * Getter for starting day