From: Roland Häder Date: Wed, 1 Nov 2017 20:30:23 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2fdccc2d1baeb305612a09bdc3eaa731b63eb312;p=jcontacts-business-lib.git 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 Signed-off-by: Roland Häder --- 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/CompanyHeadquartersSessionBeanRemote.java deleted file mode 100644 index 4d968e0..0000000 --- a/src/org/mxchange/jcontactsbusiness/model/headquarters/CompanyHeadquartersSessionBeanRemote.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 org.mxchange.jcontactsbusiness.model.headquarters.HeadquartersData; -import java.io.Serializable; -import javax.ejb.Remote; -import org.mxchange.jcontactsbusiness.exceptions.headquarters.CompanyHeadquartersNotFoundException; - -/** - * A remote interface for company headquarters data - *

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

- * @param headquartersId

- * @return Headquarters data entity - *

- * @throws CompanyHeadquartersNotFoundException If no headquarters data - * could be found - */ - HeadquartersData findCompanyHeadquartersById (final Long headquartersId) throws CompanyHeadquartersNotFoundException; - -} diff --git a/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersSessionBeanRemote.java b/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersSessionBeanRemote.java new file mode 100644 index 0000000..12c2534 --- /dev/null +++ b/src/org/mxchange/jcontactsbusiness/model/headquarters/HeadquartersSessionBeanRemote.java @@ -0,0 +1,38 @@ +/* + * 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 java.util.List; +import javax.ejb.Remote; + +/** + * A general remote interface for company headquarters data + *

+ * @author Roland Häder + */ +@Remote +public interface HeadquartersSessionBeanRemote extends Serializable { + + /** + * Returns a list of all headquarters + *

+ * @return A list of all headquarters + */ + List allHeadquarters (); + +}