From 2060b4dba0c3fde0d1d99a58e2888799e24f8b89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org> Date: Fri, 17 Apr 2020 16:59:29 +0200 Subject: [PATCH] Don't cherry-pick: - heavy rewrite on (almost?) all admin-list-foo views, to use @ViewScoped beans and working JSR107 caching - also sorted out mixed usage of userController (or so?) as the login and register backing beans can surely have their own properties - rewrote web/WEB-INF/resources/tags/admin/dropdown/ to have it included back in views again, was a bad idea MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder <roland@mxchange.org> --- .../FinancialsReceiptListWebViewBean.java | 2 +- .../FinancialsReceiptItemListWebViewBean.java | 2 +- web/WEB-INF/project-links.jsf.taglib.xml | 46 ------------------- .../financial/receipt/admin_receipt_links.tpl | 24 ---------- .../receipt_item/admin_receipt_item_links.tpl | 24 ---------- .../receipt/admin_form_financial_receipt.tpl | 4 +- .../receipt/login_form_financial_receipt.tpl | 4 +- .../receipt/admin_receipt_list.xhtml | 31 +++++++++++-- .../admin_receipt_item_list.xhtml | 27 ++++++++++- 9 files changed, 60 insertions(+), 104 deletions(-) delete mode 100644 web/WEB-INF/resources/tags/admin/dropdown/financial/receipt/admin_receipt_links.tpl delete mode 100644 web/WEB-INF/resources/tags/admin/dropdown/financial/receipt_item/admin_receipt_item_links.tpl 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 ed562fb9..03b360a2 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 @@ -236,7 +236,7 @@ public class FinancialsReceiptListWebViewBean extends BaseFinancialsBean impleme // Is cache there? if (!this.receiptCache.iterator().hasNext()) { // Add all - for (final BillableReceipt receipt : this.receiptBean.allReceipts()) { + for (final BillableReceipt receipt : this.receiptBean.fetchAllReceipts()) { // Add it to cache this.receiptCache.put(receipt.getReceiptId(), receipt); } 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 20c7f566..9da906a0 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 @@ -206,7 +206,7 @@ public class FinancialsReceiptItemListWebViewBean extends BaseFinancialsBean imp // Is cache there? if (!this.receiptItemCache.iterator().hasNext()) { // Add all - for (final BillableReceiptItem receiptItem : this.receiptItemBean.allReceiptItems()) { + for (final BillableReceiptItem receiptItem : this.receiptItemBean.fetchAllReceiptItems()) { // Add it to cache this.receiptItemCache.put(receiptItem.getItemId(), receiptItem); } diff --git a/web/WEB-INF/project-links.jsf.taglib.xml b/web/WEB-INF/project-links.jsf.taglib.xml index 80c99e24..41e073dd 100644 --- a/web/WEB-INF/project-links.jsf.taglib.xml +++ b/web/WEB-INF/project-links.jsf.taglib.xml @@ -22,50 +22,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd" > <namespace>http://mxchange.org/jsf/jfinancials/links</namespace> - <tag> - <tag-name>outputReceiptAdminDropdownMenu</tag-name> - <description>This tag renders a full h:panelGroup for an administrative drop-down menu for receipt data.</description> - <source>resources/tags/admin/dropdown/financial/receipt/admin_receipt_links.tpl</source> - <attribute> - <name>receipt</name> - <description>The receipt instance that provides the data for this tag.</description> - <required>true</required> - <type>org.mxchange.jfinancials.model.receipt.BillableReceipt</type> - </attribute> - <attribute> - <name>renderShowLink</name> - <description>Whether this tag is used to show receipt data (default true).</description> - <required>false</required> - <type>java.lang.Boolean</type> - </attribute> - <attribute> - <name>rendered</name> - <description>Whether this tag is being rendered by JSF engine (default: true).</description> - <required>false</required> - <type>java.lang.Boolean</type> - </attribute> - </tag> - <tag> - <tag-name>outputReceiptItemAdminDropdownMenu</tag-name> - <description>This tag renders a full h:panelGroup for an administrative drop-down menu for receipt item data.</description> - <source>resources/tags/admin/dropdown/financial/receipt_item/admin_receipt_item_links.tpl</source> - <attribute> - <name>receiptItem</name> - <description>The receipt item instance that provides the data for this tag.</description> - <required>true</required> - <type>org.mxchange.jfinancials.model.receipt_item.BillableReceiptItem</type> - </attribute> - <attribute> - <name>renderShowLink</name> - <description>Whether this tag is used to show receipt item data (default true).</description> - <required>false</required> - <type>java.lang.Boolean</type> - </attribute> - <attribute> - <name>rendered</name> - <description>Whether this tag is being rendered by JSF engine (default: true).</description> - <required>false</required> - <type>java.lang.Boolean</type> - </attribute> - </tag> </facelet-taglib> diff --git a/web/WEB-INF/resources/tags/admin/dropdown/financial/receipt/admin_receipt_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/financial/receipt/admin_receipt_links.tpl deleted file mode 100644 index c6b3f5f1..00000000 --- a/web/WEB-INF/resources/tags/admin/dropdown/financial/receipt/admin_receipt_links.tpl +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<ui:composition - xmlns="http://www.w3.org/1999/xhtml" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://xmlns.jcp.org/jsf/facelets" - xmlns:p="http://primefaces.org/ui" - > - - <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}"> - <p:menuitem outcome="admin_show_receipt" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{project.ADMIN_LINK_SHOW_RECEIPT_TITLE}" rendered="#{empty renderShowLink or renderShowLink}"> - <f:param name="receiptId" value="#{receipt.receiptId}" /> - </p:menuitem> - - <p:menuitem outcome="admin_edit_receipt" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{project.ADMIN_LINK_EDIT_RECEIPT_TITLE}"> - <f:param name="receiptId" value="#{receipt.receiptId}" /> - </p:menuitem> - - <p:menuitem outcome="admin_delete_receipt"> - <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{project.ADMIN_LINK_DELETE_RECEIPT_TITLE}" /> - <f:param name="receiptId" value="#{receipt.receiptId}" /> - </p:menuitem> - </p:menuButton> -</ui:composition> diff --git a/web/WEB-INF/resources/tags/admin/dropdown/financial/receipt_item/admin_receipt_item_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/financial/receipt_item/admin_receipt_item_links.tpl deleted file mode 100644 index e3fd9ca6..00000000 --- a/web/WEB-INF/resources/tags/admin/dropdown/financial/receipt_item/admin_receipt_item_links.tpl +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<ui:composition - xmlns="http://www.w3.org/1999/xhtml" - xmlns:f="http://java.sun.com/jsf/core" - xmlns:h="http://java.sun.com/jsf/html" - xmlns:ui="http://xmlns.jcp.org/jsf/facelets" - xmlns:p="http://primefaces.org/ui" - > - - <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}"> - <p:menuitem outcome="admin_show_receipt_item" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{project.ADMIN_LINK_SHOW_RECEIPT_ITEM_TITLE}" rendered="#{empty renderShowLink or renderShowLink}"> - <f:param name="receiptId" value="#{receiptItem.itemId}" /> - </p:menuitem> - - <p:menuitem outcome="admin_edit_receipt_item" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{project.ADMIN_LINK_EDIT_RECEIPT_ITEM_TITLE}"> - <f:param name="receiptId" value="#{receiptItem.itemId}" /> - </p:menuitem> - - <p:menuitem outcome="admin_delete_receipt_item"> - <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{project.ADMIN_LINK_DELETE_RECEIPT_ITEM_TITLE}" /> - <f:param name="receiptId" value="#{receiptItem.itemId}" /> - </p:menuitem> - </p:menuButton> -</ui:composition> 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 26dd238f..6a8733d2 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 @@ -31,7 +31,7 @@ <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" /> <f:selectItems - value="#{branchOfficeListController.allBranchOffices()}" + value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" @@ -88,7 +88,7 @@ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" /> <f:selectItems - value="#{employeeController.allEmployees()}" + value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" diff --git a/web/WEB-INF/templates/user/financial/receipt/login_form_financial_receipt.tpl b/web/WEB-INF/templates/user/financial/receipt/login_form_financial_receipt.tpl index dedf30ec..949a7075 100644 --- a/web/WEB-INF/templates/user/financial/receipt/login_form_financial_receipt.tpl +++ b/web/WEB-INF/templates/user/financial/receipt/login_form_financial_receipt.tpl @@ -33,7 +33,7 @@ <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" /> <f:selectItems - value="#{branchOfficeListController.allBranchOffices()}" + value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" @@ -90,7 +90,7 @@ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" /> <f:selectItems - value="#{employeeController.allEmployees()}" + value="#{employeeListController.allEmployees}" var="companyHeadquarter" itemValue="#{companyEmployee}" itemLabel="#{beanHelper.renderEmployee(companyEmployee)}" diff --git a/web/admin/financial/receipt/admin_receipt_list.xhtml b/web/admin/financial/receipt/admin_receipt_list.xhtml index ddd3de6f..89099405 100644 --- a/web/admin/financial/receipt/admin_receipt_list.xhtml +++ b/web/admin/financial/receipt/admin_receipt_list.xhtml @@ -130,7 +130,7 @@ <f:converter converterId="BranchOfficeConverter" /> <f:selectItems - value="#{branchOfficeListController.allBranchOffices()}" + value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" @@ -167,7 +167,7 @@ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" /> <f:selectItems - value="#{employeeController.allEmployees()}" + value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" itemLabel="#{beanHelper.renderEmployee(employee)}" @@ -283,7 +283,32 @@ headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}" sortable="false" > - <pl:outputReceiptAdminDropdownMenu receipt="#{receipt}" /> + <p:menuButton value="#{msg.OPTIONS}"> + <p:menuitem + outcome="admin_show_receipt" + value="#{msg.ADMIN_LINK_SHOW_SHORT}" + title="#{project.ADMIN_LINK_SHOW_RECEIPT_TITLE}" + > + <f:param name="receiptId" value="#{receipt.receiptId}" /> + </p:menuitem> + + <p:menuitem + outcome="admin_edit_receipt" + value="#{msg.ADMIN_LINK_EDIT_SHORT}" + title="#{project.ADMIN_LINK_EDIT_RECEIPT_TITLE}" + > + <f:param name="receiptId" value="#{receipt.receiptId}" /> + </p:menuitem> + + <p:menuitem outcome="admin_delete_receipt"> + <h:outputText + styleClass="link-danger" + value="#{msg.ADMIN_LINK_DELETE_SHORT}" + title="#{project.ADMIN_LINK_DELETE_RECEIPT_TITLE}" + /> + <f:param name="receiptId" value="#{receipt.receiptId}" /> + </p:menuitem> + </p:menuButton> </p:column> </p:dataTable> diff --git a/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml b/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml index b5d60a10..e3c0224b 100644 --- a/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml +++ b/web/admin/financial/receipt_item/admin_receipt_item_list.xhtml @@ -230,7 +230,32 @@ headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}" sortable="false" > - <pl:outputReceiptItemAdminDropdownMenu receiptItem="#{receiptItem}" /> + <p:menuButton value="#{msg.OPTIONS}"> + <p:menuitem + outcome="admin_show_receipt_item" + value="#{msg.ADMIN_LINK_SHOW_SHORT}" + title="#{project.ADMIN_LINK_SHOW_RECEIPT_ITEM_TITLE}" + > + <f:param name="receiptId" value="#{receiptItem.itemId}" /> + </p:menuitem> + + <p:menuitem + outcome="admin_edit_receipt_item" + value="#{msg.ADMIN_LINK_EDIT_SHORT}" + title="#{project.ADMIN_LINK_EDIT_RECEIPT_ITEM_TITLE}" + > + <f:param name="receiptId" value="#{receiptItem.itemId}" /> + </p:menuitem> + + <p:menuitem outcome="admin_delete_receipt_item"> + <h:outputText + styleClass="link-danger" + value="#{msg.ADMIN_LINK_DELETE_SHORT}" + title="#{project.ADMIN_LINK_DELETE_RECEIPT_ITEM_TITLE}" + /> + <f:param name="receiptId" value="#{receiptItem.itemId}" /> + </p:menuitem> + </p:menuButton> </p:column> </p:dataTable> -- 2.39.5