From: Roland Häder Date: Sun, 15 Oct 2017 20:04:09 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fdadac1786fd8d883960d462f11b224a57ecdcc9;p=jproduct-lib.git Continued: - removed no longer thrown exception as this has been generalized (usual way accross all projects) - added new business method findCategoryById() - added new business method findProductById() Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jproduct/model/category/AdminCategorySessionBeanRemote.java b/src/org/mxchange/jproduct/model/category/AdminCategorySessionBeanRemote.java index 0abd8a9..e2e00a7 100644 --- a/src/org/mxchange/jproduct/model/category/AdminCategorySessionBeanRemote.java +++ b/src/org/mxchange/jproduct/model/category/AdminCategorySessionBeanRemote.java @@ -18,8 +18,7 @@ package org.mxchange.jproduct.model.category; import java.io.Serializable; import javax.ejb.Remote; -import org.mxchange.jproduct.exceptions.CannotAddCategoryException; -import org.mxchange.jproduct.exceptions.CategoryTitleAlreadyUsedException; +import org.mxchange.jproduct.exceptions.category.CategoryAlreadyAddedException; /** * An interface for categories for "ADMIN" role. @@ -36,10 +35,8 @@ public interface AdminCategorySessionBeanRemote extends Serializable { *

* @return Updated category instance *

- * @throws CategoryTitleAlreadyUsedException If the given title is already - * used - * @throws CannotAddCategoryException If the category cannot be added + * @throws CategoryAlreadyAddedException If the category cannot be added */ - Category doAdminAddCategory (final Category category) throws CategoryTitleAlreadyUsedException, CannotAddCategoryException; + Category doAdminAddCategory (final Category category) throws CategoryAlreadyAddedException; } diff --git a/src/org/mxchange/jproduct/model/category/CategorySessionBeanRemote.java b/src/org/mxchange/jproduct/model/category/CategorySessionBeanRemote.java index 2f991b5..468adf5 100644 --- a/src/org/mxchange/jproduct/model/category/CategorySessionBeanRemote.java +++ b/src/org/mxchange/jproduct/model/category/CategorySessionBeanRemote.java @@ -19,6 +19,7 @@ package org.mxchange.jproduct.model.category; import java.io.Serializable; import java.util.List; import javax.ejb.Remote; +import org.mxchange.jproduct.exceptions.category.CategoryNotFoundException; /** * A remote-call interface for the shop @@ -28,6 +29,19 @@ import javax.ejb.Remote; @Remote public interface CategorySessionBeanRemote extends Serializable { + /** + * Returns a category instance (entity) for given primary key. If not found, + * a proper exception is thrown. + *

+ * @param categoryId Category id (primary key) + *

+ * @return Category entity matching to primary key + *

+ * @throws CategoryNotFoundException If a category with given primary key + * could not be found + */ + Category findCategoryById (final Long categoryId) throws CategoryNotFoundException; + /** * Some "getter" for a linked list of all categories *

diff --git a/src/org/mxchange/jproduct/model/product/AdminProductSessionBeanRemote.java b/src/org/mxchange/jproduct/model/product/AdminProductSessionBeanRemote.java index a4224af..8c3c179 100644 --- a/src/org/mxchange/jproduct/model/product/AdminProductSessionBeanRemote.java +++ b/src/org/mxchange/jproduct/model/product/AdminProductSessionBeanRemote.java @@ -18,8 +18,7 @@ package org.mxchange.jproduct.model.product; import java.io.Serializable; import javax.ejb.Remote; -import org.mxchange.jproduct.exceptions.CannotAddProductException; -import org.mxchange.jproduct.exceptions.ProductTitleAlreadyUsedException; +import org.mxchange.jproduct.exceptions.product.ProductAlreadyAddedException; /** * Product interface for "ADMIN" role @@ -36,10 +35,8 @@ public interface AdminProductSessionBeanRemote extends Serializable { *

* @return Updated product instance *

- * @throws ProductTitleAlreadyUsedException If the given product title is - * already used - * @throws CannotAddProductException If something unexpected happened + * @throws ProductAlreadyAddedException If something unexpected happened */ - Product doAdminAddProduct (final Product product) throws ProductTitleAlreadyUsedException, CannotAddProductException; + Product doAdminAddProduct (final Product product) throws ProductAlreadyAddedException; } diff --git a/src/org/mxchange/jproduct/model/product/ProductSessionBeanRemote.java b/src/org/mxchange/jproduct/model/product/ProductSessionBeanRemote.java index f3ff691..109323c 100644 --- a/src/org/mxchange/jproduct/model/product/ProductSessionBeanRemote.java +++ b/src/org/mxchange/jproduct/model/product/ProductSessionBeanRemote.java @@ -19,6 +19,7 @@ package org.mxchange.jproduct.model.product; import java.io.Serializable; import java.util.List; import javax.ejb.Remote; +import org.mxchange.jproduct.exceptions.product.ProductNotFoundException; /** * An interface for non-administrative purposes @@ -28,6 +29,19 @@ import javax.ejb.Remote; @Remote public interface ProductSessionBeanRemote extends Serializable { + /** + * Returns a product instance (entity) for given primary key. If not found, + * a proper exception is thrown. + *

+ * @param productId Product id (primary key) + *

+ * @return Product entity matching to primary key + *

+ * @throws ProductNotFoundException If a product with given primary key + * could not be found + */ + Product findProductById (final Long productId) throws ProductNotFoundException; + /** * Returns a list of all products *