From 7f349bd01d01466147db80eab55b5a9d6923b0b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 10 Apr 2020 21:45:36 +0200 Subject: [PATCH] Product-only: - WIP: rewrote admin-list-users view into ViewScoped - rewrote cache initialization to avoid a local List copy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../list/FinancialsProductListWebViewBean.java | 7 ++----- .../list/FinancialsCategoryListWebViewBean.java | 5 +---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/beans/generic_product/list/FinancialsProductListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/generic_product/list/FinancialsProductListWebViewBean.java index 28b691a9..363bad42 100644 --- a/src/java/org/mxchange/jfinancials/beans/generic_product/list/FinancialsProductListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/generic_product/list/FinancialsProductListWebViewBean.java @@ -120,7 +120,7 @@ public class FinancialsProductListWebViewBean extends BaseFinancialsBean impleme * @param event Updated product data event */ public void afterProductUpdatedEvent (@Observes final ObservableProductUpdatedEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -216,11 +216,8 @@ public class FinancialsProductListWebViewBean extends BaseFinancialsBean impleme public void init () { // Is cache there? if (!this.productCache.iterator().hasNext()) { - // Get whole list from EJB - final List products = this.productBean.allProducts(); - // "Walk" through all entries and add to cache - for (final Product product : products) { + for (final Product product : this.productBean.allProducts()) { // Add it by primary key this.productCache.put(product.getProductId(), product); } diff --git a/src/java/org/mxchange/jfinancials/beans/product_category/list/FinancialsCategoryListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/product_category/list/FinancialsCategoryListWebViewBean.java index 0416b3d5..9b2b22a8 100644 --- a/src/java/org/mxchange/jfinancials/beans/product_category/list/FinancialsCategoryListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/product_category/list/FinancialsCategoryListWebViewBean.java @@ -191,11 +191,8 @@ public class FinancialsCategoryListWebViewBean extends BaseFinancialsBean implem public void init () { // Is cache there? if (!this.categoryCache.iterator().hasNext()) { - // Get whole list from EJB - final List categories = this.categoryBean.allCategories(); - // "Walk" through all entries and add to cache - for (final Category category : categories) { + for (final Category category : this.categoryBean.allCategories()) { // Add it by primary key this.categoryCache.put(category.getCategoryId(), category); } -- 2.39.5