@Test public void test_should_map_result_set_to_entity() throws Exception { Mockito.when(rs.next()).thenReturn(true).thenReturn(false); when(rs.getLong("id")).thenReturn(1l); when(rs.getString("acknowledgementnumber")).thenReturn(null); when(rs.getString("stateid")).thenReturn(null); when(rs.getDouble("goodwillamount")).thenReturn(1d); when(rs.getLong("timePeriod")).thenReturn(1l); when(rs.getTimestamp("agreement_date")).thenReturn(null); when(rs.getString("agreement_no")).thenReturn(null); when(rs.getDouble("bank_guarantee_amount")).thenReturn(1d); when(rs.getTimestamp("bank_guarantee_date")).thenReturn(null); when(rs.getString("case_no")).thenReturn(null); when(rs.getTimestamp("commencement_date")).thenReturn(null); when(rs.getTimestamp("council_date")).thenReturn(null); when(rs.getString("council_number")).thenReturn(null); when(rs.getTimestamp("expiry_date")).thenReturn(null); when(rs.getString("nature_of_allotment")).thenReturn(null); when(rs.getTimestamp("order_date")).thenReturn(null); when(rs.getString("order_details")).thenReturn(null); when(rs.getString("order_no")).thenReturn(null); when(rs.getString("payment_cycle")).thenReturn(null); when(rs.getDouble("registration_fee")).thenReturn(1d); when(rs.getString("remarks")).thenReturn(null); when(rs.getDouble("rent")).thenReturn(1d); when(rs.getString("rr_reading_no")).thenReturn(null); when(rs.getString("status")).thenReturn(null); when(rs.getString("tin_number")).thenReturn(null); when(rs.getString("tenant_id")).thenReturn(null); when(rs.getTimestamp("tender_date")).thenReturn(null); when(rs.getString("tender_number")).thenReturn(null); when(rs.getDouble("security_deposit")).thenReturn(1d); when(rs.getTimestamp("security_deposit_date")).thenReturn(null); when(rs.getTimestamp("solvency_certificate_date")).thenReturn(null); when(rs.getString("solvency_certificate_no")).thenReturn(null); when(rs.getString("trade_license_number")).thenReturn(null); when(rs.getLong("rent_increment_method")).thenReturn(1l); when(rs.getLong("allottee")).thenReturn(1l); when(rs.getLong("asset")).thenReturn(1l); when(rs.getString("demandid")).thenReturn(null); AgreementRowMapper agreementRowMapper = new AgreementRowMapper(); List<Agreement> agreements = agreementRowMapper.extractData(rs); Agreement agreementGiven = getAgreement(); assertThat(agreements.get(0).equals(agreementGiven)); }
@Override public List<Agreement> extractData(ResultSet rs) throws SQLException, DataAccessException { Map<Long, Agreement> AgreementMap = new HashMap<>(); logger.info("after creating map object ::: " + AgreementMap.size()); String AgreementIdRsName = "lamsagreementid"; while (rs.next()) { try { Long agreementId = (Long) rs.getObject(AgreementIdRsName); logger.info("agreementid in row mapper" + agreementId); Agreement agreement = AgreementMap.get(agreementId); if (agreement == null) { agreement = new Agreement(); String action = rs.getString("action"); agreement.setAction(Action.fromValue(action)); agreement = getProcessObject(agreement, agreement.getAction(), rs); agreement.setId((Long) rs.getObject(AgreementIdRsName)); agreement.setAcknowledgementNumber(rs.getString("acknowledgementnumber")); agreement.setStateId(rs.getString("stateid")); agreement.setGoodWillAmount(rs.getDouble("goodwillamount")); agreement.setTimePeriod((Long) rs.getObject("timePeriod")); agreement.setAgreementDate(rs.getTimestamp("agreement_date")); agreement.setAgreementNumber(rs.getString("agreement_no")); agreement.setBankGuaranteeAmount(rs.getDouble("bank_guarantee_amount")); agreement.setBankGuaranteeDate(rs.getTimestamp("bank_guarantee_date")); agreement.setCaseNo(rs.getString("case_no")); agreement.setCommencementDate(rs.getTimestamp("commencement_date")); agreement.setCouncilDate(rs.getTimestamp("council_date")); agreement.setCouncilNumber(rs.getString("council_number")); agreement.setExpiryDate(rs.getTimestamp("expiry_date")); agreement.setCreatedDate(rs.getTimestamp("created_date")); agreement.setCreatedBy(rs.getString("created_by")); agreement.setLastmodifiedDate(rs.getTimestamp("last_modified_date")); agreement.setLastmodifiedBy(rs.getString("last_modified_by")); String source = rs.getString("source"); agreement.setSource(Source.fromValue(source)); agreement.setCollectedGoodWillAmount(rs.getDouble("collectedGoodWillAmount")); agreement.setCollectedSecurityDeposit(rs.getDouble("collectedSecurityDeposit")); String natureOfAllotment = rs.getString("nature_of_allotment"); agreement.setNatureOfAllotment(NatureOfAllotment.fromValue(natureOfAllotment)); agreement.setOrderDetails(rs.getString("order_details")); String PaymentCycleValue = rs.getString("payment_cycle"); agreement.setPaymentCycle(PaymentCycle.fromValue(PaymentCycleValue)); agreement.setRegistrationFee(rs.getDouble("registration_fee")); agreement.setRemarks(rs.getString("remarks")); agreement.setRent(rs.getDouble("rent")); agreement.setRrReadingNo(rs.getString("rr_reading_no")); String status = rs.getString("status"); agreement.setStatus(Status.fromValue(status)); agreement.setTinNumber(rs.getString("tin_number")); agreement.setTenantId(rs.getString("tenant_id")); agreement.setTenderDate(rs.getTimestamp("tender_date")); agreement.setTenderNumber(rs.getString("tender_number")); agreement.setSecurityDeposit(rs.getDouble("security_deposit")); agreement.setSecurityDepositDate(rs.getTimestamp("security_deposit_date")); agreement.setSolvencyCertificateDate(rs.getTimestamp("solvency_certificate_date")); agreement.setSolvencyCertificateNo(rs.getString("solvency_certificate_no")); agreement.setTradelicenseNumber(rs.getString("trade_license_number")); agreement.setIsAdvancePaid(rs.getBoolean("is_advancepaid")); agreement.setAdjustmentStartDate(rs.getTimestamp("adjustment_start_date")); agreement.setIsUnderWorkflow(rs.getBoolean("is_under_workflow")); agreement.setFirstAllotment(rs.getString("first_allotment")); agreement.setGstin(rs.getString("gstin")); agreement.setMunicipalOrderNumber(rs.getString("municipal_order_no")); agreement.setMunicipalOrderDate(rs.getTimestamp("municipal_order_date")); agreement.setGovernmentOrderNumber(rs.getString("govt_order_no")); agreement.setGovernmentOrderDate(rs.getTimestamp("govt_order_date")); agreement.setRenewalDate(rs.getTimestamp("renewal_date")); agreement.setReservationCategory((Long) rs.getObject("res_category")); agreement.setOldAgreementNumber(isEmpty(rs.getString("old_agreement_no")) ? "" : rs.getString("old_agreement_no")); agreement.setReferenceNumber(rs.getString("referenceno")); agreement.setFloorNumber(rs.getString("floorno")); agreement.setParent((Long) rs.getObject("parent")); agreement.setTenderOpeningDate(rs.getTimestamp("tenderopeningdate")); agreement.setAuctionAmount(rs.getDouble("auctionamount")); agreement.setSolvencyAmount(rs.getDouble("solvencyamount")); agreement.setIsHistory(rs.getBoolean("ishistory")); agreement.setCgst(rs.getDouble("cgst")); agreement.setSgst(rs.getDouble("sgst")); agreement.setServiceTax(rs.getDouble("servicetax")); agreement.setNoticeNumber(rs.getString("noticeno")); String baseAllotment = rs.getString("base_allotment"); agreement.setBasisOfAllotment(BasisOfAllotment.fromValue(baseAllotment)); RentIncrementType rentIncrementType = new RentIncrementType(); rentIncrementType.setId((Long) rs.getObject("rent_increment_method")); rentIncrementType.setPercentage(rs.getDouble("percentage")); agreement.setRentIncrementMethod(rentIncrementType); Allottee allottee = new Allottee(); allottee.setId((Long) rs.getObject("allottee")); agreement.setAllottee(allottee); Asset asset = new Asset(); asset.setId((Long) rs.getObject("asset")); agreement.setAsset(asset); AgreementMap.put(agreementId, agreement); } List<String> demandIdList = agreement.getDemands(); String demandId = rs.getString("demandid"); if (demandId != null) { if (demandIdList == null) demandIdList = new ArrayList<>(); demandIdList.add(demandId); } agreement.setDemands(demandIdList); } catch (Exception e) { logger.info("exception in agreementRoqwMapper : " + e); e.printStackTrace(); throw new RuntimeException("error while mapping object from reult set : " + e.getCause()); } } logger.info("converting map to list object ::: " + AgreementMap.values()); return new ArrayList<>(AgreementMap.values()); }
AgreementRowMapper implements ResultSetExtractor<List<Agreement>> { @Override public List<Agreement> extractData(ResultSet rs) throws SQLException, DataAccessException { Map<Long, Agreement> AgreementMap = new HashMap<>(); logger.info("after creating map object ::: " + AgreementMap.size()); String AgreementIdRsName = "lamsagreementid"; while (rs.next()) { try { Long agreementId = (Long) rs.getObject(AgreementIdRsName); logger.info("agreementid in row mapper" + agreementId); Agreement agreement = AgreementMap.get(agreementId); if (agreement == null) { agreement = new Agreement(); String action = rs.getString("action"); agreement.setAction(Action.fromValue(action)); agreement = getProcessObject(agreement, agreement.getAction(), rs); agreement.setId((Long) rs.getObject(AgreementIdRsName)); agreement.setAcknowledgementNumber(rs.getString("acknowledgementnumber")); agreement.setStateId(rs.getString("stateid")); agreement.setGoodWillAmount(rs.getDouble("goodwillamount")); agreement.setTimePeriod((Long) rs.getObject("timePeriod")); agreement.setAgreementDate(rs.getTimestamp("agreement_date")); agreement.setAgreementNumber(rs.getString("agreement_no")); agreement.setBankGuaranteeAmount(rs.getDouble("bank_guarantee_amount")); agreement.setBankGuaranteeDate(rs.getTimestamp("bank_guarantee_date")); agreement.setCaseNo(rs.getString("case_no")); agreement.setCommencementDate(rs.getTimestamp("commencement_date")); agreement.setCouncilDate(rs.getTimestamp("council_date")); agreement.setCouncilNumber(rs.getString("council_number")); agreement.setExpiryDate(rs.getTimestamp("expiry_date")); agreement.setCreatedDate(rs.getTimestamp("created_date")); agreement.setCreatedBy(rs.getString("created_by")); agreement.setLastmodifiedDate(rs.getTimestamp("last_modified_date")); agreement.setLastmodifiedBy(rs.getString("last_modified_by")); String source = rs.getString("source"); agreement.setSource(Source.fromValue(source)); agreement.setCollectedGoodWillAmount(rs.getDouble("collectedGoodWillAmount")); agreement.setCollectedSecurityDeposit(rs.getDouble("collectedSecurityDeposit")); String natureOfAllotment = rs.getString("nature_of_allotment"); agreement.setNatureOfAllotment(NatureOfAllotment.fromValue(natureOfAllotment)); agreement.setOrderDetails(rs.getString("order_details")); String PaymentCycleValue = rs.getString("payment_cycle"); agreement.setPaymentCycle(PaymentCycle.fromValue(PaymentCycleValue)); agreement.setRegistrationFee(rs.getDouble("registration_fee")); agreement.setRemarks(rs.getString("remarks")); agreement.setRent(rs.getDouble("rent")); agreement.setRrReadingNo(rs.getString("rr_reading_no")); String status = rs.getString("status"); agreement.setStatus(Status.fromValue(status)); agreement.setTinNumber(rs.getString("tin_number")); agreement.setTenantId(rs.getString("tenant_id")); agreement.setTenderDate(rs.getTimestamp("tender_date")); agreement.setTenderNumber(rs.getString("tender_number")); agreement.setSecurityDeposit(rs.getDouble("security_deposit")); agreement.setSecurityDepositDate(rs.getTimestamp("security_deposit_date")); agreement.setSolvencyCertificateDate(rs.getTimestamp("solvency_certificate_date")); agreement.setSolvencyCertificateNo(rs.getString("solvency_certificate_no")); agreement.setTradelicenseNumber(rs.getString("trade_license_number")); agreement.setIsAdvancePaid(rs.getBoolean("is_advancepaid")); agreement.setAdjustmentStartDate(rs.getTimestamp("adjustment_start_date")); agreement.setIsUnderWorkflow(rs.getBoolean("is_under_workflow")); agreement.setFirstAllotment(rs.getString("first_allotment")); agreement.setGstin(rs.getString("gstin")); agreement.setMunicipalOrderNumber(rs.getString("municipal_order_no")); agreement.setMunicipalOrderDate(rs.getTimestamp("municipal_order_date")); agreement.setGovernmentOrderNumber(rs.getString("govt_order_no")); agreement.setGovernmentOrderDate(rs.getTimestamp("govt_order_date")); agreement.setRenewalDate(rs.getTimestamp("renewal_date")); agreement.setReservationCategory((Long) rs.getObject("res_category")); agreement.setOldAgreementNumber(isEmpty(rs.getString("old_agreement_no")) ? "" : rs.getString("old_agreement_no")); agreement.setReferenceNumber(rs.getString("referenceno")); agreement.setFloorNumber(rs.getString("floorno")); agreement.setParent((Long) rs.getObject("parent")); agreement.setTenderOpeningDate(rs.getTimestamp("tenderopeningdate")); agreement.setAuctionAmount(rs.getDouble("auctionamount")); agreement.setSolvencyAmount(rs.getDouble("solvencyamount")); agreement.setIsHistory(rs.getBoolean("ishistory")); agreement.setCgst(rs.getDouble("cgst")); agreement.setSgst(rs.getDouble("sgst")); agreement.setServiceTax(rs.getDouble("servicetax")); agreement.setNoticeNumber(rs.getString("noticeno")); String baseAllotment = rs.getString("base_allotment"); agreement.setBasisOfAllotment(BasisOfAllotment.fromValue(baseAllotment)); RentIncrementType rentIncrementType = new RentIncrementType(); rentIncrementType.setId((Long) rs.getObject("rent_increment_method")); rentIncrementType.setPercentage(rs.getDouble("percentage")); agreement.setRentIncrementMethod(rentIncrementType); Allottee allottee = new Allottee(); allottee.setId((Long) rs.getObject("allottee")); agreement.setAllottee(allottee); Asset asset = new Asset(); asset.setId((Long) rs.getObject("asset")); agreement.setAsset(asset); AgreementMap.put(agreementId, agreement); } List<String> demandIdList = agreement.getDemands(); String demandId = rs.getString("demandid"); if (demandId != null) { if (demandIdList == null) demandIdList = new ArrayList<>(); demandIdList.add(demandId); } agreement.setDemands(demandIdList); } catch (Exception e) { logger.info("exception in agreementRoqwMapper : " + e); e.printStackTrace(); throw new RuntimeException("error while mapping object from reult set : " + e.getCause()); } } logger.info("converting map to list object ::: " + AgreementMap.values()); return new ArrayList<>(AgreementMap.values()); } }
AgreementRowMapper implements ResultSetExtractor<List<Agreement>> { @Override public List<Agreement> extractData(ResultSet rs) throws SQLException, DataAccessException { Map<Long, Agreement> AgreementMap = new HashMap<>(); logger.info("after creating map object ::: " + AgreementMap.size()); String AgreementIdRsName = "lamsagreementid"; while (rs.next()) { try { Long agreementId = (Long) rs.getObject(AgreementIdRsName); logger.info("agreementid in row mapper" + agreementId); Agreement agreement = AgreementMap.get(agreementId); if (agreement == null) { agreement = new Agreement(); String action = rs.getString("action"); agreement.setAction(Action.fromValue(action)); agreement = getProcessObject(agreement, agreement.getAction(), rs); agreement.setId((Long) rs.getObject(AgreementIdRsName)); agreement.setAcknowledgementNumber(rs.getString("acknowledgementnumber")); agreement.setStateId(rs.getString("stateid")); agreement.setGoodWillAmount(rs.getDouble("goodwillamount")); agreement.setTimePeriod((Long) rs.getObject("timePeriod")); agreement.setAgreementDate(rs.getTimestamp("agreement_date")); agreement.setAgreementNumber(rs.getString("agreement_no")); agreement.setBankGuaranteeAmount(rs.getDouble("bank_guarantee_amount")); agreement.setBankGuaranteeDate(rs.getTimestamp("bank_guarantee_date")); agreement.setCaseNo(rs.getString("case_no")); agreement.setCommencementDate(rs.getTimestamp("commencement_date")); agreement.setCouncilDate(rs.getTimestamp("council_date")); agreement.setCouncilNumber(rs.getString("council_number")); agreement.setExpiryDate(rs.getTimestamp("expiry_date")); agreement.setCreatedDate(rs.getTimestamp("created_date")); agreement.setCreatedBy(rs.getString("created_by")); agreement.setLastmodifiedDate(rs.getTimestamp("last_modified_date")); agreement.setLastmodifiedBy(rs.getString("last_modified_by")); String source = rs.getString("source"); agreement.setSource(Source.fromValue(source)); agreement.setCollectedGoodWillAmount(rs.getDouble("collectedGoodWillAmount")); agreement.setCollectedSecurityDeposit(rs.getDouble("collectedSecurityDeposit")); String natureOfAllotment = rs.getString("nature_of_allotment"); agreement.setNatureOfAllotment(NatureOfAllotment.fromValue(natureOfAllotment)); agreement.setOrderDetails(rs.getString("order_details")); String PaymentCycleValue = rs.getString("payment_cycle"); agreement.setPaymentCycle(PaymentCycle.fromValue(PaymentCycleValue)); agreement.setRegistrationFee(rs.getDouble("registration_fee")); agreement.setRemarks(rs.getString("remarks")); agreement.setRent(rs.getDouble("rent")); agreement.setRrReadingNo(rs.getString("rr_reading_no")); String status = rs.getString("status"); agreement.setStatus(Status.fromValue(status)); agreement.setTinNumber(rs.getString("tin_number")); agreement.setTenantId(rs.getString("tenant_id")); agreement.setTenderDate(rs.getTimestamp("tender_date")); agreement.setTenderNumber(rs.getString("tender_number")); agreement.setSecurityDeposit(rs.getDouble("security_deposit")); agreement.setSecurityDepositDate(rs.getTimestamp("security_deposit_date")); agreement.setSolvencyCertificateDate(rs.getTimestamp("solvency_certificate_date")); agreement.setSolvencyCertificateNo(rs.getString("solvency_certificate_no")); agreement.setTradelicenseNumber(rs.getString("trade_license_number")); agreement.setIsAdvancePaid(rs.getBoolean("is_advancepaid")); agreement.setAdjustmentStartDate(rs.getTimestamp("adjustment_start_date")); agreement.setIsUnderWorkflow(rs.getBoolean("is_under_workflow")); agreement.setFirstAllotment(rs.getString("first_allotment")); agreement.setGstin(rs.getString("gstin")); agreement.setMunicipalOrderNumber(rs.getString("municipal_order_no")); agreement.setMunicipalOrderDate(rs.getTimestamp("municipal_order_date")); agreement.setGovernmentOrderNumber(rs.getString("govt_order_no")); agreement.setGovernmentOrderDate(rs.getTimestamp("govt_order_date")); agreement.setRenewalDate(rs.getTimestamp("renewal_date")); agreement.setReservationCategory((Long) rs.getObject("res_category")); agreement.setOldAgreementNumber(isEmpty(rs.getString("old_agreement_no")) ? "" : rs.getString("old_agreement_no")); agreement.setReferenceNumber(rs.getString("referenceno")); agreement.setFloorNumber(rs.getString("floorno")); agreement.setParent((Long) rs.getObject("parent")); agreement.setTenderOpeningDate(rs.getTimestamp("tenderopeningdate")); agreement.setAuctionAmount(rs.getDouble("auctionamount")); agreement.setSolvencyAmount(rs.getDouble("solvencyamount")); agreement.setIsHistory(rs.getBoolean("ishistory")); agreement.setCgst(rs.getDouble("cgst")); agreement.setSgst(rs.getDouble("sgst")); agreement.setServiceTax(rs.getDouble("servicetax")); agreement.setNoticeNumber(rs.getString("noticeno")); String baseAllotment = rs.getString("base_allotment"); agreement.setBasisOfAllotment(BasisOfAllotment.fromValue(baseAllotment)); RentIncrementType rentIncrementType = new RentIncrementType(); rentIncrementType.setId((Long) rs.getObject("rent_increment_method")); rentIncrementType.setPercentage(rs.getDouble("percentage")); agreement.setRentIncrementMethod(rentIncrementType); Allottee allottee = new Allottee(); allottee.setId((Long) rs.getObject("allottee")); agreement.setAllottee(allottee); Asset asset = new Asset(); asset.setId((Long) rs.getObject("asset")); agreement.setAsset(asset); AgreementMap.put(agreementId, agreement); } List<String> demandIdList = agreement.getDemands(); String demandId = rs.getString("demandid"); if (demandId != null) { if (demandIdList == null) demandIdList = new ArrayList<>(); demandIdList.add(demandId); } agreement.setDemands(demandIdList); } catch (Exception e) { logger.info("exception in agreementRoqwMapper : " + e); e.printStackTrace(); throw new RuntimeException("error while mapping object from reult set : " + e.getCause()); } } logger.info("converting map to list object ::: " + AgreementMap.values()); return new ArrayList<>(AgreementMap.values()); }  }
AgreementRowMapper implements ResultSetExtractor<List<Agreement>> { @Override public List<Agreement> extractData(ResultSet rs) throws SQLException, DataAccessException { Map<Long, Agreement> AgreementMap = new HashMap<>(); logger.info("after creating map object ::: " + AgreementMap.size()); String AgreementIdRsName = "lamsagreementid"; while (rs.next()) { try { Long agreementId = (Long) rs.getObject(AgreementIdRsName); logger.info("agreementid in row mapper" + agreementId); Agreement agreement = AgreementMap.get(agreementId); if (agreement == null) { agreement = new Agreement(); String action = rs.getString("action"); agreement.setAction(Action.fromValue(action)); agreement = getProcessObject(agreement, agreement.getAction(), rs); agreement.setId((Long) rs.getObject(AgreementIdRsName)); agreement.setAcknowledgementNumber(rs.getString("acknowledgementnumber")); agreement.setStateId(rs.getString("stateid")); agreement.setGoodWillAmount(rs.getDouble("goodwillamount")); agreement.setTimePeriod((Long) rs.getObject("timePeriod")); agreement.setAgreementDate(rs.getTimestamp("agreement_date")); agreement.setAgreementNumber(rs.getString("agreement_no")); agreement.setBankGuaranteeAmount(rs.getDouble("bank_guarantee_amount")); agreement.setBankGuaranteeDate(rs.getTimestamp("bank_guarantee_date")); agreement.setCaseNo(rs.getString("case_no")); agreement.setCommencementDate(rs.getTimestamp("commencement_date")); agreement.setCouncilDate(rs.getTimestamp("council_date")); agreement.setCouncilNumber(rs.getString("council_number")); agreement.setExpiryDate(rs.getTimestamp("expiry_date")); agreement.setCreatedDate(rs.getTimestamp("created_date")); agreement.setCreatedBy(rs.getString("created_by")); agreement.setLastmodifiedDate(rs.getTimestamp("last_modified_date")); agreement.setLastmodifiedBy(rs.getString("last_modified_by")); String source = rs.getString("source"); agreement.setSource(Source.fromValue(source)); agreement.setCollectedGoodWillAmount(rs.getDouble("collectedGoodWillAmount")); agreement.setCollectedSecurityDeposit(rs.getDouble("collectedSecurityDeposit")); String natureOfAllotment = rs.getString("nature_of_allotment"); agreement.setNatureOfAllotment(NatureOfAllotment.fromValue(natureOfAllotment)); agreement.setOrderDetails(rs.getString("order_details")); String PaymentCycleValue = rs.getString("payment_cycle"); agreement.setPaymentCycle(PaymentCycle.fromValue(PaymentCycleValue)); agreement.setRegistrationFee(rs.getDouble("registration_fee")); agreement.setRemarks(rs.getString("remarks")); agreement.setRent(rs.getDouble("rent")); agreement.setRrReadingNo(rs.getString("rr_reading_no")); String status = rs.getString("status"); agreement.setStatus(Status.fromValue(status)); agreement.setTinNumber(rs.getString("tin_number")); agreement.setTenantId(rs.getString("tenant_id")); agreement.setTenderDate(rs.getTimestamp("tender_date")); agreement.setTenderNumber(rs.getString("tender_number")); agreement.setSecurityDeposit(rs.getDouble("security_deposit")); agreement.setSecurityDepositDate(rs.getTimestamp("security_deposit_date")); agreement.setSolvencyCertificateDate(rs.getTimestamp("solvency_certificate_date")); agreement.setSolvencyCertificateNo(rs.getString("solvency_certificate_no")); agreement.setTradelicenseNumber(rs.getString("trade_license_number")); agreement.setIsAdvancePaid(rs.getBoolean("is_advancepaid")); agreement.setAdjustmentStartDate(rs.getTimestamp("adjustment_start_date")); agreement.setIsUnderWorkflow(rs.getBoolean("is_under_workflow")); agreement.setFirstAllotment(rs.getString("first_allotment")); agreement.setGstin(rs.getString("gstin")); agreement.setMunicipalOrderNumber(rs.getString("municipal_order_no")); agreement.setMunicipalOrderDate(rs.getTimestamp("municipal_order_date")); agreement.setGovernmentOrderNumber(rs.getString("govt_order_no")); agreement.setGovernmentOrderDate(rs.getTimestamp("govt_order_date")); agreement.setRenewalDate(rs.getTimestamp("renewal_date")); agreement.setReservationCategory((Long) rs.getObject("res_category")); agreement.setOldAgreementNumber(isEmpty(rs.getString("old_agreement_no")) ? "" : rs.getString("old_agreement_no")); agreement.setReferenceNumber(rs.getString("referenceno")); agreement.setFloorNumber(rs.getString("floorno")); agreement.setParent((Long) rs.getObject("parent")); agreement.setTenderOpeningDate(rs.getTimestamp("tenderopeningdate")); agreement.setAuctionAmount(rs.getDouble("auctionamount")); agreement.setSolvencyAmount(rs.getDouble("solvencyamount")); agreement.setIsHistory(rs.getBoolean("ishistory")); agreement.setCgst(rs.getDouble("cgst")); agreement.setSgst(rs.getDouble("sgst")); agreement.setServiceTax(rs.getDouble("servicetax")); agreement.setNoticeNumber(rs.getString("noticeno")); String baseAllotment = rs.getString("base_allotment"); agreement.setBasisOfAllotment(BasisOfAllotment.fromValue(baseAllotment)); RentIncrementType rentIncrementType = new RentIncrementType(); rentIncrementType.setId((Long) rs.getObject("rent_increment_method")); rentIncrementType.setPercentage(rs.getDouble("percentage")); agreement.setRentIncrementMethod(rentIncrementType); Allottee allottee = new Allottee(); allottee.setId((Long) rs.getObject("allottee")); agreement.setAllottee(allottee); Asset asset = new Asset(); asset.setId((Long) rs.getObject("asset")); agreement.setAsset(asset); AgreementMap.put(agreementId, agreement); } List<String> demandIdList = agreement.getDemands(); String demandId = rs.getString("demandid"); if (demandId != null) { if (demandIdList == null) demandIdList = new ArrayList<>(); demandIdList.add(demandId); } agreement.setDemands(demandIdList); } catch (Exception e) { logger.info("exception in agreementRoqwMapper : " + e); e.printStackTrace(); throw new RuntimeException("error while mapping object from reult set : " + e.getCause()); } } logger.info("converting map to list object ::: " + AgreementMap.values()); return new ArrayList<>(AgreementMap.values()); }  @Override List<Agreement> extractData(ResultSet rs); }
AgreementRowMapper implements ResultSetExtractor<List<Agreement>> { @Override public List<Agreement> extractData(ResultSet rs) throws SQLException, DataAccessException { Map<Long, Agreement> AgreementMap = new HashMap<>(); logger.info("after creating map object ::: " + AgreementMap.size()); String AgreementIdRsName = "lamsagreementid"; while (rs.next()) { try { Long agreementId = (Long) rs.getObject(AgreementIdRsName); logger.info("agreementid in row mapper" + agreementId); Agreement agreement = AgreementMap.get(agreementId); if (agreement == null) { agreement = new Agreement(); String action = rs.getString("action"); agreement.setAction(Action.fromValue(action)); agreement = getProcessObject(agreement, agreement.getAction(), rs); agreement.setId((Long) rs.getObject(AgreementIdRsName)); agreement.setAcknowledgementNumber(rs.getString("acknowledgementnumber")); agreement.setStateId(rs.getString("stateid")); agreement.setGoodWillAmount(rs.getDouble("goodwillamount")); agreement.setTimePeriod((Long) rs.getObject("timePeriod")); agreement.setAgreementDate(rs.getTimestamp("agreement_date")); agreement.setAgreementNumber(rs.getString("agreement_no")); agreement.setBankGuaranteeAmount(rs.getDouble("bank_guarantee_amount")); agreement.setBankGuaranteeDate(rs.getTimestamp("bank_guarantee_date")); agreement.setCaseNo(rs.getString("case_no")); agreement.setCommencementDate(rs.getTimestamp("commencement_date")); agreement.setCouncilDate(rs.getTimestamp("council_date")); agreement.setCouncilNumber(rs.getString("council_number")); agreement.setExpiryDate(rs.getTimestamp("expiry_date")); agreement.setCreatedDate(rs.getTimestamp("created_date")); agreement.setCreatedBy(rs.getString("created_by")); agreement.setLastmodifiedDate(rs.getTimestamp("last_modified_date")); agreement.setLastmodifiedBy(rs.getString("last_modified_by")); String source = rs.getString("source"); agreement.setSource(Source.fromValue(source)); agreement.setCollectedGoodWillAmount(rs.getDouble("collectedGoodWillAmount")); agreement.setCollectedSecurityDeposit(rs.getDouble("collectedSecurityDeposit")); String natureOfAllotment = rs.getString("nature_of_allotment"); agreement.setNatureOfAllotment(NatureOfAllotment.fromValue(natureOfAllotment)); agreement.setOrderDetails(rs.getString("order_details")); String PaymentCycleValue = rs.getString("payment_cycle"); agreement.setPaymentCycle(PaymentCycle.fromValue(PaymentCycleValue)); agreement.setRegistrationFee(rs.getDouble("registration_fee")); agreement.setRemarks(rs.getString("remarks")); agreement.setRent(rs.getDouble("rent")); agreement.setRrReadingNo(rs.getString("rr_reading_no")); String status = rs.getString("status"); agreement.setStatus(Status.fromValue(status)); agreement.setTinNumber(rs.getString("tin_number")); agreement.setTenantId(rs.getString("tenant_id")); agreement.setTenderDate(rs.getTimestamp("tender_date")); agreement.setTenderNumber(rs.getString("tender_number")); agreement.setSecurityDeposit(rs.getDouble("security_deposit")); agreement.setSecurityDepositDate(rs.getTimestamp("security_deposit_date")); agreement.setSolvencyCertificateDate(rs.getTimestamp("solvency_certificate_date")); agreement.setSolvencyCertificateNo(rs.getString("solvency_certificate_no")); agreement.setTradelicenseNumber(rs.getString("trade_license_number")); agreement.setIsAdvancePaid(rs.getBoolean("is_advancepaid")); agreement.setAdjustmentStartDate(rs.getTimestamp("adjustment_start_date")); agreement.setIsUnderWorkflow(rs.getBoolean("is_under_workflow")); agreement.setFirstAllotment(rs.getString("first_allotment")); agreement.setGstin(rs.getString("gstin")); agreement.setMunicipalOrderNumber(rs.getString("municipal_order_no")); agreement.setMunicipalOrderDate(rs.getTimestamp("municipal_order_date")); agreement.setGovernmentOrderNumber(rs.getString("govt_order_no")); agreement.setGovernmentOrderDate(rs.getTimestamp("govt_order_date")); agreement.setRenewalDate(rs.getTimestamp("renewal_date")); agreement.setReservationCategory((Long) rs.getObject("res_category")); agreement.setOldAgreementNumber(isEmpty(rs.getString("old_agreement_no")) ? "" : rs.getString("old_agreement_no")); agreement.setReferenceNumber(rs.getString("referenceno")); agreement.setFloorNumber(rs.getString("floorno")); agreement.setParent((Long) rs.getObject("parent")); agreement.setTenderOpeningDate(rs.getTimestamp("tenderopeningdate")); agreement.setAuctionAmount(rs.getDouble("auctionamount")); agreement.setSolvencyAmount(rs.getDouble("solvencyamount")); agreement.setIsHistory(rs.getBoolean("ishistory")); agreement.setCgst(rs.getDouble("cgst")); agreement.setSgst(rs.getDouble("sgst")); agreement.setServiceTax(rs.getDouble("servicetax")); agreement.setNoticeNumber(rs.getString("noticeno")); String baseAllotment = rs.getString("base_allotment"); agreement.setBasisOfAllotment(BasisOfAllotment.fromValue(baseAllotment)); RentIncrementType rentIncrementType = new RentIncrementType(); rentIncrementType.setId((Long) rs.getObject("rent_increment_method")); rentIncrementType.setPercentage(rs.getDouble("percentage")); agreement.setRentIncrementMethod(rentIncrementType); Allottee allottee = new Allottee(); allottee.setId((Long) rs.getObject("allottee")); agreement.setAllottee(allottee); Asset asset = new Asset(); asset.setId((Long) rs.getObject("asset")); agreement.setAsset(asset); AgreementMap.put(agreementId, agreement); } List<String> demandIdList = agreement.getDemands(); String demandId = rs.getString("demandid"); if (demandId != null) { if (demandIdList == null) demandIdList = new ArrayList<>(); demandIdList.add(demandId); } agreement.setDemands(demandIdList); } catch (Exception e) { logger.info("exception in agreementRoqwMapper : " + e); e.printStackTrace(); throw new RuntimeException("error while mapping object from reult set : " + e.getCause()); } } logger.info("converting map to list object ::: " + AgreementMap.values()); return new ArrayList<>(AgreementMap.values()); }  @Override List<Agreement> extractData(ResultSet rs); static final Logger logger; }