From 88263093334bb25be2e3f534a2659fbfcd9e36d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 25 Jul 2017 23:14:34 +0200 Subject: [PATCH] Please cherry-pick: - this list can be easily cached in a session-scoped bean to have lesser "expensive" EJB calls. --- ...alsAdminBusinessContactWebRequestBean.java | 16 ------------ ...inBusinessContactWebRequestController.java | 9 ------- ...nancialsBusinessContactWebSessionBean.java | 25 +++++++++++++++++++ ...lsBusinessContactWebSessionController.java | 9 +++++++ .../admin_contact_business_list.xhtml | 4 +-- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestBean.java index 5bf79438..aa8e0417 100644 --- a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestBean.java @@ -16,7 +16,6 @@ */ package org.mxchange.jfinancials.beans.businesscontact; -import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.faces.view.facelets.FaceletException; @@ -24,7 +23,6 @@ import javax.inject.Named; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; -import org.mxchange.jcontactsbusiness.BusinessBasicData; import org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote; import org.mxchange.jcountry.data.Country; import org.mxchange.jfinancials.beans.BaseFinancialsController; @@ -48,11 +46,6 @@ public class FinancialsAdminBusinessContactWebRequestBean extends BaseFinancials */ private BusinessDataAdminSessionBeanRemote adminBusinessDataBean; - /** - * A list of all registered companies (globally) - */ - private List businessContacts; - /** * Comments for this company */ @@ -111,12 +104,6 @@ public class FinancialsAdminBusinessContactWebRequestBean extends BaseFinancials super(); } - @Override - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List allBusinessContacts () { - return this.businessContacts; - } - /** * Getter for comments *

@@ -313,9 +300,6 @@ public class FinancialsAdminBusinessContactWebRequestBean extends BaseFinancials // Throw again throw new FaceletException(e); } - - // Init user's contact list - this.businessContacts = this.adminBusinessDataBean.allBusinessContacts(); } } diff --git a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestController.java index 10f78c82..d4c97d25 100644 --- a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestController.java @@ -17,9 +17,7 @@ package org.mxchange.jfinancials.beans.businesscontact; import java.io.Serializable; -import java.util.List; import javax.ejb.Local; -import org.mxchange.jcontactsbusiness.BusinessBasicData; /** * An interface for session-scoped financial controller @@ -29,11 +27,4 @@ import org.mxchange.jcontactsbusiness.BusinessBasicData; @Local public interface FinancialsAdminBusinessContactWebRequestController extends Serializable { - /** - * Returns a list of all business contacts - *

- * @return A list of all business contacts - */ - List allBusinessContacts (); - } diff --git a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionBean.java index 93aa94f9..a1077efc 100644 --- a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionBean.java @@ -16,6 +16,7 @@ */ package org.mxchange.jfinancials.beans.businesscontact; +import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; import javax.faces.view.facelets.FaceletException; @@ -24,6 +25,8 @@ import javax.inject.Named; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import org.mxchange.jcontactsbusiness.BusinessBasicData; +import org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote; import org.mxchange.jcontactsbusiness.BusinessDataSessionBeanRemote; import org.mxchange.jcountry.data.Country; import org.mxchange.jfinancials.beans.BaseFinancialsController; @@ -43,6 +46,16 @@ public class FinancialsBusinessContactWebSessionBean extends BaseFinancialsContr */ private static final long serialVersionUID = 56_189_028_928_371L; + /** + * Remote contact bean + */ + private BusinessDataAdminSessionBeanRemote adminBusinessDataBean; + + /** + * A list of all registered companies (globally) + */ + private List businessContacts; + /** * Remote contact bean */ @@ -112,6 +125,12 @@ public class FinancialsBusinessContactWebSessionBean extends BaseFinancialsContr super(); } + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List allBusinessContacts () { + return this.businessContacts; + } + /** * Getter for comments *

@@ -304,10 +323,16 @@ public class FinancialsBusinessContactWebSessionBean extends BaseFinancialsContr // Try to lookup this.businessDataBean = (BusinessDataSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/businessContact!org.mxchange.jcontactsbusiness.BusinessContactSessionBeanRemote"); //NOI18N + + // Try to lookup + this.adminBusinessDataBean = (BusinessDataAdminSessionBeanRemote) context.lookup("java:global/jfinancials-ejb/adminBusinessData!org.mxchange.jcontactsbusiness.BusinessDataAdminSessionBeanRemote"); //NOI18N } catch (final NamingException e) { // Throw again throw new FaceletException(e); } + + // Init user's contact list + this.businessContacts = this.adminBusinessDataBean.allBusinessContacts(); } } diff --git a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionController.java index 2e982db0..dc1d93d3 100644 --- a/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionController.java @@ -17,7 +17,9 @@ package org.mxchange.jfinancials.beans.businesscontact; import java.io.Serializable; +import java.util.List; import javax.ejb.Local; +import org.mxchange.jcontactsbusiness.BusinessBasicData; /** * An interface for session-scoped financial controller @@ -27,4 +29,11 @@ import javax.ejb.Local; @Local public interface FinancialsBusinessContactWebSessionController extends Serializable { + /** + * Returns a list of all business contacts + *

+ * @return A list of all business contacts + */ + List allBusinessContacts (); + } diff --git a/web/admin/contact_business/admin_contact_business_list.xhtml b/web/admin/contact_business/admin_contact_business_list.xhtml index 7619af60..6236b693 100644 --- a/web/admin/contact_business/admin_contact_business_list.xhtml +++ b/web/admin/contact_business/admin_contact_business_list.xhtml @@ -17,14 +17,14 @@ - + - + -- 2.39.5