From 5e2a391620421e299df06b99313a95f366805f6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 10 Apr 2020 21:46:10 +0200 Subject: [PATCH] Don't cherry-pick: - 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 --- .../receipt/list/FinancialsReceiptListWebViewBean.java | 5 +---- .../receipt/user/FinancialsReceiptUserWebSessionBean.java | 2 +- .../list/FinancialsReceiptItemListWebViewBean.java | 7 ++----- .../user/FinancialsReceiptItemUserWebSessionBean.java | 2 +- .../financial/receipt/admin_form_financial_receipt.tpl | 2 +- web/admin/financial/receipt/admin_receipt_list.xhtml | 2 +- 6 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/list/FinancialsReceiptListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/list/FinancialsReceiptListWebViewBean.java index 1afa4fbe..ed562fb9 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/list/FinancialsReceiptListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/list/FinancialsReceiptListWebViewBean.java @@ -235,11 +235,8 @@ public class FinancialsReceiptListWebViewBean extends BaseFinancialsBean impleme public void initCache () { // Is cache there? if (!this.receiptCache.iterator().hasNext()) { - // Get whole list from EJB - final List receipts = this.receiptBean.allReceipts(); - // Add all - for (final BillableReceipt receipt : receipts) { + for (final BillableReceipt receipt : this.receiptBean.allReceipts()) { // Add it to cache this.receiptCache.put(receipt.getReceiptId(), receipt); } diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/user/FinancialsReceiptUserWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/user/FinancialsReceiptUserWebSessionBean.java index 8062eaf2..5e3ee7f4 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/user/FinancialsReceiptUserWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt/user/FinancialsReceiptUserWebSessionBean.java @@ -107,7 +107,7 @@ public class FinancialsReceiptUserWebSessionBean extends BaseFinancialsBean impl * @param event Event instance */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent 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 diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java index a9b5194a..20c7f566 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/list/FinancialsReceiptItemListWebViewBean.java @@ -132,7 +132,7 @@ public class FinancialsReceiptItemListWebViewBean extends BaseFinancialsBean imp * @param event Event instance */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent 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 @@ -205,11 +205,8 @@ public class FinancialsReceiptItemListWebViewBean extends BaseFinancialsBean imp public void initCache () { // Is cache there? if (!this.receiptItemCache.iterator().hasNext()) { - // Get whole list from EJB - final List receiptItems = this.receiptItemBean.allReceiptItems(); - // Add all - for (final BillableReceiptItem receiptItem : receiptItems) { + for (final BillableReceiptItem receiptItem : this.receiptItemBean.allReceiptItems()) { // Add it to cache this.receiptItemCache.put(receiptItem.getItemId(), receiptItem); } diff --git a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java index 6ab06eda..26af5364 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/model/receipt_item/user/FinancialsReceiptItemUserWebSessionBean.java @@ -99,7 +99,7 @@ public class FinancialsReceiptItemUserWebSessionBean extends BaseFinancialsBean * @param event Event instance */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent 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 diff --git a/web/WEB-INF/templates/admin/financial/receipt/admin_form_financial_receipt.tpl b/web/WEB-INF/templates/admin/financial/receipt/admin_form_financial_receipt.tpl index c2adafd7..26dd238f 100644 --- a/web/WEB-INF/templates/admin/financial/receipt/admin_form_financial_receipt.tpl +++ b/web/WEB-INF/templates/admin/financial/receipt/admin_form_financial_receipt.tpl @@ -109,7 +109,7 @@