protected void validateForFeeRecurrence(HttpServletRequest request, ActionErrors errors) throws ApplicationException { MeetingBO meeting = getCustomerMeeting(request); if (meeting != null) { List<FeeView> feeList = getDefaultFees(); for (FeeView fee : feeList) { if (!fee.isRemoved() && fee.isPeriodic() && !isFrequencyMatches(fee, meeting)) { errors.add( CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH, new ActionMessage(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH)); return; } } List<FeeView> additionalFeeList = (List<FeeView>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request); for (FeeView selectedFee : getAdditionalFees()) { for (FeeView fee : additionalFeeList) { if (selectedFee.getFeeIdValue() != null && selectedFee.getFeeId().equals(fee.getFeeId())) { if (fee.isPeriodic() && !isFrequencyMatches(fee, meeting)) { errors.add( CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH, new ActionMessage(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH)); return; } } } } } }
public List<FeeView> getFeesToApply() { List<FeeView> feesToApply = new ArrayList<FeeView>(); for (FeeView fee : getAdditionalFees()) { if (fee.getFeeIdValue() != null) { feesToApply.add(fee); } } for (FeeView fee : getDefaultFees()) { if (!fee.isRemoved()) { feesToApply.add(fee); } } return feesToApply; }
protected void validateForDuplicatePeriodicFee(HttpServletRequest request, ActionErrors errors) throws ApplicationException { List<FeeView> additionalFeeList = (List<FeeView>) SessionUtils.getAttribute(CustomerConstants.ADDITIONAL_FEES_LIST, request); for (FeeView selectedFee : getAdditionalFees()) { int count = 0; for (FeeView duplicateSelectedfee : getAdditionalFees()) { if (selectedFee.getFeeIdValue() != null && selectedFee.getFeeId().equals(duplicateSelectedfee.getFeeId())) { if (isSelectedFeePeriodic(selectedFee, additionalFeeList)) { count++; } } } if (count > 1) { errors.add( CustomerConstants.FEE, new ActionMessage(CustomerConstants.ERRORS_DUPLICATE_PERIODIC_FEE)); break; } } }