From: Roland Häder Date: Mon, 4 Sep 2017 22:25:13 +0000 (+0200) Subject: Don't cherr-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fafc22900b2670c31a1f61fa5e3ae0ef8754710a;p=jfinancials-war.git Don't cherr-pick: - used more 'final' where possible to not have unwanted side effects when someone accidently assigns a new value somewhere - reciepts are now linked against branch offices because you do not buy stuff at headquarters, mostly Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jfinancials/beans/financial/income/FinancialsIncomeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/financial/income/FinancialsIncomeWebRequestBean.java index 61f2bc1d..c7a8210b 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/income/FinancialsIncomeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/income/FinancialsIncomeWebRequestBean.java @@ -107,11 +107,11 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsController imp } // Now that all required data has been entered, prepare new income instance - BillableIncome income = new FinancialIncome(this.getIncomeTitle(), this.getIncomeSingleAmount(), this.getIncomeInterval(), this.userLoginController.getLoggedInUser()); + final BillableIncome income = new FinancialIncome(this.getIncomeTitle(), this.getIncomeSingleAmount(), this.getIncomeInterval(), this.userLoginController.getLoggedInUser()); // Handle it over to the EJB // @TODO Use updated income instance, e.g. fire event - BillableIncome updatedIncome = this.financialBean.addIncome(income); + final BillableIncome updatedIncome = this.financialBean.addIncome(income); // All fine return "add_user_fiancial_income"; //NOI18N @@ -119,11 +119,8 @@ public class FinancialsIncomeWebRequestBean extends BaseFinancialsController imp @Override public List allIncomeIntervals () { - // Init array - List incomeIntervals = Arrays.asList(FinancialInterval.values()); - - // Return it - return incomeIntervals; + // Return list from enum values + return Arrays.asList(FinancialInterval.values()); } @Override diff --git a/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java index 2eca75a0..98818d0c 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java @@ -27,7 +27,7 @@ import javax.enterprise.event.Observes; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; -import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; +import org.mxchange.jcontactsbusiness.branchoffice.BranchOffice; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; import org.mxchange.jfinancials.exceptions.ReceiptAlreadyAddedException; @@ -42,7 +42,7 @@ import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; *

* @author Roland Häder */ -@Named ("financialReceiptController") +@Named ("receiptController") @RequestScoped public class FinancialsReceiptWebRequestBean extends BaseFinancialsController implements FinancialsReceiptWebRequestController { @@ -65,7 +65,7 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsController im /** * Recipient issuing company (for example where the user went shopping to) */ - private BusinessBasicData receiptCompany; + private BranchOffice receiptBranchOffice; /** * Date/time the receipt has been issued @@ -110,7 +110,7 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsController im // Pre-check if receipt number is set if (this.getReceiptNumber() == null || this.getReceiptNumber() == 0) { // Generate one randomly - Long randomNumber = Math.round(Math.random() * 1_000_000); + final Long randomNumber = Math.round(Math.random() * 1_000_000); // And set it here this.setReceiptNumber(randomNumber); @@ -120,15 +120,15 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsController im if (!this.userLoginController.isUserLoggedIn()) { // Not logged-in throw new IllegalStateException("User is not logged-in"); //NOI18N - } else if (this.getReceiptCompany() == null) { + } else if (this.getReceiptBranchOffice() == null) { // Is not set - throw new NullPointerException("this.receiptCompany is not set."); //NOI18N - } else if (this.getReceiptCompany().getCompanyDataId() == null) { + throw new NullPointerException("this.receiptBranchOffice is not set."); //NOI18N + } else if (this.getReceiptBranchOffice().getBranchId() == null) { // It must be an already peristed instance - throw new NullPointerException("this.receiptCompany.businessContactId is not set."); //NOI18N - } else if (this.getReceiptCompany().getCompanyDataId() < 1) { + throw new NullPointerException("this.receiptBranchOffice.businessContactId is not set."); //NOI18N + } else if (this.getReceiptBranchOffice().getBranchId() < 1) { // It must be an already peristed instance - throw new IllegalArgumentException(MessageFormat.format("this.receiptCompany.businessContactId={0} is not valid.", this.getReceiptCompany().getCompanyDataId())); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("this.receiptBranchOffice.businessContactId={0} is not valid.", this.getReceiptBranchOffice().getBranchId())); //NOI18N } else if (this.getPaymentType() == null) { // Is not set throw new NullPointerException("this.paymentType is not set."); //NOI18N @@ -138,15 +138,15 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsController im } // Prepare receipt instance - BillableReceipt receipt = new FinancialReceipt(this.getPaymentType(), this.getReceiptCompany(), this.userLoginController.getLoggedInUser(), this.getReceiptIssued()); + final BillableReceipt receipt = new FinancialReceipt(this.getPaymentType(), this.getReceiptBranchOffice(), this.userLoginController.getLoggedInUser(), this.getReceiptIssued()); if (this.isReceiptAdded(receipt)) { // Receipt has already been added - throw new FaceletException(MessageFormat.format("Receipt for receiptCompany={0},receiptIssued={1},receiptNumber={2} has already been added.", this.getReceiptCompany().getCompanyDataId(), this.getReceiptIssued().toString(), this.getReceiptNumber())); //NOI18N + throw new FaceletException(MessageFormat.format("Receipt for receiptBranchOffice={0},receiptIssued={1},receiptNumber={2} has already been added.", this.getReceiptBranchOffice().getBranchId(), this.getReceiptIssued().toString(), this.getReceiptNumber())); //NOI18N } // Init variable - BillableReceipt updatedReceipt; + final BillableReceipt updatedReceipt; // All is set, then try to call EJB try { @@ -215,21 +215,21 @@ public class FinancialsReceiptWebRequestBean extends BaseFinancialsController im } /** - * Getter for receipt issuing company + * Getter for receipt issuing branch office *

- * @return Receipt issuing company + * @return Receipt issuing branch office */ - public BusinessBasicData getReceiptCompany () { - return this.receiptCompany; + public BranchOffice getReceiptBranchOffice () { + return this.receiptBranchOffice; } /** - * Setter for receipt issuing company + * Setter for receipt issuing branch office *

- * @param receiptCompany Receipt issuing company + * @param receiptBranchOffice Receipt issuing branch office */ - public void setReceiptCompany (final BusinessBasicData receiptCompany) { - this.receiptCompany = receiptCompany; + public void setReceiptBranchOffice (final BranchOffice receiptBranchOffice) { + this.receiptBranchOffice = receiptBranchOffice; } /** diff --git a/web/user/financials/login_financials_add_receipt.xhtml b/web/user/financials/login_financials_add_receipt.xhtml index 24d14ab5..0137fca1 100644 --- a/web/user/financials/login_financials_add_receipt.xhtml +++ b/web/user/financials/login_financials_add_receipt.xhtml @@ -23,13 +23,13 @@

- +
- + - +
@@ -40,7 +40,7 @@
- +
@@ -50,7 +50,7 @@
- +
@@ -67,9 +67,9 @@
- + - +
@@ -77,7 +77,7 @@