From: Roland Häder Date: Thu, 16 Apr 2020 15:45:14 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c7b1c4d06796a9034b3f58cb41c29fe6c16f4d14;p=jcontacts-business-core.git Continued: - 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 --- diff --git a/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java b/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java index 5918338..5266883 100644 --- a/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java +++ b/src/org/mxchange/jcontactsbusiness/events/opening_time/added/OpeningTimeAddedEvent.java @@ -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 diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/Employable.java b/src/org/mxchange/jcontactsbusiness/model/employee/Employable.java index e29fb18..4d4d357 100644 --- a/src/org/mxchange/jcontactsbusiness/model/employee/Employable.java +++ b/src/org/mxchange/jcontactsbusiness/model/employee/Employable.java @@ -37,14 +37,14 @@ public interface Employable extends Comparable, Serializable { /** * Getter for employee's branch office *

- * @return Employable's branch office + * @return Employee's branch office */ BranchOffice getEmployeeBranchOffice (); /** * Setter for employee's branch office *

- * @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, Serializable { /** * Getter for employee's department *

- * @return Employable's department + * @return Employee's department */ Department getEmployeeDepartment (); /** * Setter for employee's department *

- * @param employeeDepartment Employable's department + * @param employeeDepartment Employee's department */ void setEmployeeDepartment (final Department employeeDepartment); /** * Getter for employee's head quarters *

- * @return Employable's head quarters + * @return Employee's head quarters */ Headquarter getEmployeeHeadquarter (); /** * Getter for employee's head quarters *

- * @param employeeHeadquarter Employable's head quarters + * @param employeeHeadquarter Employee's head quarters */ void setEmployeeHeadquarter (final Headquarter employeeHeadquarter); /** * Getter for employee's email address *

- * @return Employable's email address + * @return Employee's email address */ String getEmployeeEmailAddress (); /** * Setter for employee's email address *

- * @param employeeEmailAddress Employable's email address + * @param employeeEmailAddress Employee's email address */ void setEmployeeEmailAddress (final String employeeEmailAddress); /** * Getter for employee's id number *

- * @return Employable's id number + * @return Employee's id number */ Long getEmployeeId (); /** * Setter for employee's id number *

- * @param employeeId Employable's id number + * @param employeeId Employee's id number */ void setEmployeeId (final Long employeeId); /** * Getter for employee's mobile number *

- * @return Employable's mobile number + * @return Employee's mobile number */ DialableMobileNumber getEmployeeMobileNumber (); /** * Setter for employee's mobile number *

- * @param employeeMobileNumber Employable's mobile number + * @param employeeMobileNumber Employee's mobile number */ void setEmployeeMobileNumber (final DialableMobileNumber employeeMobileNumber); /** * Getter for employee's number *

- * @return Employable's number + * @return Employee's number */ String getEmployeeNumber (); /** * Setter for employee's number *

- * @param employeeNumber Employable's number + * @param employeeNumber Employee's number */ void setEmployeeNumber (final String employeeNumber); /** * Getter for employee's personal data *

- * @return Employable's personal data + * @return Employee's personal data */ Contact getEmployeePersonalData (); /** * Setter for employee's personal data *

- * @param employeePersonalData Employable's personal data + * @param employeePersonalData Employee's personal data */ void setEmployeePersonalData (final Contact employeePersonalData); /** * Getter for employee's phone number/extension *

- * @return Employable's phone number/extension + * @return Employee's phone number/extension */ Integer getEmployeePhoneExtension (); /** * Setter for employee's phone number/extension *

- * @param employeePhoneExtension Employable's phone number/extension + * @param employeePhoneExtension Employee's phone number/extension */ void setEmployeePhoneExtension (final Integer employeePhoneExtension); /** * Getter for employee's position *

- * @return Employable's position + * @return Employee's position */ HireableJobPosition getEmployeeJobPosition (); /** * Setter for employee's position *

- * @param employeePosition Employable's position + * @param employeePosition Employee's position */ void setEmployeeJobPosition (final HireableJobPosition employeePosition); diff --git a/src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java b/src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java index b42bf30..611f774 100644 --- a/src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java +++ b/src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java @@ -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()); diff --git a/src/org/mxchange/jcontactsbusiness/model/opening_time/OpeningTime.java b/src/org/mxchange/jcontactsbusiness/model/opening_time/OpeningTime.java index 404f635..e8b2ea9 100644 --- a/src/org/mxchange/jcontactsbusiness/model/opening_time/OpeningTime.java +++ b/src/org/mxchange/jcontactsbusiness/model/opening_time/OpeningTime.java @@ -46,14 +46,14 @@ public interface OpeningTime extends Comparable, Serializable { *

* @return Id number */ - Long getOpeningId (); + Long getOpeningTimeId (); /** * Setter for id number *

- * @param openingId Id number + * @param openingTimeId Id number */ - void setOpeningId (final Long openingId); + void setOpeningTimeId (final Long openingTimeId); /** * Getter for starting day