From 196f3cf0df11493b043d99f824d10307179573ed Mon Sep 17 00:00:00 2001
From: swetatech24 <sweta.prakash@wipro.com>
Date: Fri, 16 Jun 2023 16:27:43 +0530
Subject: [PATCH] Code smell fix

---
 .../identity/service/IdentityService.java     | 342 ------------------
 1 file changed, 342 deletions(-)

diff --git a/src/main/java/com/iemr/common/identity/service/IdentityService.java b/src/main/java/com/iemr/common/identity/service/IdentityService.java
index ab8bb995..40721cbf 100644
--- a/src/main/java/com/iemr/common/identity/service/IdentityService.java
+++ b/src/main/java/com/iemr/common/identity/service/IdentityService.java
@@ -95,8 +95,6 @@
 @Service
 public class IdentityService {
 	private static final Logger logger = LoggerFactory.getLogger(IdentityService.class);
-	// private ExecutorService executor = Executors
-	// .newFixedThreadPool(5)/* .newCachedThreadPool() */;
 
 	@Autowired
 	private DataSource dataSource;
@@ -575,13 +573,8 @@ private MBeneficiarymapping getBeneficiariesDTONew(Object[] benMapArr) {
 			benMapOBJ.setMBeneficiaryAccount(accountRepo
 					.getWith_vanSerialNo_vanID(getBigIntegerValueFromObject(benMapArr[7]), (Integer) benMapArr[8]));
 
-			// family
-//			benMapOBJ.setMBeneficiaryfamilymappings(
-//					familyMapRepo.findByBenMapIdOrderByBenFamilyMapIdAsc(getBigIntegerValueFromObject(benMapArr[9])));
 			benMapOBJ.setMBeneficiaryfamilymappings(familyMapRepo.findByBenMapIdAndVanIDOrderByBenFamilyMapIdAsc(
 					getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]));
-//			benMapOBJ
-//					.setMBeneficiaryidentities(identityRepo.findByBenMapId(getBigIntegerValueFromObject(benMapArr[9])));
 			benMapOBJ.setMBeneficiaryidentities(identityRepo
 					.findByBenMapIdAndVanID(getBigIntegerValueFromObject(benMapArr[9]), (Integer) benMapArr[8]));
 
@@ -688,8 +681,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			throw new MissingMandatoryFieldsException("Either of BeneficiaryID or Beneficiary Reg Id is mandatory.");
 		}
 
-		// SUNIL TODO: Logic for the various Edit scenarios goes here
-
 		MBeneficiarymapping benMapping = mappingRepo.findByBenRegIdOrderByBenMapIdAsc(identity.getBeneficiaryRegId());
 
 		// change in self details is implement here and other details here
@@ -700,15 +691,10 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 				|| Boolean.TRUE.equals(identity.getChangeInOtherDetails())
 				|| Boolean.TRUE.equals(identity.getChangeInAssociations())) {
 
-			// MBeneficiarydetail mbDetl =
-			// detailRepo.findOne(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId());
 			MBeneficiarydetail mbDetl = editMapper.IdentityEditDTOToMBeneficiarydetail(identity);
 			/**
 			 * new logic for data sync, 26-09-2018
 			 */
-			// next commented statement is old one
-			// mbDetl.setBeneficiaryDetailsId(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId());
-
 			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			MBeneficiarydetail benDetails = detailRepo.findBenDetailsByVanSerialNoAndVanID(
 					benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId(), benMapping.getVanID());
@@ -730,8 +716,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			 * END
 			 */
 
-			// old logic
-			// mbDetl.setBeneficiaryDetailsId(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId());
 			logger.debug("Beneficiary details to update = " + new OutputMapper().gson().toJson(mbDetl));
 			detailRepo.save(mbDetl);
 		}
@@ -745,8 +729,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			/**
 			 * new logic for data sync, 26-09-2018
 			 */
-			// next commented statement is old one
-			// mbAddr.setBenAddressID(benMapping.getMBeneficiaryaddress().getBenAddressID());
 
 			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			BigInteger benAddressID = addressRepo.findIdByVanSerialNoAndVanID(
@@ -761,8 +743,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			 * END
 			 */
 
-			// old logic
-			// mbAddr.setBenAddressID(benMapping.getMBeneficiaryaddress().getBenAddressID());
 			logger.debug("Beneficiary address to update = " + OutputMapper.gson().toJson(mbAddr));
 			addressRepo.save(mbAddr);
 		}
@@ -776,8 +756,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			/**
 			 * new logic for data sync, 26-09-2018
 			 */
-			// next commented statement is old one
-			// benCon.setBenContactsID(benMapping.getMBeneficiarycontact().getBenContactsID());
 
 			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			BigInteger benContactsID = contactRepo.findIdByVanSerialNoAndVanID(
@@ -793,7 +771,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			 */
 
 			logger.debug("Beneficiary contact to update = " + OutputMapper.gson().toJson(benCon));
-			// benCon.setBenContactsID(benMapping.getMBeneficiarycontact().getBenContactsID());
 			contactRepo.save(benCon);
 		}
 
@@ -806,10 +783,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 					.IdentityEditDTOListToMBeneficiaryidentityList(identity.getIdentities());
 			logger.debug("identities to upsert = " + OutputMapper.gson().toJson(identities));
 
-			// old logic for getting beneficiary identities, 26-09-2018
-			// List<MBeneficiaryidentity> idList =
-			// identityRepo.findByBenMapId(benMapping.getBenMapId());
-
 			// new logic for getting beneficiary identities, 26-09-2018
 			List<MBeneficiaryidentity> idList = identityRepo.findByBenMapId(benMapping.getVanSerialNo());
 
@@ -819,15 +792,11 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			while (iterator.hasNext()) {
 				beneficiaryidentity = iterator.next();
 
-				// old logic, 26-09-2018
-				// beneficiaryidentity.setBenMapId(benMapping.getBenMapId());
-
 				// new logic, 26-09-2018
 				beneficiaryidentity.setBenMapId(benMapping.getVanSerialNo());
 				logger.debug("Beneficiary identity to update = " + OutputMapper.gson().toJson(beneficiaryidentity));
 				if (index < idList.size() && beneficiaryidentity.getBenIdentityId() == null) {
 					beneficiaryidentity.setBenIdentityId(idList.get(index).getBenIdentityId());
-					// identityRepo.save(beneficiaryidentity);
 				}
 
 				// new code to set vanID & parkingPlaceID for new record, 26-09-2018
@@ -835,21 +804,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 					beneficiaryidentity.setVanID(benMapping.getVanID());
 					beneficiaryidentity.setParkingPlaceID(benMapping.getParkingPlaceID());
 				}
-				// else
-				// {
-				/**
-				 * add vanID & parkingPlaceID for data sync
-				 */
-				// if (identity != null && identity.getVanID() != null)
-				// beneficiaryidentity.setVanID(identity.getVanID());
-				// if (identity != null && identity.getParkingPlaceId() != null)
-				// beneficiaryidentity.setParkingPlaceID(identity.getParkingPlaceId());
-				/**
-				 * END
-				 */
-
-				// old logic, 26-09-2018
-				// identityRepo.save(beneficiaryidentity);
 
 				// new logic, 26-09-2018
 				MBeneficiaryidentity m = identityRepo.save(beneficiaryidentity);
@@ -859,17 +813,10 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 					int i8 = identityRepo.updateVanSerialNo(m.getBenIdentityId());
 				}
 
-				// }
 				index++;
 			}
 		}
 
-		// change other details are added here *** commented cause all details
-		// are
-		// available in ben details
-		// if(identity.getChangeInOtherDetails()){
-		// }
-
 		// family detail changes are performing here
 		logger.debug("identity.getChangeInFamilyDetails = " + identity.getChangeInFamilyDetails());
 		if (Boolean.TRUE.equals(identity.getChangeInFamilyDetails())) {
@@ -878,10 +825,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 
 			logger.debug("family map to upsert = " + OutputMapper.gson().toJson(fbMaps));
 
-			// old logic, 26-09-2018
-			// List<MBeneficiaryfamilymapping> fmList = familyMapRepo
-			// .findByBenMapIdOrderByBenFamilyMapIdAsc(benMapping.getBenMapId());
-
 			// new logic, 26-09-2018
 			List<MBeneficiaryfamilymapping> fmList = familyMapRepo
 					.findByBenMapIdOrderByBenFamilyMapIdAsc(benMapping.getVanSerialNo());
@@ -893,9 +836,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			while (iterator.hasNext()) {
 
 				familymapping = iterator.next();
-				// old logic, 26-09-2018
-				// familymapping.setBenMapId(benMapping.getBenMapId());
-
 				// new logic, 26-09-2018
 				familymapping.setBenMapId(benMapping.getVanSerialNo());
 
@@ -909,9 +849,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 					familymapping.setParkingPlaceID(benMapping.getParkingPlaceID());
 				}
 
-				// old logic, 26-09-2018
-				// familyMapRepo.save(familymapping);
-
 				// new logic, 26-09-2018
 				MBeneficiaryfamilymapping m = familyMapRepo.save(familymapping);
 
@@ -972,17 +909,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			imageRepo.save(beneficiaryImage);
 		}
 
-		// end
-
-		// change in association will be done here *** commented cause all
-		// details are
-		// available in ben details
-		// if(identity.getChangeInAssociations()) {
-		//
-		// }
-
 		logger.info("IdentityService.editIdentity - end. id = " + benMapping.getBenMapId());
-		// return benMapping;
 	}
 
 	/**
@@ -990,8 +917,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 	 * @return
 	 */
 
-	// SynchronousQueue<MBeneficiaryregidmapping> queue = new
-	// SynchronousQueue<MBeneficiaryregidmapping>();
 	ArrayDeque<MBeneficiaryregidmapping> queue = new ArrayDeque<MBeneficiaryregidmapping>();
 
 	public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRException {
@@ -1017,25 +942,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 
 		regMap.setProvisioned(true);
 
-		/*
-		 * synchronized (regIdRepo) { regMap =
-		 * regIdRepo.findFirstByProvisionedAndReserved(false, false);
-		 * 
-		 * if (regMap == null) throw new
-		 * IEMRException("Beneficiary IDs are not available! Please allocate the IDs");
-		 * 
-		 * regMap.setReserved(true);
-		 * 
-		 * regIdRepo.save(regMap);
-		 * 
-		 * regMap.setProvisioned(true); }
-		 */
-
-		// return regMap;
-		// });
-
-		// Future<MBeneficiaryaddress> fAddress = executor.submit(() ->
-		// {
 		logger.info("IdentityService.createIdentity - saving Address");
 		MBeneficiaryaddress mAddr = mapper.identityDTOToMBeneficiaryaddress(identity);
 		logger.info("identity.getIsPermAddrSameAsCurrAddr = " + identity.getIsPermAddrSameAsCurrAddr());
@@ -1068,11 +974,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		// Update van serial no for data sync
 		int i = addressRepo.updateVanSerialNo(mAddr.getBenAddressID());
 
-		// return mAddr;
-		// });
-
-		// Future<MBeneficiaryconsent> fConsent = executor.submit(() ->
-		// {
 		MBeneficiaryconsent mConsnt = mapper.identityDTOToDefaultMBeneficiaryconsent(identity, true, false);
 		logger.info("IdentityService.createIdentity - saving Consent");
 		mConsnt = consentRepo.save(mConsnt);
@@ -1081,11 +982,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		// Update van serial no for data sync
 		int i1 = consentRepo.updateVanSerialNo(mConsnt.getBenConsentID());
 
-		// return mConsnt;
-		// });
-
-		// Future<MBeneficiarycontact> fContact = executor.submit(() ->
-		// {
 		logger.info("IdentityService.createIdentity - saving Contacts");
 		MBeneficiarycontact mContc = mapper.identityDTOToMBeneficiarycontact(identity);
 		mContc = contactRepo.save(mContc);
@@ -1094,11 +990,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		// Update van serial no for data sync
 		int i2 = contactRepo.updateVanSerialNo(mContc.getBenContactsID());
 
-		// return mContc;
-		// });
-
-		// Future<MBeneficiarydetail> fDetail = executor.submit(() ->
-		// {
 		logger.info("IdentityService.createIdentity - saving Details");
 		MBeneficiarydetail mDetl = mapper.identityDTOToMBeneficiarydetail(identity);
 		mDetl = detailRepo.save(mDetl);
@@ -1107,38 +998,20 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		// Update van serial no for data sync
 		int i3 = detailRepo.updateVanSerialNo(mDetl.getBeneficiaryDetailsId());
 
-		// return mDetl;
-		// });
-
-		// start
-		// Feature used in outreach
-		// Future<MBeneficiaryAccount> fBankDetails = executor.submit(() ->
-		// {
 		MBeneficiaryAccount bankOBJ = mapper.identityDTOToMBeneficiaryAccount(identity);
 		bankOBJ = accountRepo.save(bankOBJ);
 		// Update van serial no for data sync
 		int i4 = accountRepo.updateVanSerialNo(bankOBJ.getBenAccountID());
 
-		// return bankOBJ;
-		// });
-
-		// Future<MBeneficiaryImage> fBenImage = executor.submit(() ->
-		// {
 		MBeneficiaryImage benImageOBJ = mapper.identityDTOToMBeneficiaryImage(identity);
 		benImageOBJ = imageRepo.save(benImageOBJ);
 
 		// Update van serial no for data sync
 		int i5 = imageRepo.updateVanSerialNo(benImageOBJ.getBenImageId());
 
-		// return benImageOBJ;
-		// });
-		// end
-
 		logger.info("IdentityService.createIdentity - saving Mapping");
 		MBeneficiarymapping benMapping = mapper.identityDTOToMBeneficiarymapping(identity);
 
-		// try
-		// {
 		benMapping.setMBeneficiarycontact(mContc);
 		benMapping.setMBeneficiaryaddress(mAddr);
 		benMapping.setMBeneficiaryconsent(mConsnt);
@@ -1158,35 +1031,12 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		// END
 
 		regIdRepo.save(regMap);
-		// } catch (InterruptedException | ExecutionException e)
-		// {
-		// logger.info("error under catch interrupted exception - benMapping: "
-		// + benMapping);
-		//
-		// e.printStackTrace();
-		// if (benMapping.getMBeneficiarycontact() != null)
-		// {
-		//
-		// logger.info("INSIDE IF IT IS THERE ");
-		// contactRepo.delete(benMapping.getMBeneficiarycontact().getBenContactsID());
-		// }
-		// if (benMapping.getMBeneficiaryaddress() != null)
-		// {
-		//
-		// logger.info("INSIDE IF IT IS THERE ");
-		// regIdRepo.delete(benMapping.getMBeneficiaryaddress().getBenAddressID());
-		// }
-		// e.printStackTrace();
-		// }
 
 		benMapping = mappingRepo.save(benMapping);
 		// Update van serial no for data sync
 		int i6 = mappingRepo.updateVanSerialNo(benMapping.getBenMapId());
 
 		final MBeneficiarymapping benMapping2 = benMapping;
-		// Future<List<MBeneficiaryfamilymapping>> fFamily = executor.submit(()
-		// ->
-		// {
 		logger.info("IdentityService.createIdentity - saving FamilyMaps");
 		List<MBeneficiaryfamilymapping> fIdenList = new ArrayList<MBeneficiaryfamilymapping>();
 		List<MBeneficiaryfamilymapping> fList = new ArrayList<MBeneficiaryfamilymapping>();
@@ -1217,38 +1067,11 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 				}
 			}
 
-			/**
-			 * commenting below code as optimization process, ABOVE code replaced it
-			 * 
-			 */
-
-			// ListIterator<MBeneficiaryfamilymapping> iterator = fIdenList.listIterator();
-			// while (iterator.hasNext()) {
-			//
-			// MBeneficiaryfamilymapping fMap = iterator.next();
-			// fMap.setBenMapId(benMapping2.getBenMapId());
-			// if (fMap.getAssociatedBenRegId() == null) {
-			// fMap.setAssociatedBenRegId(benMapping2.getBenRegId());
-			// }
-			// fMap = familyMapRepo.save(fMap);
-			// fList.add(fMap);
-			// }
-			/**
-			 * END
-			 * 
-			 */
 		}
 
 		logger.info("IdentityService.createIdentity - FamilyMap saved ");
-		// return fList;
-		// });
-
-		// Future<List<MBeneficiaryservicemapping>> fService =
-		// executor.submit(() ->
-		// {
 		logger.info("IdentityService.createIdentity - saving Service Map");
 		MBeneficiaryservicemapping sMap = mapper.identityDTOToMBeneficiaryservicemapping(identity);
-		// sMap.setMBeneficiarymapping(benMapping);
 		sMap.setBenMapId(benMapping.getBenMapId());
 		sMap = serviceMapRepo.save(sMap);
 		logger.info("IdentityService.createIdentity - ServiceMap saved  - id = " + sMap.getBenServiceMapID());
@@ -1258,11 +1081,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 
 		List<MBeneficiaryservicemapping> sList = new ArrayList<MBeneficiaryservicemapping>();
 		sList.add(sMap);
-		// return sList;
-		// });
-
-		// Future<List<MBeneficiaryidentity>> fIdentity = executor.submit(() ->
-		// {
 		logger.info("IdentityService.createIdentity - saving Identity");
 		List<MBeneficiaryidentity> mIdenList2 = new ArrayList<MBeneficiaryidentity>();
 		if (null != identity.getIdentities()) {
@@ -1289,15 +1107,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 			});
 		}
 
-		// commented on 28-09-2018
-		// benMapping.setMBeneficiaryfamilymappings(fList);
-		// benMapping.setMBeneficiaryservicemappings(sList);
-		// benMapping.setMBeneficiaryidentities(mIdenList2);
-		//
-		//
-		// benMapping = mappingRepo.save(benMapping);
-		// end
-
 		logger.info("IdentityService.createIdentity - end. id = " + benMapping.getBenMapId());
 		return partialMapper.MBeneficiarymappingToBeneficiaryCreateResp(benMapping);
 	}
@@ -1348,52 +1157,11 @@ public String unReserveIdentity(ReserveIdentityDTO unReserve) {
 	 * @param BenRegIds
 	 * @return {@link List} Beneficiaries
 	 */
-	// public List<BeneficiariesPartialDTO>
-	// getBeneficiariesPartialDeatilsByBenRegIdList(List<BigInteger> BenRegIds)
-	// {
-	//
-	// logger.info("IdentityService.getBeneficiariesPartialDeatilsByBenRegId -
-	// end");
-	// List<BeneficiariesPartialDTO> list = new
-	// ArrayList<BeneficiariesPartialDTO>();
-	// List<MBeneficiaryregidmapping> benMapIDList =
-	// (List<MBeneficiaryregidmapping>) regIdRepo.findAll(BenRegIds);
-	// ListIterator<MBeneficiaryregidmapping> benMapListIter =
-	// benMapIDList.listIterator();
-	//
-	// MBeneficiarydetail beneficiarydetail;
-	// MBeneficiarymapping benMap;
-	// while (benMapListIter.hasNext())
-	// {
-	//
-	// MBeneficiaryregidmapping regId = benMapListIter.next();
-	// beneficiarydetail =
-	// detailRepo.findPartialBeneficiaryDetailByBenRegId(regId.getBenRegId());
-	// benMap = new MBeneficiarymapping();
-	// benMap.setMBeneficiarydetail(beneficiarydetail);
-	// benMap.setMBeneficiaryregidmapping(regId);
-	// list.add(partialMapper.MBeneficiarymappingToBeneficiariesPartialDTO(benMap));
-	// }
-	//
-	// logger.info("IdetityService.getBeneficiariesPartialDeatilsByBenRegId -
-	// end");
-	//
-	// return list;
-	// }
 
 	public List<BeneficiariesPartialDTO> getBeneficiariesPartialDeatilsByBenRegIdList(List<BigInteger> BenRegIds) {
 
 		logger.info("IdentityService.getBeneficiariesPartialDeatilsByBenRegId - end");
 		List<BeneficiariesPartialDTO> list = new ArrayList<BeneficiariesPartialDTO>();
-		// old logic
-		// List<MBeneficiarymapping> benMapIDList = (List<MBeneficiarymapping>)
-		// mappingRepo
-		// .findAllByBenRegIdOrderByBenMapIdAsc(BenRegIds);
-		// // List<Future<?>> futures = new ArrayList<Future<?>>();
-		// for (MBeneficiarymapping benMap : benMapIDList) {
-		// list.add(partialMapper.MBeneficiarymappingToBeneficiariesPartialDTO(benMap));
-		// }
-		// end
 
 		// new logic, 19-12-2018
 		List<Object[]> benMapObjArr = new ArrayList<>();
@@ -1402,7 +1170,6 @@ public List<BeneficiariesPartialDTO> getBeneficiariesPartialDeatilsByBenRegIdLis
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				for (Object[] objArr : benMapObjArr) {
 					MBeneficiarymapping benMap = this.getBeneficiariesDTONewPartial(objArr);
-//					logger.info("benMap " + benMap);
 
 					list.add(partialMapper.MBeneficiarymappingToBeneficiariesPartialDTO(benMap));
 				}
@@ -1423,68 +1190,10 @@ public List<BeneficiariesPartialDTO> getBeneficiariesPartialDeatilsByBenRegIdLis
 	 * @param BenRegIds
 	 * @return {@link List} Beneficiaries
 	 */
-	// public List<BeneficiariesDTO>
-	// getBeneficiariesDeatilsByBenRegIdList(List<BigInteger> BenRegIds)
-	// {
-	//
-	// logger.info("IdentityService.getBeneficiariesPartialDeatilsByBenRegId -
-	// end");
-	// List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
-	// List<MBeneficiaryregidmapping> benMapIDList =
-	// (List<MBeneficiaryregidmapping>) regIdRepo.findAll(BenRegIds);
-	// List<MBeneficiarymapping> benMapList = new
-	// ArrayList<MBeneficiarymapping>();
-	//
-	// benMapIDList.forEach(benIdMap ->
-	// {
-	//
-	// MBeneficiarymapping benMap =
-	// mappingRepo.findByBenRegIdOrderByBenMapIdAsc(benIdMap.getBenRegId());
-	// benMapList.add(benMap);
-	// });
-	//
-	// List<Future<?>> futures = new ArrayList<Future<?>>();
-	// benMapList.forEach(benMap ->
-	// {
-	// Future<?> future = executor.submit(() ->
-	// {
-	//
-	// list.add(this.getBeneficiariesDTO(benMap));
-	// logger.info("benMapId: " + benMap.getBenMapId() + " :: BenId: "
-	// + benMap.getMBeneficiaryregidmapping().getBeneficiaryID());
-	// });
-	// futures.add(future);
-	// });
-	//
-	// try
-	// {
-	// for (Future<?> future : futures)
-	// {
-	// future.get();
-	// }
-	// } catch (InterruptedException | ExecutionException e)
-	// {
-	// e.printStackTrace();
-	// }
-	//
-	// logger.info("IdetityService.getBeneficiariesPartialDeatilsByBenRegId -
-	// end");
-	//
-	// return list;
-	// }
 	public List<BeneficiariesDTO> getBeneficiariesDeatilsByBenRegIdList(List<BigInteger> BenRegIds) {
 
 		logger.info("IdentityService.getBeneficiariesDeatilsByBenRegIdList - end");
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
-		// old logic
-		// List<MBeneficiarymapping> benMapIDList = (List<MBeneficiarymapping>)
-		// mappingRepo
-		// .findAllByBenRegIdOrderByBenMapIdAsc(BenRegIds);
-		//
-		// for (MBeneficiarymapping benMap : benMapIDList) {
-		// list.add(getBeneficiariesDTO(benMap));
-		// }
-		// end
 
 		// new logic, 19-12-2018
 		List<Object[]> benMapObjArr = new ArrayList<>();
@@ -1513,8 +1222,6 @@ public List<BeneficiariesDTO> getBeneficiariesDeatilsByBenRegIdList(List<BigInte
 	 * @param benMap
 	 * @return
 	 */
-	// private synchronized BeneficiariesDTO
-	// getBeneficiariesDTO(MBeneficiarymapping benMap)
 	private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 
 		BeneficiariesDTO bdto = mapper.MBeneficiarymappingToBeneficiariesDTO(benMap);
@@ -1523,7 +1230,6 @@ private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 		bdto.setBeneficiaryIdentites(
 				mapper.mBeneficiaryidentityListToBenIdentityDTOList(benMap.getMBeneficiaryidentities()));
 
-		// System.out.println("ABHA start....");
 		List<Object[]> abhaList = v_BenAdvanceSearchRepo.getBenAbhaDetailsByBenRegID(bdto.getBenRegId());
 		if (abhaList != null && abhaList.size() > 0) {
 			List<AbhaAddressDTO> abhaDTOList = new ArrayList<>();
@@ -1545,7 +1251,6 @@ private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 			}
 			bdto.setAbhaDetails(abhaDTOList);
 		}
-		// System.out.println("ABHA end....");
 		return bdto;
 	}
 
@@ -1559,30 +1264,11 @@ public List<BeneficiariesDTO> getBeneficiaries(IdentityDTO identityDTO) {
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 
 		List<MBeneficiarymapping> benMapList = mappingRepo.finiteSearch(identityDTO);
-		// List<Future<?>> futures = new ArrayList<Future<?>>();
-		// benMapList.forEach(benMap ->
-		// {
-		// Future<?> future = executor.submit(() ->
-		// {
 		for (MBeneficiarymapping benMap : benMapList) {
 			list.add(this.getBeneficiariesDTO(benMap));
 			logger.info("benMapId: " + benMap.getBenMapId() + " :: BenId: "
 					+ benMap.getMBeneficiaryregidmapping().getBeneficiaryID());
 		}
-		// });
-		// futures.add(future);
-		// });
-
-		// try
-		// {
-		// for (Future<?> future : futures)
-		// {
-		// future.get();
-		// }
-		// } catch (InterruptedException | ExecutionException e)
-		// {
-		// e.printStackTrace();
-		// }
 
 		return list;
 	}
@@ -1595,14 +1281,12 @@ public String getBeneficiaryImage(String requestOBJ) {
 		OutputResponse response = new OutputResponse();
 		try {
 			Map<String, Object> benImageMap = new HashMap<String, Object>();
-			// String benImage = null;
 			if (requestOBJ != null) {
 				JsonObject obj = new JsonObject();
 				JsonParser jsnParser = new JsonParser();
 				JsonElement jsnElmnt = jsnParser.parse(requestOBJ);
 				obj = jsnElmnt.getAsJsonObject();
 
-				// JSONObject obj = new JSONObject(requestOBJ);
 				if (obj != null && obj.has("beneficiaryRegID") && obj.get("beneficiaryRegID") != null) {
 					MBeneficiarymapping benMap = mappingRepo
 							.getBenImageIdByBenRegID(obj.get("beneficiaryRegID").getAsBigInteger());
@@ -1631,33 +1315,11 @@ public String getBeneficiaryImage(String requestOBJ) {
 	}
 
 	public void editIdentityEducationOrCommunity(IdentityEditDTO identity) throws MissingMandatoryFieldsException {
-		// TODO Auto-generated method stub
 		logger.info("IdentityService.editIdentityEducationorCommunity - start");
 		if (identity.getBeneficiaryRegId() == null && null == identity.getBeneficaryId()) {
 			throw new MissingMandatoryFieldsException("Either of BeneficiaryID or Beneficiary Reg Id is mandatory.");
 		}
 
-		// SUNIL TODO: Logic for the various Edit scenarios goes here
-		// old logic : 13-11-2018
-		// MBeneficiarymapping benMapping =
-		// mappingRepo.findByBenRegIdOrderByBenMapIdAsc(identity.getBeneficiaryRegId());
-		// MBeneficiarydetail mbDetl =
-		// editMapper.IdentityEditDTOToMBeneficiarydetail(identity);
-		// logger.debug("Beneficiary details to update = " + new
-		// OutputMapper().gson().toJson(mbDetl));
-		// mbDetl.setBeneficiaryDetailsId(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId());
-		// if (benMapping != null && benMapping.getMBeneficiarydetail() != null
-		// && benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId() != null) {
-		// if (identity.getCommunityId() != null) {
-		// detailRepo.updateCommunity(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId(),
-		// identity.getCommunityId());
-		// }
-		// if (identity.getEducationId() != null) {
-		// detailRepo.updateEducation(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId(),
-		// identity.getEducationId());
-		// }
-		// }
-
 		// new logic : 13-11-2018
 		MBeneficiarymapping benMapping = mappingRepo.findByBenRegIdOrderByBenMapIdAsc(identity.getBeneficiaryRegId());
 		if (benMapping != null && benMapping.getBenDetailsId() != null && benMapping.getVanID() != null) {
@@ -1695,15 +1357,11 @@ public int importBenIdToLocalServer(List<BenIdImportDTO> benIdImportDTOList) {
 				objArr[5] = false;
 
 				dataList.add(objArr);
-//				obj.setProvisioned(false);
-//				obj.setReserved(false);
 				System.out.println("regid :" + obj.getBenRegId() + " - benid :" + obj.getBeneficiaryID());
 			}
 
 			int[] i = jdbcTemplate.batchUpdate(query, dataList);
 
-//			ArrayList<MBeneficiaryregidmapping> rs = (ArrayList<MBeneficiaryregidmapping>) regIdRepo
-//					.save(mBeneficiaryregidmappingList);
 			return i.length;
 		} else
 			return 0;
