public void validate() { LOGGER.debug("Start validate"); Boolean noerror = Boolean.TRUE; for (BpaFeeExtn sanctionfees : getSantionFeeList()) { if (sanctionfees.getIsMandatory()) { if (sanctionfees.getFeeAmount() == null || sanctionfees.getFeeAmount().equals("") || sanctionfees.getFeeAmount().equals(BigDecimal.ZERO)) { addActionError("Fee Amount is required for " + sanctionfees.getFeeDescription()); noerror = Boolean.FALSE; break; } } } if (!noerror) preparNewForm(); LOGGER.debug("Exit validate"); }
@SkipValidation public void buildVieworModify(RegistrationExtn registrationObj) { LOGGER.debug("Start buildVieworModify"); if (registrationObj.getEgDemand() != null && registrationObj.getEgDemand().getEgDemandDetails() != null) { Set<EgDemandDetails> demandDetailsSet = registrationObj.getEgDemand().getEgDemandDetails(); HashMap<String, BigDecimal> feecodeamountmap = new HashMap<String, BigDecimal>(); HashMap<String, Long> feecodedemanddetailsIdmap = new HashMap<String, Long>(); // Getting fee amounts from demand to set into the sanctionfees for (EgDemandDetails demandDetails : demandDetailsSet) { feecodeamountmap.put( demandDetails.getEgDemandReason().getEgDemandReasonMaster().getCode(), demandDetails.getAmount()); feecodedemanddetailsIdmap.put( demandDetails.getEgDemandReason().getEgDemandReasonMaster().getCode(), demandDetails.getId()); } // Getting fee amounts from registrationdfeedetails to set into the // sanctionfees RegistrationFeeExtn latesetregistrationFeeObj = bpaCommonExtnService.getLatestApprovedRegistrationFee(registrationObj); if (latesetregistrationFeeObj != null) { Set<RegistrationFeeDetailExtn> regFeeDtlSet = latesetregistrationFeeObj.getRegistrationFeeDetailsSet(); for (RegistrationFeeDetailExtn regFeeDtl : regFeeDtlSet) { if (feecodeamountmap.get(regFeeDtl.getBpaFee().getFeeCode()) == null) { feecodeamountmap.put(regFeeDtl.getBpaFee().getFeeCode(), regFeeDtl.getAmount()); } } } santionFeeList = feeExtnService.getAllSanctionedFeesbyServiceType( registrationObj.getServiceType().getId()); for (BpaFeeExtn fees : santionFeeList) { if (fees.getFeeGroup().equals(BpaConstants.COCFEE)) { fees.setFeeAmount( feecodeamountmap.get(fees.getFeeCode()) != null ? feecodeamountmap.get(fees.getFeeCode()) : BigDecimal.ZERO); fees.setDemandDetailId(feecodedemanddetailsIdmap.get(fees.getFeeCode())); feeTotal = feeTotal.add(fees.getFeeAmount()); } else if (fees.getFeeGroup().equals(BpaConstants.CMDAFEE)) { fees.setFeeAmount( feecodeamountmap.get(fees.getFeeCode()) != null ? feecodeamountmap.get(fees.getFeeCode()) : BigDecimal.ZERO); fees.setDemandDetailId(feecodedemanddetailsIdmap.get(fees.getFeeCode())); feeTotal = feeTotal.add(fees.getFeeAmount()); // TODO: WE MAY NEED TO PASS DEMANDDETAILID ALONG WITH UI. } else if (fees.getFeeGroup().equals(BpaConstants.MWGWFFEE)) { fees.setFeeAmount( feecodeamountmap.get(fees.getFeeCode()) != null ? feecodeamountmap.get(fees.getFeeCode()) : BigDecimal.ZERO); fees.setDemandDetailId(feecodedemanddetailsIdmap.get(fees.getFeeCode())); feeTotal = feeTotal.add(fees.getFeeAmount()); // TODO: WE MAY NEED TO PASS DEMANDDETAILID ALONG WITH UI. } } if (latesetregistrationFeeObj != null) { registrationObj.setRegistrationFeeChallanNumber( latesetregistrationFeeObj.getChallanNumber()); } else registrationObj.setRegistrationFeeChallanNumber("NA"); if (latesetregistrationFeeObj != null) { setFeeRemarks(latesetregistrationFeeObj.getFeeRemarks()); registrationObj.setFeeDate(sdf.format(latesetregistrationFeeObj.getFeeDate())); } else { setFeeRemarks(registrationObj.getFeeRemarks()); registrationObj.setFeeDate(null); // get date from demanddetl } } splitFeelistintosublists(); LOGGER.debug("Exit buildVieworModify"); }