]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Tue, 25 Jul 2017 21:14:34 +0000 (23:14 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 25 Jul 2017 21:14:34 +0000 (23:14 +0200)
- this list can be easily cached in a session-scoped bean to have lesser
  "expensive" EJB calls.

src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsAdminBusinessContactWebRequestController.java
src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/businesscontact/FinancialsBusinessContactWebSessionController.java
web/admin/contact_business/admin_contact_business_list.xhtml

index 5bf794382fe441b37ae05c3e0fe5e97985362631..aa8e04177f614e1d3d061f3fcd55c9cc9b69ebfe 100644 (file)
@@ -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<BusinessBasicData> businessContacts;
-
        /**
         * Comments for this company
         */
@@ -111,12 +104,6 @@ public class FinancialsAdminBusinessContactWebRequestBean extends BaseFinancials
                super();
        }
 
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BusinessBasicData> allBusinessContacts () {
-               return this.businessContacts;
-       }
-
        /**
         * Getter for comments
         * <p>
@@ -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();
        }
 
 }
index 10f78c82d9386a6f10e85d309fef79bcc71705b1..d4c97d257d147569b0c3aa5a0f7a6a51e450553f 100644 (file)
@@ -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
-        * <p>
-        * @return A list of all business contacts
-        */
-       List<BusinessBasicData> allBusinessContacts ();
-
 }
index 93aa94f9ceea40fa0403b7ecd46dec9fea158cc0..a1077efc35c324bbf395087cee07bf7f45a50c3a 100644 (file)
@@ -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<BusinessBasicData> businessContacts;
+
        /**
         * Remote contact bean
         */
@@ -112,6 +125,12 @@ public class FinancialsBusinessContactWebSessionBean extends BaseFinancialsContr
                super();
        }
 
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<BusinessBasicData> allBusinessContacts () {
+               return this.businessContacts;
+       }
+
        /**
         * Getter for comments
         * <p>
@@ -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();
        }
 
 }
index 2e982db0c5db07f2dfb55c9733c0fa9f2288fdba..dc1d93d34375261f1c9b1c60046551b72ca08e8e 100644 (file)
@@ -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
+        * <p>
+        * @return A list of all business contacts
+        */
+       List<BusinessBasicData> allBusinessContacts ();
+
 }
index 7619af6018ffbf90810ee80097051a34bd656712..6236b69380c7ad4f855bfe007029f1651f683b11 100644 (file)
                </ui:define>
 
                <ui:define name="content">
-                       <ui:fragment rendered="#{adminBusinessDataController.allBusinessContacts().isEmpty()}">
+                       <ui:fragment rendered="#{businessDataController.allBusinessContacts().isEmpty()}">
                                <ui:include src="/WEB-INF/templates/generic/message_box.tpl">
                                        <ui:param name="message" value="#{msg.ADMIN_CONTACT_BUSINESS_LIST_EMPTY}" />
                                        <ui:param name="styleClass" value="errors" />
                                </ui:include>
                        </ui:fragment>
 
-                       <h:dataTable id="table_list_business_contacts" var="businessContact" value="#{adminBusinessDataController.allBusinessContacts()}" styleClass="table_full" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CONTACT_BUSINESS}" rendered="#{not adminBusinessDataController.allBusinessContacts().isEmpty()}">
+                       <h:dataTable id="table_list_business_contacts" var="businessContact" value="#{businessDataController.allBusinessContacts()}" styleClass="table_full" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_CONTACT_BUSINESS}" rendered="#{not businessDataController.allBusinessContacts().isEmpty()}">
                                <h:column>
                                        <f:facet name="header">
                                                <h:outputText value="#{msg.ADMIN_CONTACT_BUSINESS_ID}" />