From 37be90ce335c5da949af59beb0bee54b8822ec8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 7 Oct 2017 22:07:37 +0200 Subject: [PATCH] Continued: - renamed CompanyDepartment -> Department, there will be no fire department or so - added remote session beans (general/admin) for opening times with some methods - removed unused imports MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../AdminBranchOfficeSessionBeanRemote.java | 3 +- .../BranchOfficeSessionBeanRemote.java | 2 +- .../AdminDepartmentSessionBeanRemote.java | 45 ++++++++++++++++ ....java => DepartmentSessionBeanRemote.java} | 12 ++--- .../CompanyEmployeeSessionBeanRemote.java | 1 - .../AdminOpeningTimesSessionBeanRemote.java} | 17 ++++-- .../OpeningTimesSessionBeanRemote.java | 53 +++++++++++++++++++ 7 files changed, 120 insertions(+), 13 deletions(-) create mode 100644 src/org/mxchange/jcontactsbusiness/model/department/AdminDepartmentSessionBeanRemote.java rename src/org/mxchange/jcontactsbusiness/model/department/{CompanyDepartmentSessionBeanRemote.java => DepartmentSessionBeanRemote.java} (79%) rename src/org/mxchange/jcontactsbusiness/model/{department/AdminCompanyDepartmentSessionBeanRemote.java => opening_times/AdminOpeningTimesSessionBeanRemote.java} (59%) create mode 100644 src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimesSessionBeanRemote.java diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/AdminBranchOfficeSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/AdminBranchOfficeSessionBeanRemote.java index c1eda41..0a5c06e 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/AdminBranchOfficeSessionBeanRemote.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/AdminBranchOfficeSessionBeanRemote.java @@ -16,13 +16,12 @@ */ package org.mxchange.jcontactsbusiness.model.branchoffice; -import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import java.io.Serializable; import javax.ejb.Remote; import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeAlreadyAddedException; /** - * A remote interface for business contact data + * A remote interface for branch offices *

* @author Roland Häder */ diff --git a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeSessionBeanRemote.java index e371ddd..7a70924 100644 --- a/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeSessionBeanRemote.java +++ b/src/org/mxchange/jcontactsbusiness/model/branchoffice/BranchOfficeSessionBeanRemote.java @@ -22,7 +22,7 @@ import javax.ejb.Remote; import org.mxchange.jcontactsbusiness.exceptions.branchoffice.BranchOfficeNotFoundException; /** - * A remote interface for business contact data + * A remote interface for branch offices *

* @author Roland Häder */ diff --git a/src/org/mxchange/jcontactsbusiness/model/department/AdminDepartmentSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/department/AdminDepartmentSessionBeanRemote.java new file mode 100644 index 0000000..ad424d9 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/department/AdminDepartmentSessionBeanRemote.java @@ -0,0 +1,45 @@ +/* + * 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 . + */ +package org.mxchange.jcontactsbusiness.model.department; + +import java.io.Serializable; +import javax.ejb.Remote; +import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentAlreadyAddedException; + +/** + * A remote interface for departments + *

+ * @author Roland Häder + */ +@Remote +public interface AdminDepartmentSessionBeanRemote extends Serializable { + + /** + * Adds a given department instance to the database. If it is already found + * (department name and company in combination), then throw a proper + * exception. + *

+ * @param department Department instance to add + *

+ * @return Updated department instance + *

+ * @throws DepartmentAlreadyAddedException If the department is already + * added + */ + Department addDepartment (final Department department) throws DepartmentAlreadyAddedException; + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartmentSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/department/DepartmentSessionBeanRemote.java similarity index 79% rename from src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartmentSessionBeanRemote.java rename to src/org/mxchange/jcontactsbusiness/model/department/DepartmentSessionBeanRemote.java index 4b6f6e8..53281e9 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/CompanyDepartmentSessionBeanRemote.java +++ b/src/org/mxchange/jcontactsbusiness/model/department/DepartmentSessionBeanRemote.java @@ -19,15 +19,15 @@ package org.mxchange.jcontactsbusiness.model.department; import java.io.Serializable; import java.util.List; import javax.ejb.Remote; -import org.mxchange.jcontactsbusiness.exceptions.department.CompanyDepartmentNotFoundException; +import org.mxchange.jcontactsbusiness.exceptions.department.DepartmentNotFoundException; /** - * A remote interface for business contact data + * A remote interface for departments *

* @author Roland Häder */ @Remote -public interface CompanyDepartmentSessionBeanRemote extends Serializable { +public interface DepartmentSessionBeanRemote extends Serializable { /** * Retrieves a single company department entity for given id number or @@ -37,10 +37,10 @@ public interface CompanyDepartmentSessionBeanRemote extends Serializable { *

* @return Company department instance *

- * @throws CompanyDepartmentNotFoundException If the id number could not be + * @throws DepartmentNotFoundException If the id number could not be * looked up and solved into an entity */ - Department findDepartmentById (final Long departmentId) throws CompanyDepartmentNotFoundException; + Department findDepartmentById (final Long departmentId) throws DepartmentNotFoundException; /** * Returns a list, even empty if not thing found, from all company @@ -48,6 +48,6 @@ public interface CompanyDepartmentSessionBeanRemote extends Serializable { *

* @return A list with all company departments */ - List allCompanyDepartments (); + List allDepartments (); } diff --git a/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployeeSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployeeSessionBeanRemote.java index 8c0479b..f51b26f 100644 --- a/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployeeSessionBeanRemote.java +++ b/src/org/mxchange/jcontactsbusiness/model/employee/CompanyEmployeeSessionBeanRemote.java @@ -16,7 +16,6 @@ */ package org.mxchange.jcontactsbusiness.model.employee; -import org.mxchange.jcontactsbusiness.model.employee.Employee; import java.io.Serializable; import java.util.List; import javax.ejb.Remote; diff --git a/src/org/mxchange/jcontactsbusiness/model/department/AdminCompanyDepartmentSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/opening_times/AdminOpeningTimesSessionBeanRemote.java similarity index 59% rename from src/org/mxchange/jcontactsbusiness/model/department/AdminCompanyDepartmentSessionBeanRemote.java rename to src/org/mxchange/jcontactsbusiness/model/opening_times/AdminOpeningTimesSessionBeanRemote.java index 2f12edc..515faa1 100644 --- a/src/org/mxchange/jcontactsbusiness/model/department/AdminCompanyDepartmentSessionBeanRemote.java +++ b/src/org/mxchange/jcontactsbusiness/model/opening_times/AdminOpeningTimesSessionBeanRemote.java @@ -14,17 +14,28 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.jcontactsbusiness.model.department; +package org.mxchange.jcontactsbusiness.model.opening_times; import java.io.Serializable; import javax.ejb.Remote; /** - * A remote interface for business contact data + * A remote interface for opening times *

* @author Roland Häder */ @Remote -public interface AdminCompanyDepartmentSessionBeanRemote extends Serializable { +public interface AdminOpeningTimesSessionBeanRemote extends Serializable { + + /** + * Adds a given opening time instance to the database. Please note that this + * method will add opening time regardless if found as it is not assigned to + * any other entity (at this point of time). + *

+ * @param openingTime OpeningTime instance to add + *

+ * @return Updated opening time instance + */ + OpeningTimes addOpeningTime (final OpeningTimes openingTime); } diff --git a/src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimesSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimesSessionBeanRemote.java new file mode 100644 index 0000000..8172557 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/opening_times/OpeningTimesSessionBeanRemote.java @@ -0,0 +1,53 @@ +/* + * 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 . + */ +package org.mxchange.jcontactsbusiness.model.opening_times; + +import java.io.Serializable; +import java.util.List; +import javax.ejb.Remote; +import org.mxchange.jcontactsbusiness.exceptions.opening_times.OpeningTimesNotFoundException; + +/** + * A remote interface for opening times + *

+ * @author Roland Häder + */ +@Remote +public interface OpeningTimesSessionBeanRemote extends Serializable { + + /** + * Retrieves a single company department entity for given id number or + * throws a proper exception if not found. + *

+ * @param openingId Company department id to lookup + *

+ * @return Company department instance + *

+ * @throws OpeningTimesNotFoundException If the id number could not be looked + * up and solved into an entity + */ + OpeningTimes findOpeningTimesById (final Long openingId) throws OpeningTimesNotFoundException; + + /** + * Returns a list, even empty if not thing found, from all opening times. + * NULL should not be returned by this method. + *

+ * @return A list with all opening times + */ + List allOpeningTimes (); + +} -- 2.39.5