}
// 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
@Override
public List<FinancialInterval> allIncomeIntervals () {
- // Init array
- List<FinancialInterval> incomeIntervals = Arrays.asList(FinancialInterval.values());
-
- // Return it
- return incomeIntervals;
+ // Return list from enum values
+ return Arrays.asList(FinancialInterval.values());
}
@Override
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;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@Named ("financialReceiptController")
+@Named ("receiptController")
@RequestScoped
public class FinancialsReceiptWebRequestBean extends BaseFinancialsController implements FinancialsReceiptWebRequestController {
/**
* Recipient issuing company (for example where the user went shopping to)
*/
- private BusinessBasicData receiptCompany;
+ private BranchOffice receiptBranchOffice;
/**
* Date/time the receipt has been issued
// 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);
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
}
// 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 {
}
/**
- * Getter for receipt issuing company
+ * Getter for receipt issuing branch office
* <p>
- * @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
* <p>
- * @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;
}
/**
<h:panelGroup styleClass="table-row" layout="block">
<div class="table-left-medium">
- <h:outputLabel for="receiptCompany" value="#{msg.LOGIN_FINANCIAL_SELECT_RECEIPT_COMPANY}" />
+ <h:outputLabel for="receiptBranchOffice" value="#{msg.LOGIN_FINANCIAL_SELECT_RECEIPT_BRANCH_OFFICE}" />
</div>
<div class="table-right-medium">
- <h:selectOneMenu styleClass="select" id="receiptCompany" value="#{financialReceiptController.receiptCompany}" required="true" requiredMessage="#{msg.FIELD_FINANCIAL_RECEIPT_COMPANY_REQUIRED}" converter="BusinessContactConverter">
+ <h:selectOneMenu styleClass="select" id="receiptBranchOffice" value="#{receiptController.receiptBranchOffice}" required="true" requiredMessage="#{msg.FIELD_FINANCIAL_RECEIPT_BRANCH_OFFICE_REQUIRED}" converter="BasicCompanyDataConverter">
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" noSelectionOption="true" />
- <f:selectItems value="#{companyDataController.allCompanyBasicData()}" var="receiptCompany" itemValue="#{receiptCompany}" itemLabel="#{receiptCompany.companyName}" />
+ <f:selectItems value="#{branchOfficeController.allBranchOffices()}" var="receiptBranchOffice" itemValue="#{receiptBranchOffice}" itemLabel="#{receiptBranchOffice.companyName}" />
</h:selectOneMenu>
</div>
</h:panelGroup>
</div>
<div class="table-right-medium">
- <p:calendar id="receiptIssued" title="#{msg.LOGIN_FINANCIAL_ENTER_RECEIPT_ISSUED_TITLE}" locale="#{localizationController.locale.displayCountry}" value="#{financialReceiptController.receiptIssued}" />
+ <p:calendar id="receiptIssued" title="#{msg.LOGIN_FINANCIAL_ENTER_RECEIPT_ISSUED_TITLE}" locale="#{localizationController.locale.displayCountry}" value="#{receiptController.receiptIssued}" />
</div>
</h:panelGroup>
</div>
<div class="table-right-medium">
- <h:inputText styleClass="input" id="receiptNumber" size="2" maxlength="10" value="#{financialReceiptController.receiptNumber}" validatorMessage="#{msg.ENTERED_RECEIPT_NUMBER_INVALID}">
+ <h:inputText styleClass="input" id="receiptNumber" size="2" maxlength="10" value="#{receiptController.receiptNumber}" validatorMessage="#{msg.ENTERED_RECEIPT_NUMBER_INVALID}">
<f:validateLongRange minimum="1" maximum="20" />
</h:inputText>
</div>
</div>
<div class="table-right-medium">
- <h:selectOneMenu styleClass="select" id="paymentType" value="#{financialReceiptController.paymentType}" required="true" requiredMessage="#{msg.FIELD_FINANCIAL_INCOME_REQUIRED}">
+ <h:selectOneMenu styleClass="select" id="paymentType" value="#{receiptController.paymentType}" required="true" requiredMessage="#{msg.FIELD_FINANCIAL_INCOME_REQUIRED}">
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" noSelectionOption="true" />
- <f:selectItems value="#{financialReceiptController.allPaymentTypes()}" var="paymentType" itemValue="#{paymentType}" itemLabel="#{msg[paymentType]}" />
+ <f:selectItems value="#{receiptController.allPaymentTypes()}" var="paymentType" itemValue="#{paymentType}" itemLabel="#{msg[paymentType]}" />
</h:selectOneMenu>
</div>
</h:panelGroup>
<div class="table-footer">
<h:commandButton styleClass="reset divider-right" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
- <h:commandButton styleClass="submit" id="submit_add_income" type="submit" action="#{financialReceiptController.addReceipt()}" value="#{msg.BUTTON_LOGIN_FINCIAL_ADD_INCOME}" />
+ <h:commandButton styleClass="submit" id="submit_add_income" type="submit" action="#{receiptController.addReceipt()}" value="#{msg.BUTTON_LOGIN_FINCIAL_ADD_INCOME}" />
</div>
</h:panelGroup>
</h:form>