From 2fdccc2d1baeb305612a09bdc3eaa731b63eb312 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 1 Nov 2017 21:30:23 +0100 Subject: [PATCH] Continued: - findById() is no longer used as this should now done entirely by the application as these kinds of "lookups" are causing "expensive" EJB calls. - renamed remote interface as there will be no other headquarters than for companies - added remote interface for administrative purposes for headquarters data MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../AdminHeadquartersSessionBeanRemote.java | 45 +++++++++++++++++++ ...ava => HeadquartersSessionBeanRemote.java} | 18 +++----- 2 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 src/org/mxchange/jcontactsbusiness/model/headquarters/AdminHeadquartersSessionBeanRemote.java rename src/org/mxchange/jcontactsbusiness/model/headquarters/{CompanyHeadquartersSessionBeanRemote.java => HeadquartersSessionBeanRemote.java} (56%) diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/AdminHeadquartersSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/AdminHeadquartersSessionBeanRemote.java new file mode 100644 index 0000000..14c3e59 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/AdminHeadquartersSessionBeanRemote.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.headquarters; + +import java.io.Serializable; +import javax.ejb.Remote; +import org.mxchange.jcontactsbusiness.exceptions.headquarters.HeadquartersAlreadyAddedException; + +/** + * An administrative remote interface for company headquarters data + *

+ * @author Roland Häder + */ +@Remote +public interface AdminHeadquartersSessionBeanRemote extends Serializable { + + /** + * Adds given headquarters entity to persistence. If the headquarters' + * address was already added, a proper exception is thrown. The parameter is + * validated before being accepted like that branchId is not set. + *

+ * @param headquarters Headquarters instance + *

+ * @return Updated headquarters instance + *

+ * @throws HeadquartersAlreadyAddedException If the headquarters' address + * was already added + */ + Headquarters addHeadquarters (final Headquarters headquarters) throws HeadquartersAlreadyAddedException; + +} diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersSessionBeanRemote.java similarity index 56% rename from src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersSessionBeanRemote.java rename to src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersSessionBeanRemote.java index 4d968e0..12c2534 100644 --- a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersSessionBeanRemote.java +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersSessionBeanRemote.java @@ -16,29 +16,23 @@ */ package org.mxchange.jcontactsbusiness.model.headquarters; -import org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; import java.io.Serializable; +import java.util.List; import javax.ejb.Remote; -import org.mxchange.jcontactsbusiness.exceptions.headquarters.CompanyHeadquartersNotFoundException; /** - * A remote interface for company headquarters data + * A general remote interface for company headquarters data *

* @author Roland Häder */ @Remote -public interface CompanyHeadquartersSessionBeanRemote extends Serializable { +public interface HeadquartersSessionBeanRemote extends Serializable { /** - * Tries to find company headquarters data by given id number. If not found, - * a proper exception is thrown. + * Returns a list of all headquarters *

- * @param headquartersId

- * @return Headquarters data entity - *

- * @throws CompanyHeadquartersNotFoundException If no headquarters data - * could be found + * @return A list of all headquarters */ - HeadquartersData findCompanyHeadquartersById (final Long headquartersId) throws CompanyHeadquartersNotFoundException; + List allHeadquarters (); } -- 2.39.5