--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.events.department.added;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.model.department.Department;
+
+/**
+ * An event being fired when a department has been added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class DepartmentAddedEvent implements ObservableDepartmentAddedEvent {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 572_367_561_659_110L;
+
+ /**
+ * Branch office instance being added
+ */
+ private final Department department;
+
+ /**
+ * Constructor with department instance
+ * <p>
+ * @param department Branch office instance
+ * @throws NullPointerException If the parameter is null
+ */
+ public DepartmentAddedEvent (final Department department) {
+ // Check parameter
+ if (null == department) {
+ // Throw NPE
+ throw new NullPointerException("department is null"); //NOI18N
+ } else if (department.getDepartmentId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("department.departmentId is null"); //NOI18N
+ } else if (department.getDepartmentId() < 1) {
+ // Throw NPE again
+ throw new NullPointerException(MessageFormat.format("department.departmentId={0} is not valid", department.getDepartmentId())); //NOI18N
+ }
+
+ // Set it
+ this.department = department;
+ }
+
+ @Override
+ public Department getDepartment () {
+ return this.department;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.events.department.added;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.model.department.Department;
+
+/**
+ * An interface for events being triggered when a department has been added.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface ObservableDepartmentAddedEvent extends Serializable {
+
+ /**
+ * Getter for department instance
+ * <p>
+ * @return Department instance
+ */
+ Department getDepartment ();
+
+}
import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
/**
- * Thrown if the given BusinessBasicData instance is already added
+ * Thrown if the given branch office instance is already added
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
}
/**
- * Default constructor, may be used if no contact instance is available
+ * Default constructor, may be used if no branch office instance is available
*/
public BranchOfficeAlreadyAddedException () {
super("Branch office already added"); //NOI18N
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.exceptions.department;
-
-import java.text.MessageFormat;
-import org.mxchange.jcontactsbusiness.model.department.Department;
-
-/**
- * Thrown if the given BusinessBasicData instance is already added
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CompanyDepartmentAlreadyAddedException extends Exception {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 129_075_844_851_468L;
-
- /**
- * Constructor with a company department instance
- * <p>
- * @param department Company department that is already found
- */
- public CompanyDepartmentAlreadyAddedException (final Department department) {
- super(MessageFormat.format("Company department with name {0} already created.", department.getDepartmentName()));
- }
-
- /**
- * Default constructor, may be used if no contact instance is available
- */
- public CompanyDepartmentAlreadyAddedException () {
- super("Company department already added"); //NOI18N
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016, 2017 Roland Häder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcontactsbusiness.exceptions.department;
-
-import java.text.MessageFormat;
-
-/**
- * An exception thrown when a company department (entity) has not found.
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class CompanyDepartmentNotFoundException extends Exception {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 23_759_801_876_416_573L;
-
- /**
- * Constructor with company department id
- * <p>
- * @param departmentId Company department id
- */
- public CompanyDepartmentNotFoundException (final Long departmentId) {
- // Call super constructor with message and cause
- super(MessageFormat.format("Company department with id {0} was not found.", departmentId)); //NOI18N
- }
-
- /**
- * Constructor with company department id and causing exception
- * <p>
- * @param departmentId Company department id
- * @param cause Causing exception
- */
- public CompanyDepartmentNotFoundException (final Long departmentId, final Throwable cause) {
- // Call super constructor with message and cause
- super(MessageFormat.format("Company department with id {0} was not found.", departmentId), cause); //NOI18N
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.exceptions.department;
+
+import java.text.MessageFormat;
+import org.mxchange.jcontactsbusiness.model.department.Department;
+
+/**
+ * Thrown if the given BusinessBasicData instance is already added
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class DepartmentAlreadyAddedException extends Exception {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 129_075_844_851_468L;
+
+ /**
+ * Constructor with a company department instance
+ * <p>
+ * @param department Company department that is already found
+ */
+ public DepartmentAlreadyAddedException (final Department department) {
+ super(MessageFormat.format("Company department with name {0} already created.", department.getDepartmentName()));
+ }
+
+ /**
+ * Default constructor, may be used if no contact instance is available
+ */
+ public DepartmentAlreadyAddedException () {
+ super("Company department already added"); //NOI18N
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.exceptions.department;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when a company department (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class DepartmentNotFoundException extends Exception {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 23_759_801_876_416_573L;
+
+ /**
+ * Constructor with company department id
+ * <p>
+ * @param departmentId Company department id
+ */
+ public DepartmentNotFoundException (final Long departmentId) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Company department with id {0} was not found.", departmentId)); //NOI18N
+ }
+
+ /**
+ * Constructor with company department id and causing exception
+ * <p>
+ * @param departmentId Company department id
+ * @param cause Causing exception
+ */
+ public DepartmentNotFoundException (final Long departmentId, final Throwable cause) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Company department with id {0} was not found.", departmentId), cause); //NOI18N
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016, 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.exceptions.opening_times;
+
+import java.text.MessageFormat;
+
+/**
+ * An exception thrown when an opening time (entity) has not found.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class OpeningTimesNotFoundException extends Exception {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 23_759_801_876_416_573L;
+
+ /**
+ * Constructor with opening time id
+ * <p>
+ * @param openingId Opening time id
+ */
+ public OpeningTimesNotFoundException (final Long openingId) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Opening time with id {0} was not found.", openingId)); //NOI18N
+ }
+
+ /**
+ * Constructor with opening time id and causing exception
+ * <p>
+ * @param openingId Opening time id
+ * @param cause Causing exception
+ */
+ public OpeningTimesNotFoundException (final Long openingId, final Throwable cause) {
+ // Call super constructor with message and cause
+ super(MessageFormat.format("Opening time with id {0} was not found.", openingId), cause); //NOI18N
+ }
+
+}
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
*/
@Entity (name = "company_departments")
@Table (name = "company_departments")
+@NamedQueries (
+ {
+ @NamedQuery (name = "AllDepartments", query = "SELECT d FROM company_departments AS d ORDER BY d.departmentId ASC")
+ }
+)
@SuppressWarnings ("PersistenceUnitPresent")
public class CompanyDepartment implements Department {
@Transient
private static final long serialVersionUID = 94_835_918_958_717_660L;
- /**
- * Where this department is located
- */
- @JoinColumn (name = "department_headquarters_id")
- @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
- private HeadquartersData departentHeadquarters;
-
/**
* Where this department is located
*/
*/
@Basic (optional = false)
@Temporal (TemporalType.TIMESTAMP)
- @Column (name = "department_entry_created", nullable = false, updatable = false)
+ @Column (name = "department_created", nullable = false, updatable = false)
private Date departmentCreated;
+ /**
+ * Where this department is located
+ */
+ @JoinColumn (name = "department_headquarters_id")
+ @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
+ private HeadquartersData departmentHeadquarters;
+
/**
* Id number
*/
/**
* Department lead employee
*/
- @JoinColumn (name = "department_lead_id", nullable = false)
+ @JoinColumn (name = "department_lead_id")
@OneToOne (targetEntity = CompanyEmployee.class, cascade = CascadeType.ALL)
private Employee departmentLead;
/**
* User owner instance
*/
- @JoinColumn (name = "department_user_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH, optional = false)
+ @JoinColumn (name = "department_user_id")
+ @OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
private User departmentUserOwner;
+ /**
+ * Default constructor
+ */
+ public CompanyDepartment () {
+ }
+
+ /**
+ * Constructor with all required fields
+ * <p>
+ * @param departmentCompany Basic data instance
+ * @param departmentName Department name
+ */
+ public CompanyDepartment (final BusinessBasicData departmentCompany, final String departmentName) {
+ // Call other constructor
+ this();
+
+ // Validate parameter
+ if (null == departmentCompany) {
+ // Throw NPE
+ throw new NullPointerException("departmentCompany is null"); //NOI18N
+ } else if (null == departmentName) {
+ // Throw it again
+ throw new NullPointerException("departmentName is null"); //NOI18N
+ } else if (departmentName.isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("departmentName is empty"); //NOI18N
+ }
+
+ // Set all fields
+ this.departmentCompany = departmentCompany;
+ this.departmentName = departmentName;
+ }
+
@Override
public boolean equals (final Object object) {
if (null == object) {
return true;
}
- @Override
- public HeadquartersData getDepartentHeadquarters () {
- return this.departentHeadquarters;
- }
-
- @Override
- public void setDepartentHeadquarters (final HeadquartersData departentHeadquarters) {
- this.departentHeadquarters = departentHeadquarters;
- }
-
@Override
public BranchOffice getDepartmentBranchOffice () {
return this.departmentBranchOffice;
this.departmentCreated = departmentCreated;
}
+ @Override
+ public HeadquartersData getDepartmentHeadquarters () {
+ return this.departmentHeadquarters;
+ }
+
+ @Override
+ public void setDepartmentHeadquarters (final HeadquartersData departmentHeadquarters) {
+ this.departmentHeadquarters = departmentHeadquarters;
+ }
+
@Override
public Long getDepartmentId () {
return this.departmentId;
* <p>
* @return Connection to company headquarters
*/
- HeadquartersData getDepartentHeadquarters ();
+ HeadquartersData getDepartmentHeadquarters ();
/**
* Setter for connection to company headquarters
* <p>
- * @param departentHeadquarters Connection to company headquarters
+ * @param departmentHeadquarters Connection to company headquarters
*/
- void setDepartentHeadquarters (final HeadquartersData departentHeadquarters);
+ void setDepartmentHeadquarters (final HeadquartersData departmentHeadquarters);
/**
* Getter for connection to company branch office
--- /dev/null
+/*
+ * Copyright (C) 2017 Roland Häder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcontactsbusiness.model.department;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * Utilities class for departments
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class Departments implements Serializable {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 20_154_686_786_561L;
+
+ /**
+ * Checks if both departments are the same (entity) or if at least basic
+ * company data and department name are matching.
+ * <p>
+ * @param department1 Department 1
+ * @param department2 Department 2
+ * <p>
+ * @return Whether both are the same
+ */
+ public static boolean isSameDepartment (final Department department1, final Department department2) {
+ // Now check it
+ if (null == department1) {
+ // Throw NPE
+ throw new NullPointerException("department1 is null"); //NOI18N
+ } else if (null == department2) {
+ // Throw it again
+ throw new NullPointerException("department2 is null"); //NOI18N
+ } else if (Objects.equals(department1, department2)) {
+ // Same department
+ return true;
+ } else if (department1.getDepartmentCompany() == null) {
+ // Throw NPE again
+ throw new NullPointerException("department1.departmentCompany is null"); //NOI18N
+ } else if (department1.getDepartmentName() == null) {
+ // Throw it again
+ throw new NullPointerException("department1.departmentName is null"); //NOI18N
+ } else if (department1.getDepartmentName().isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("department1.departmentName is empty"); //NOI18N
+ } else if (department2.getDepartmentCompany() == null) {
+ // Throw NPE again
+ throw new NullPointerException("department2.departmentCompany is null"); //NOI18N
+ } else if (department2.getDepartmentName() == null) {
+ // Throw it again
+ throw new NullPointerException("department2.departmentName is null"); //NOI18N
+ } else if (department2.getDepartmentName().isEmpty()) {
+ // Throw IAE
+ throw new IllegalArgumentException("department2.departmentName is empty"); //NOI18N
+ }
+
+ // Same company and same name?
+ boolean isSame = ((Objects.equals(department1.getDepartmentCompany(), department2.getDepartmentCompany())) &&
+ (Objects.equals(department1.getDepartmentName(), department2.getDepartmentName())));
+
+ // Return it
+ return isSame;
+ }
+
+ /**
+ * Private default constructor
+ */
+ private Departments () {
+ // Prevent instances from utilities classes
+ }
+
+}
* Branch office (if the employee works there)
*/
@JoinColumn (name = "employee_branch_id")
- @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.ALL)
+ @OneToOne (targetEntity = CompanyBranchOffice.class, cascade = CascadeType.REFRESH)
private BranchOffice employeeBranchOffice;
/**
* Company the employee is working at
*/
@JoinColumn (name = "employee_company_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.ALL, optional = false)
+ @OneToOne (targetEntity = CompanyBasicData.class, cascade = CascadeType.REFRESH, optional = false)
private BusinessBasicData employeeCompany;
/**
* Department the employee works at
*/
@JoinColumn (name = "employee_department_id")
- @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.ALL)
+ @OneToOne (targetEntity = CompanyDepartment.class, cascade = CascadeType.REFRESH)
private Department employeeDepartment;
/**
* Head quarters id number (if the employee works there)
*/
@JoinColumn (name = "employee_headquarters_id")
- @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.ALL)
+ @OneToOne (targetEntity = CompanyHeadquartersData.class, cascade = CascadeType.REFRESH)
private HeadquartersData employeeHeadquarter;
/**
* Employee's business mobile number
*/
@JoinColumn (name = "employee_mobile_number_id")
- @OneToOne (targetEntity = MobileNumber.class, cascade = CascadeType.ALL)
+ @OneToOne (targetEntity = MobileNumber.class, cascade = CascadeType.REFRESH)
private DialableMobileNumber employeeMobileNumber;
/**
/**
* Employee's personal data
*/
- @JoinColumn (name = "employee_personal_data_id", nullable = false, updatable = false)
- @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false)
+ @JoinColumn (name = "employee_personal_data_id")
+ @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.REFRESH)
private Contact employeePersonalData;
/**
@OneToOne (targetEntity = LoginUser.class, cascade = CascadeType.REFRESH)
private User employeeUserOwner;
+ /**
+ * Default constructor
+ */
+ public CompanyEmployee () {
+ }
+
+ public CompanyEmployee (final BusinessBasicData employeeCompany, final String employeeNumber, final Contact employeePersonalData) {
+ // Call other constructor
+ this();
+
+ // Validate parameter
+ if (null == employeeCompany) {
+ // Throw NPE
+ throw new NullPointerException("employeeCompany is null"); //NOI18N
+ } else if (((null == employeeNumber) || (employeeNumber.isEmpty()) && (null == employeePersonalData))) {
+ // At least one must be given
+ throw new NullPointerException("employeeNumber or employeeContact must be set."); //NOI18N
+ }
+
+ // Set all fields
+ this.employeeCompany = employeeCompany;
+ this.employeeNumber = employeeNumber;
+ this.employeePersonalData = employeePersonalData;
+ }
+
@Override
public boolean equals (final Object object) {
if (null == object) {
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
*/
@Entity (name = "company_opening_times")
@Table (name = "company_opening_times")
+@NamedQueries (
+ {
+ @NamedQuery (name = "AllOpeningTimes", query = "SELECT ot FROM company_opening_times AS ot ORDER BY ot.openingId ASC"),
+ @NamedQuery (name = "SearchOpeningTimesById", query = "SELECT ot FROM company_opening_times AS ot WHERE ot.openingId = :openingId")
+ }
+)
@SuppressWarnings ("PersistenceUnitPresent")
public class BusinessOpeningTimes implements OpeningTimes {
*/
@Column (name = "opening_times_end_day")
@Enumerated (EnumType.STRING)
- private DayOfTheWeek endDay;
+ private DayOfTheWeek openingEndDay;
/**
* Ending time (hh:mm)
@Basic (optional = false)
@Column (name = "opening_times_end_time", nullable = false)
@Temporal (TemporalType.TIME)
- private Date endTime;
+ private Date openingEndTime;
/**
* Id number
@Id
@Column (name = "opening_times_id", nullable = false, updatable = false)
@GeneratedValue (strategy = GenerationType.IDENTITY)
- private Long id;
+ private Long openingId;
/**
* Starting day of opening times
@Basic (optional = false)
@Column (name = "opening_times_start_day", nullable = false)
@Enumerated (EnumType.STRING)
- private DayOfTheWeek startDay;
+ private DayOfTheWeek openingStartDay;
/**
* Starting time (hh:mm)
@Basic (optional = false)
@Column (name = "opening_times_start_time", nullable = false)
@Temporal (TemporalType.TIME)
- private Date startTime;
+ private Date openingStartTime;
/**
* Default constructor
}
/**
- * Constructor with all field
+ * Constructor with all required field
* <p>
- * @param endDay End day
- * @param endTime End time
- * @param id Id number
- * @param startDay Start day
- * @param startTime Start time
+ * @param openingEndDay End day
+ * @param openingEndTime End time
+ * @param openingId Id number
+ * @param openingStartDay Start day
+ * @param openingStartTime Start time
*/
- public BusinessOpeningTimes (final DayOfTheWeek endDay, final Date endTime, final Long id, final DayOfTheWeek startDay, final Date startTime) {
+ public BusinessOpeningTimes (final DayOfTheWeek openingEndDay, final Date openingEndTime, final Long openingId, final DayOfTheWeek openingStartDay, final Date openingStartTime) {
// Call other constructor
- this(endDay, endTime, startDay, startTime);
+ this(openingEndDay, openingEndTime, openingStartDay, openingStartTime);
- // Set id number
- this.id = id;
+ // Set openingTimeId number
+ this.openingId = openingId;
}
/**
- * Constructor with all fields except id number
+ * Constructor with all fields except openingTimeId number
* <p>
- * @param endDay End day
- * @param endTime End time
- * @param startDay Start day
- * @param startTime Start time
+ * @param openingEndDay End day
+ * @param openingEndTime End time
+ * @param openingStartDay Start day
+ * @param openingStartTime Start time
*/
- public BusinessOpeningTimes (final DayOfTheWeek endDay, final Date endTime, final DayOfTheWeek startDay, final Date startTime) {
+ public BusinessOpeningTimes (final DayOfTheWeek openingEndDay, final Date openingEndTime, final DayOfTheWeek openingStartDay, final Date openingStartTime) {
// Set all fields
- this.endDay = endDay;
- this.endTime = endTime;
- this.startDay = startDay;
- this.startTime = startTime;
+ this.openingEndDay = openingEndDay;
+ this.openingEndTime = openingEndTime;
+ this.openingStartDay = openingStartDay;
+ this.openingStartTime = openingStartTime;
}
@Override
final OpeningTimes openingTimes = (OpeningTimes) obj;
- if (!Objects.equals(this.getId(), openingTimes.getId())) {
+ if (!Objects.equals(this.getOpeningId(), openingTimes.getOpeningId())) {
return false;
- } else if (this.getStartDay() != openingTimes.getStartDay()) {
+ } else if (this.getOpeningStartDay() != openingTimes.getOpeningStartDay()) {
return false;
- } else if (this.getEndDay() != openingTimes.getEndDay()) {
+ } else if (this.getOpeningEndDay() != openingTimes.getOpeningEndDay()) {
return false;
- } else if (!Objects.equals(this.getStartTime(), openingTimes.getStartTime())) {
+ } else if (!Objects.equals(this.getOpeningStartTime(), openingTimes.getOpeningStartTime())) {
return false;
- } else if (!Objects.equals(this.getEndTime(), openingTimes.getEndTime())) {
+ } else if (!Objects.equals(this.getOpeningEndTime(), openingTimes.getOpeningEndTime())) {
return false;
}
}
@Override
- public DayOfTheWeek getEndDay () {
- return this.endDay;
+ public DayOfTheWeek getOpeningEndDay () {
+ return this.openingEndDay;
}
@Override
- public void setEndDay (final DayOfTheWeek endDay) {
- this.endDay = endDay;
+ public void setOpeningEndDay (final DayOfTheWeek openingEndDay) {
+ this.openingEndDay = openingEndDay;
}
@Override
@SuppressWarnings ("ReturnOfDateField")
- public Date getEndTime () {
- return this.endTime;
+ public Date getOpeningEndTime () {
+ return this.openingEndTime;
}
@Override
@SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setEndTime (final Date endTime) {
- this.endTime = endTime;
+ public void setOpeningEndTime (final Date openingEndTime) {
+ this.openingEndTime = openingEndTime;
}
@Override
- public Long getId () {
- return this.id;
+ public Long getOpeningId () {
+ return this.openingId;
}
@Override
- public void setId (Long id) {
- this.id = id;
+ public void setOpeningId (final Long openingId) {
+ this.openingId = openingId;
}
@Override
- public DayOfTheWeek getStartDay () {
- return this.startDay;
+ public DayOfTheWeek getOpeningStartDay () {
+ return this.openingStartDay;
}
@Override
- public void setStartDay (final DayOfTheWeek startDay) {
- this.startDay = startDay;
+ public void setOpeningStartDay (final DayOfTheWeek openingStartDay) {
+ this.openingStartDay = openingStartDay;
}
@Override
@SuppressWarnings ("ReturnOfDateField")
- public Date getStartTime () {
- return this.startTime;
+ public Date getOpeningStartTime () {
+ return this.openingStartTime;
}
@Override
@SuppressWarnings ("AssignmentToDateFieldFromParameter")
- public void setStartTime (final Date startTime) {
- this.startTime = startTime;
+ public void setOpeningStartTime (final Date openingStartTime) {
+ this.openingStartTime = openingStartTime;
}
@Override
public int hashCode () {
int hash = 7;
- hash = 97 * hash + Objects.hashCode(this.getId());
- hash = 97 * hash + Objects.hashCode(this.getStartDay());
- hash = 97 * hash + Objects.hashCode(this.getEndDay());
- hash = 97 * hash + Objects.hashCode(this.getStartTime());
- hash = 97 * hash + Objects.hashCode(this.getEndTime());
+ hash = 97 * hash + Objects.hashCode(this.getOpeningId());
+ hash = 97 * hash + Objects.hashCode(this.getOpeningStartDay());
+ hash = 97 * hash + Objects.hashCode(this.getOpeningEndDay());
+ hash = 97 * hash + Objects.hashCode(this.getOpeningStartTime());
+ hash = 97 * hash + Objects.hashCode(this.getOpeningEndTime());
return hash;
}
* <p>
* @return Id number
*/
- Long getId ();
+ Long getOpeningId ();
/**
* Setter for id number
* <p>
- * @param id Id number
+ * @param openingId Id number
*/
- void setId (final Long id);
+ void setOpeningId (final Long openingId);
/**
* Getter for starting day
* <p>
* @return Starting day
*/
- DayOfTheWeek getStartDay ();
+ DayOfTheWeek getOpeningStartDay ();
/**
* Setter for starting day
* <p>
- * @param startDay Starting day
+ * @param openingStartDay Starting day
*/
- void setStartDay (final DayOfTheWeek startDay);
+ void setOpeningStartDay (final DayOfTheWeek openingStartDay);
/**
* Getter for ending day
* <p>
* @return Ending day
*/
- DayOfTheWeek getEndDay ();
+ DayOfTheWeek getOpeningEndDay ();
/**
* Setter for ending day
* <p>
- * @param endDay Ending day
+ * @param openinhEndDay Ending day
*/
- void setEndDay (final DayOfTheWeek endDay);
+ void setOpeningEndDay (final DayOfTheWeek openinhEndDay);
/**
* Getter for starting time
* <p>
* @return Starting time
*/
- Date getStartTime ();
+ Date getOpeningStartTime ();
/**
* Setter for starting time
* <p>
- * @param startTime Starting time
+ * @param openingStartTime Starting time
*/
- void setStartTime (final Date startTime);
+ void setOpeningStartTime (final Date openingStartTime);
/**
* Getter for ending time
* <p>
* @return Ending time
*/
- Date getEndTime ();
+ Date getOpeningEndTime ();
/**
* Setter for ending time
* <p>
- * @param endTime Ending time
+ * @param openingEndTime Ending time
*/
- void setEndTime (final Date endTime);
+ void setOpeningEndTime (final Date openingEndTime);
@Override
boolean equals (final Object obj);