From 665da66d6a64a91748faa7092593a0d4433e3ecc Mon Sep 17 00:00:00 2001
From: swetatech24 <sweta.prakash@wipro.com>
Date: Thu, 15 Jun 2023 17:15:33 +0530
Subject: [PATCH 1/4] code smell fix

---
 .../controller/IdentityController.java        |   1 -
 .../data/familyTagging/BenFamilyMapping.java  |   3 -
 .../rmnch/RMNCHBeneficiaryDetailsRmnch.java   |   6 -
 .../data/rmnch/RMNCHMBeneficiaryAccount.java  |   1 -
 .../rmnch/RMNCHMBeneficiaryfamilymapping.java |   3 -
 .../iemr/common/identity/domain/Address.java  |   1 -
 .../identity/domain/MBeneficiaryAccount.java  |   1 -
 .../identity/domain/MBeneficiaryImage.java    |   2 -
 .../identity/domain/MBeneficiarydetail.java   |  12 -
 .../domain/MBeneficiaryfamilymapping.java     |   5 -
 .../identity/domain/MBeneficiaryidentity.java |   6 -
 .../identity/domain/MBeneficiarymapping.java  |  45 ---
 .../domain/MBeneficiaryregidmapping.java      |  20 -
 .../domain/MBeneficiaryservicemapping.java    |   4 -
 .../identity/domain/TBendataaccess.java       |   9 -
 .../identity/domain/V_BenAdvanceSearch.java   |   2 -
 .../common/identity/dto/BeneficiariesDTO.java |   3 -
 .../iemr/common/identity/dto/IdentityDTO.java |  11 +-
 .../common/identity/dto/IdentityEditDTO.java  |   8 -
 .../exception/SearchCriteriaException.java    |   1 -
 .../identity/mapper/IdentityMapper.java       |  15 -
 .../common/identity/repo/BenContactRepo.java  |   4 -
 .../identity/repo/BenDataAccessRepo.java      |  21 -
 .../common/identity/repo/BenDetailRepo.java   |  11 -
 .../identity/repo/BenDetailRepoImpl.java      |  12 -
 .../identity/repo/BenFamilyMappingRepo.java   |  10 -
 .../common/identity/repo/BenMappingRepo.java  |  81 ----
 .../identity/repo/BenMappingRepoImpl.java     |   2 -
 .../identity/repo/BenRegIdMappingRepo.java    |   2 -
 .../identity/service/IdentityService.java     | 379 ------------------
 30 files changed, 1 insertion(+), 680 deletions(-)

diff --git a/src/main/java/com/iemr/common/identity/controller/IdentityController.java b/src/main/java/com/iemr/common/identity/controller/IdentityController.java
index 782b7586..3cd6d75e 100644
--- a/src/main/java/com/iemr/common/identity/controller/IdentityController.java
+++ b/src/main/java/com/iemr/common/identity/controller/IdentityController.java
@@ -458,7 +458,6 @@ public class IdentityController {
 		}
 
 		IdentityEditDTO identity = InputMapper.getInstance().gson().fromJson(json, IdentityEditDTO.class);
-		// MBeneficiarymapping map;
 		try {
 			svc.editIdentity(identity);
 			String response = getSuccessResponseString("Updated successfully", 200, "success", "editIdentityByAgent");
diff --git a/src/main/java/com/iemr/common/identity/data/familyTagging/BenFamilyMapping.java b/src/main/java/com/iemr/common/identity/data/familyTagging/BenFamilyMapping.java
index e10ea131..f595accf 100644
--- a/src/main/java/com/iemr/common/identity/data/familyTagging/BenFamilyMapping.java
+++ b/src/main/java/com/iemr/common/identity/data/familyTagging/BenFamilyMapping.java
@@ -119,9 +119,6 @@ public class BenFamilyMapping {
 	@Transient
 	private Integer blockId;
 
-//	@Transient
-//	private BenFamilyMapping memberList[];
-
 	@Transient
 	private Long beneficiaryRegId;
 
diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java
index 944e2b70..4be1b4a3 100644
--- a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java
+++ b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHBeneficiaryDetailsRmnch.java
@@ -353,12 +353,6 @@ public class RMNCHBeneficiaryDetailsRmnch {
 	@Expose
 	@Transient
 	private String stateName;
-//	@Expose
-//	@Transient
-//	private Integer districtId;
-//	@Expose
-//	@Transient
-//	private String districtName;
 	@Expose
 	@Transient
 	private Integer blockId;
diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryAccount.java b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryAccount.java
index 78e0da58..1cb6a282 100644
--- a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryAccount.java
+++ b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryAccount.java
@@ -31,7 +31,6 @@
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import com.google.gson.annotations.Expose;
 
 import lombok.Data;
diff --git a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryfamilymapping.java b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryfamilymapping.java
index 6ba6ff7d..5da37b40 100644
--- a/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryfamilymapping.java
+++ b/src/main/java/com/iemr/common/identity/data/rmnch/RMNCHMBeneficiaryfamilymapping.java
@@ -30,9 +30,6 @@
 import javax.persistence.GeneratedValue;
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.NamedQuery;
 import javax.persistence.Table;
 
 import com.google.gson.annotations.Expose;
diff --git a/src/main/java/com/iemr/common/identity/domain/Address.java b/src/main/java/com/iemr/common/identity/domain/Address.java
index d37059de..c37b4507 100644
--- a/src/main/java/com/iemr/common/identity/domain/Address.java
+++ b/src/main/java/com/iemr/common/identity/domain/Address.java
@@ -45,7 +45,6 @@
 	 */
 	private Integer zoneID;
 	private String zoneName;
-	// private Integer parkingPlaceID;
 	private String parkingPlaceName;
 	private Integer servicePointID;
 	private String servicePointName;
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java
index ebdc65fa..a89b7743 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java
@@ -93,7 +93,6 @@ public class MBeneficiaryAccount {
 	private String vehicleNo;
 
 	// @Column(name = "ParkingPlaceID")
-	// private Integer parkingPlaceID;
 
 	@Column(name = "SyncedBy", length = 30)
 	private String syncedBy;
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java
index b4bbec5a..acca6ced 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java
@@ -21,7 +21,6 @@
 */
 package com.iemr.common.identity.domain;
 
-import java.math.BigInteger;
 import java.sql.Timestamp;
 
 import javax.persistence.Column;
@@ -74,7 +73,6 @@ public class MBeneficiaryImage {
 	@Column(name = "VehicalNo")
 	private String vehicalNo;
 	// @Column(name = "ParkingPlaceID")
-	// private Integer parkingPlaceID;
 	@Column(name = "SyncedBy")
 	private String syncedBy;
 	@Column(name = "SyncedDate", unique = true, nullable = false)
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
index 6d44d817..91922bdb 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
@@ -125,8 +125,6 @@ public class MBeneficiarydetail implements Serializable {
 	@Column(length = 50)
 	private String modifiedBy;
 
-	// private Integer parkingPlaceID;
-
 	private Integer occupationId;
 
 	@Column(length = 45)
@@ -238,11 +236,6 @@ public class MBeneficiarydetail implements Serializable {
 	@Column(name = "VanSerialNo", updatable = false)
 	private BigInteger vanSerialNo;
 
-//	@Expose
-//	@Column(name = "familyid", updatable = true)
-//	private String familyid;
-
-	// END OF new column added for data sync
 	/**
 	 * Default constructor
 	 */
@@ -342,9 +335,4 @@ public static String getIsHIVPositive(Integer status) {
 		return isHIVPositive;
 	}
 
-	// public static void main(String[] args)
-	// {
-	// Timestamp dob = new Timestamp(10, 07, 10,0,0,0,0);
-	// System.out.println(calculateAge(dob));
-	// }
 }
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryfamilymapping.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryfamilymapping.java
index 74a42016..510d1d2e 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryfamilymapping.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryfamilymapping.java
@@ -94,11 +94,6 @@ public class MBeneficiaryfamilymapping implements Serializable {
 
 	private Timestamp reservedOn;
 
-	// commented, 28-09-2018
-	// bi-directional many-to-one association to MBeneficiarymapping
-//	@ManyToOne(/* fetch = FetchType.EAGER */)
-//	@JoinColumn(name = "BenMapId", insertable = false, updatable = false)
-//	private MBeneficiarymapping MBeneficiarymapping;
 
 	@Column(name = "BenMapId", insertable = true, updatable = true)
 	private BigInteger benMapId;
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryidentity.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryidentity.java
index 60ab2fcc..4323b895 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryidentity.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryidentity.java
@@ -103,12 +103,6 @@ public class MBeneficiaryidentity implements Serializable {
 
 	private Timestamp reservedOn;
 
-	// commented, 28-09-2018, unidirectional
-	// bi-directional many-to-one association to MBeneficiarymapping
-//	@ManyToOne(/* fetch = FetchType.EAGER */) /* (fetch = FetchType.LAZY) */
-//	@JoinColumn(name = "BenMapId", insertable = false, updatable = false)
-//	private MBeneficiarymapping MBeneficiarymapping;
-
 	@Column(name = "BenMapId", insertable = true, updatable = true)
 	private BigInteger benMapId;
 
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java
index 078838be..1503d463 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java
@@ -84,7 +84,6 @@ public class MBeneficiarymapping implements Serializable {
 
 	private Timestamp reservedOn;
 
-	// uni-directional one-to-one association to MBeneficiaryaddress
 	@OneToOne
 	@JoinColumn(name = "BenAddressId", nullable = false)
 	private MBeneficiaryaddress mBeneficiaryaddress;
@@ -92,7 +91,6 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenAddressId", insertable = false, updatable = false)
 	private BigInteger benAddressId;
 
-	// uni-directional one-to-one association to MBeneficiaryconsent
 	@OneToOne
 	@JoinColumn(name = "BenConsentId"/* , nullable=false */)
 	private MBeneficiaryconsent mBeneficiaryconsent;
@@ -100,7 +98,6 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenConsentId", insertable = false, updatable = false)
 	private BigInteger benConsentId;
 
-	// uni-directional one-to-one association to MBeneficiarycontact
 	@OneToOne
 	@JoinColumn(name = "BenContactsId", nullable = false)
 	private MBeneficiarycontact mBeneficiarycontact;
@@ -108,7 +105,6 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenContactsId", insertable = false, updatable = false)
 	private BigInteger benContactsId;
 
-	// uni-directional one-to-one association to MBeneficiarydetail
 	@OneToOne
 	@JoinColumn(name = "BenDetailsId", referencedColumnName = "BeneficiaryDetailsId", nullable = false)
 	private MBeneficiarydetail mBeneficiarydetail;
@@ -116,68 +112,33 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenDetailsId", insertable = false, updatable = false)
 	private BigInteger benDetailsId;
 
-	// uni-directional one-to-one association to MBeneficiaryregidmapping
 	@OneToOne
 	@JoinColumn(name = "BenRegId"/* , nullable=false */)
 	private MBeneficiaryregidmapping mBeneficiaryregidmapping;
 
-	// adding BenRegId variable to get BenMapId for edit beneficiary details
 	@Column(name = "BenRegId", insertable = false, updatable = false)
 	private BigInteger benRegId;
 
-	// uni-directional one-to-one association to MBensecurestack
 	@OneToOne
 	@JoinColumn(name = "BenSecureStackId", nullable = false)
 	private MBensecurestack mBeneficiarysecurestack;
 
-	// uni-directional, new, 28-09-2018
-	// bi-directional many-to-one association to MBeneficiaryfamilymapping
-	// @OneToMany(mappedBy="MBeneficiarymapping", fetch=FetchType.EAGER)
-	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<MBeneficiaryfamilymapping> mBeneficiaryfamilymappings;
 
-	// uni-directional, new, 28-09-2018
-	// bi-directional many-to-one association to MBeneficiaryidentity
-	// @OneToMany(mappedBy = "MBeneficiarymapping", fetch = FetchType.EAGER)
-	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<MBeneficiaryidentity> mBeneficiaryidentities;
 
-	// uni-directional, new, 28-09-2018
-	// bi-directional many-to-one association to MBeneficiaryservicemapping
-	// @OneToMany(mappedBy = "MBeneficiarymapping", fetch = FetchType.EAGER)
-	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<MBeneficiaryservicemapping> mBeneficiaryservicemappings;
 
-	// uni-directional, new, 28-09-2018
-	// bi-directional many-to-one association to TBendataaccess
-	// @OneToMany(mappedBy = "MBeneficiarymapping", fetch = FetchType.EAGER)
-	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<TBendataaccess> tBendataaccesses;
 
-	// public MBeneficiarymapping(BigInteger benMapId, String firstName)
-	// {
-	// this.mBeneficiarydetail.setFirstName(firstName);
-	// this.mBeneficiarydetail.setFirstName(firstName);
-	// this.mBeneficiarydetail.setFirstName(firstName);
-	// }
-
-	// public MBeneficiarymapping()
-	// {
-	//
-	// }
-
-	/*
-	 * New columns added for MMU integration 11-04-2018
-	 */
-	// uni-directional one-to-one association
 	@OneToOne
 	@JoinColumn(name = "BenImageId")
 	private MBeneficiaryImage mBeneficiaryImage;
@@ -185,7 +146,6 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "benImageId", insertable = false, updatable = false)
 	private Long benImageId;
 
-	// uni-directional one-to-one association
 	@OneToOne
 	@JoinColumn(name = "BenAccountID")
 	private MBeneficiaryAccount mBeneficiaryAccount;
@@ -193,10 +153,7 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "benAccountID", insertable = false, updatable = false)
 	private Long benAccountID;
 
-	// End
 
-	// new column added for data sync
-	// 17-06-2018
 	@Expose
 	@Column(name = "vanID", updatable = false)
 	private Integer vanID;
@@ -208,7 +165,6 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "VanSerialNo", updatable = false)
 	private BigInteger vanSerialNo;
 
-	// 20-01-2021, added for D2D
 	@Expose
 	@Transient
 	private Long houseHoldID;
@@ -242,6 +198,5 @@ public MBeneficiarymapping(BigInteger benMapId, BigInteger benAddressId, BigInte
 		this.createdDate = createdDate;
 	}
 
-	// END OF new column added for data sync
 
 }
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryregidmapping.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryregidmapping.java
index 56717909..0e15dfcd 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryregidmapping.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryregidmapping.java
@@ -80,7 +80,6 @@ public class MBeneficiaryregidmapping implements Serializable {
 	@Column(name = "VehicalNo")
 	private String vehicalNo;
 
-	// private Integer ParkingPlaceID;
 
 	private String syncedBy;
 
@@ -88,24 +87,6 @@ public class MBeneficiaryregidmapping implements Serializable {
 
 	private String reservedForChange;
 
-	// //bi-directional one-to-one association to MBeneficiarydetail
-	// @OneToOne(fetch=FetchType.LAZY)
-	// @JoinColumn(name="BenRegId", referencedColumnName="BeneficiaryRegID",
-	// nullable=false, insertable=false, updatable=false)
-	// private MBeneficiarydetail MBeneficiarydetail;
-	//
-	// //bi-directional one-to-one association to MBeneficiarymapping
-	// @OneToOne(fetch=FetchType.LAZY)
-	// @JoinColumn(name="BenRegId", referencedColumnName="BenRegId", nullable=false,
-	// insertable=false, updatable=false)
-	// private MBeneficiarymapping MBeneficiarymapping;
-	//
-	// //bi-directional many-to-one association to MBeneficiaryfamilymapping
-	// @OneToMany(mappedBy="MBeneficiaryregid")
-	// private List<MBeneficiaryfamilymapping> MBeneficiaryfamilymappings;
-
-	// new column added for data sync
-	// 17-06-2018
 	@Expose
 	@Column(name = "vanID")
 	private Integer vanID;
@@ -117,5 +98,4 @@ public class MBeneficiaryregidmapping implements Serializable {
 	@Column(name = "VanSerialNo")
 	private BigInteger vanSerialNo;
 
-	// END OF new column added for data sync
 }
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryservicemapping.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryservicemapping.java
index 3d92c90e..aea73035 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryservicemapping.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryservicemapping.java
@@ -107,10 +107,6 @@ public class MBeneficiaryservicemapping implements Serializable {
 	@Column(length = 45)
 	private String stateName;
 
-	// bi-directional many-to-one association to MBeneficiarymapping
-//	@ManyToOne(/* fetch = FetchType.EAGER */) /* (fetch = FetchType.LAZY) */
-//	@JoinColumn(name = "BenMapId")
-//	private MBeneficiarymapping MBeneficiarymapping;
 	
 	@Column(name = "BenMapId", insertable = true, updatable = true)
 	private BigInteger benMapId;
diff --git a/src/main/java/com/iemr/common/identity/domain/TBendataaccess.java b/src/main/java/com/iemr/common/identity/domain/TBendataaccess.java
index 72fb3a23..647bfda4 100644
--- a/src/main/java/com/iemr/common/identity/domain/TBendataaccess.java
+++ b/src/main/java/com/iemr/common/identity/domain/TBendataaccess.java
@@ -68,8 +68,6 @@ public class TBendataaccess implements Serializable
 	private String authId;
 
 	@Transient
-	// @Column(nullable=false, length=75) //SQL Error: 1054, SQLState: 42S22 Unknown column 'tbendataac0_.consentId' in
-	// 'field list'
 	private String consentId;
 
 	@Column(length = 4)
@@ -79,8 +77,6 @@ public class TBendataaccess implements Serializable
 	private Integer userAgentId;
 
 	@Transient
-	// @Column(nullable=false, length=20)// SQL Error: 1054, SQLState: 42S22 Unknown column
-	// 'tbendataac0_.userAgentIpAddr' in 'field list'
 	private String userAgentIpAddr;
 
 	@Column(nullable = false)
@@ -92,11 +88,6 @@ public class TBendataaccess implements Serializable
 	@Column(nullable = false)
 	private Integer userAgentServiceId;
 
-	// commented on 28-09-2018
-	// bi-directional many-to-one association to MBeneficiarymapping
-//	@ManyToOne(/*fetch = FetchType.EAGER*/) /* (fetch = FetchType.LAZY) */
-//	@JoinColumn(name = "BenMapId", nullable = false)
-//	private MBeneficiarymapping MBeneficiarymapping;
 	@Column(name = "BenMapId", insertable = true, updatable = true)
 	private BigInteger benMapId;
 
diff --git a/src/main/java/com/iemr/common/identity/domain/V_BenAdvanceSearch.java b/src/main/java/com/iemr/common/identity/domain/V_BenAdvanceSearch.java
index 81a8b278..ea615acd 100644
--- a/src/main/java/com/iemr/common/identity/domain/V_BenAdvanceSearch.java
+++ b/src/main/java/com/iemr/common/identity/domain/V_BenAdvanceSearch.java
@@ -97,7 +97,6 @@ public class V_BenAdvanceSearch {
 	@Column(name = "DOB")
 	private Timestamp dOB;
 
-	// new column added for D2D, 21-01-2021
 	@Expose
 	@Column(name = "houseoldId")
 	private Long houseHoldID;
@@ -144,7 +143,6 @@ public void setHouseHoldID(Long houseHoldID) {
 
 	public V_BenAdvanceSearch() {
 		super();
-		// TODO Auto-generated constructor stub
 	}
 
 	public BigInteger getBenMapID() {
diff --git a/src/main/java/com/iemr/common/identity/dto/BeneficiariesDTO.java b/src/main/java/com/iemr/common/identity/dto/BeneficiariesDTO.java
index a2b84254..456b8030 100644
--- a/src/main/java/com/iemr/common/identity/dto/BeneficiariesDTO.java
+++ b/src/main/java/com/iemr/common/identity/dto/BeneficiariesDTO.java
@@ -52,7 +52,6 @@ public class BeneficiariesDTO implements Comparable<BeneficiariesDTO> {
 	private String preferredEmailId; //
 	private BenDetailDTO beneficiaryDetails;
 	private List<BenFamilyDTO> beneficiaryFamilyTags;
-	// private List<BenFamilyDTO> benFamilyDTOs;
 	private List<BenIdentityDTO> beneficiaryIdentites;
 	private List<BenServiceDTO> beneficiaryServiceMap;
 	private List<Phone> contacts;
@@ -65,8 +64,6 @@ public int compareTo(BeneficiariesDTO ben) {
 		return this.benMapId.compareTo(ben.benMapId);
 	}
 
-	// Start Outreach
-	// New columns added for MMU integration 09-04-2018
 	private Timestamp marriageDate;
 	private Integer ageAtMarriage;
 	private String literacyStatus;
diff --git a/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java b/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
index 38b472a6..a87e7619 100644
--- a/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
+++ b/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
@@ -28,7 +28,6 @@
 import com.iemr.common.identity.domain.Address;
 import com.iemr.common.identity.domain.Contact;
 import com.iemr.common.identity.domain.Identity;
-// import com.iemr.common.identity.domain.Phone;
 
 import lombok.Data;
 
@@ -107,9 +106,6 @@ public class IdentityDTO {
 
 	// family tagging
 	List<BenFamilyDTO> benFamilyDTOs;
-	// private Boolean isEmergencyContact;
-	// private String relationshipToSelf;
-	// private BigInteger associatedBenRegId;
 
 	// identities
 	private List<Identity> identities;
@@ -120,9 +116,7 @@ public class IdentityDTO {
 	private String isHIVPositive;
 	// End 1097
 
-	/*
-	 * New columns added for MMU integration 11-04-2018
-	 */
+	
 	private String bankName;
 	private String branchName;
 	private String ifscCode;
@@ -135,12 +129,9 @@ public class IdentityDTO {
 	private String incomeStatus;
 	// End
 
-	// new column added for data sync
-	// 17-06-2018
 	@Expose
 	private Integer vanID;
 
-	// END OF new column added for data sync
 
 	@Expose
 	private Boolean beneficiaryConsent;
diff --git a/src/main/java/com/iemr/common/identity/dto/IdentityEditDTO.java b/src/main/java/com/iemr/common/identity/dto/IdentityEditDTO.java
index 23634fb8..5efb3c79 100644
--- a/src/main/java/com/iemr/common/identity/dto/IdentityEditDTO.java
+++ b/src/main/java/com/iemr/common/identity/dto/IdentityEditDTO.java
@@ -65,7 +65,6 @@ public class IdentityEditDTO {
 	private String gender;
 	private Integer titleId;
 	private String title;
-	// private Integer parkingPlaceId;
 	private String literacyStatus;
 
 	// self address
@@ -109,13 +108,6 @@ public class IdentityEditDTO {
 	// family details
 	private Boolean changeInFamilyDetails = false;
 	List<BenFamilyDTO> benFamilyDTOs;
-	// private Boolean isEmergencyContact;
-	// private String relationshipToSelf;
-	// private BigInteger associatedBenRegId; // Family mapping must be a list
-
-	// List<BenFamilyDTO> benFamilyDTOs;
-
-	// MMU/TM details
 	private Boolean changeInAssociations = false;
 
 	private Integer zoneId;
diff --git a/src/main/java/com/iemr/common/identity/exception/SearchCriteriaException.java b/src/main/java/com/iemr/common/identity/exception/SearchCriteriaException.java
index 8a67569d..6fee444f 100644
--- a/src/main/java/com/iemr/common/identity/exception/SearchCriteriaException.java
+++ b/src/main/java/com/iemr/common/identity/exception/SearchCriteriaException.java
@@ -23,6 +23,5 @@
 
 public class SearchCriteriaException {
 	
-	// SUNIL TODO: add the exception & propagate
 
 }
diff --git a/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java b/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java
index 64df182c..85e47c19 100644
--- a/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java
+++ b/src/main/java/com/iemr/common/identity/mapper/IdentityMapper.java
@@ -298,7 +298,6 @@ MBeneficiaryfamilymapping IdentityDTOToMBeneficiaryfamilymapping(BenFamilyDTO be
 			@Mapping(source = "dto.parkingPlaceId", target = "parkingPlaceID") })
 	MBeneficiaryservicemapping identityDTOToMBeneficiaryservicemapping(IdentityDTO dto);
 
-	// SUNIL TODO: Change to order of target & source to maintain consistency
 	@Mappings({ @Mapping(target = "benMapId", source = "benMapId"),
 			@Mapping(target = "benId", source = "map.MBeneficiaryregidmapping.beneficiaryID"),
 			@Mapping(target = "benRegId", source = "map.MBeneficiaryregidmapping.benRegId"),
@@ -579,26 +578,12 @@ List<BenFamilyDTO> mapToMBeneficiaryfamilymappingWithBenFamilyDTOList(
 
 	List<BenServiceDTO> mBeneficiaryservicemappingListToBenServiceDTOList(List<MBeneficiaryservicemapping> services);
 
-	// @Mapping(target = "MBeneficiaryservicemappings", expression =
-	// "java(Collections.singletonList(svcMapping))"),
-	// @Mapping(target = "MBeneficiaryfamilymappings", expression =
-	// "java(Collections.singletonList(familyMapping))")
-	// MBeneficiarymapping
-	// MBeneficiarymappingDTOToMBeneficiarymapping(MBeneficiarymappingDTOInbound
-	// dto);
-	// MBeneficiarymappingDTOInbound
-	// MBeneficiarymappingToMBeneficiarymappingDTO(MBeneficiarymapping map);
-
-	// Start outreach
-	// code specific for outreach
 	@Mappings({ @Mapping(source = "dto.bankName", target = "bankName"),
 			@Mapping(source = "dto.branchName", target = "branchName"),
 			@Mapping(source = "dto.ifscCode", target = "ifscCode"),
 			@Mapping(source = "dto.accountNo", target = "accountNo"),
 			@Mapping(source = "dto.agentName", target = "createdBy"),
 			@Mapping(source = "dto.eventTypeDate", target = "createdDate"),
-			// new mapping added for data sync(van ID & parking place ID)
-			// 17-09-2018
 			@Mapping(source = "dto.vanID", target = "vanID"),
 			@Mapping(source = "dto.parkingPlaceId", target = "parkingPlaceID"),
 			// End
diff --git a/src/main/java/com/iemr/common/identity/repo/BenContactRepo.java b/src/main/java/com/iemr/common/identity/repo/BenContactRepo.java
index 0f287916..b9ba6524 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenContactRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenContactRepo.java
@@ -48,10 +48,6 @@ public interface BenContactRepo extends CrudRepository<MBeneficiarycontact, BigI
 
 	List<MBeneficiarycontact> findByPreferredSMSPhoneNumOrderByBenContactsIDAsc(String SMSPhoneNum);
 
-//	@Query("select c from MBeneficiarycontact c where c.preferredPhoneNum = :phoneNum or phoneNum1 = :phoneNum "
-//			+ "or c.phoneNum2 = :phoneNum or c.phoneNum3 = :phoneNum or c.phoneNum4 = :phoneNum "
-//			+ "or c.phoneNum5 = :phoneNum order by c.benContactsID desc")
-//	List<MBeneficiarycontact> findByAnyPhoneNum(@Param("phoneNum") String phoneNum);
 	
 	@Query("select c from MBeneficiarycontact c where c.preferredPhoneNum = :phoneNum ")
 	List<MBeneficiarycontact> findByAnyPhoneNum(@Param("phoneNum") String phoneNum);
diff --git a/src/main/java/com/iemr/common/identity/repo/BenDataAccessRepo.java b/src/main/java/com/iemr/common/identity/repo/BenDataAccessRepo.java
index 22d6d0cc..24d20829 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenDataAccessRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenDataAccessRepo.java
@@ -40,21 +40,12 @@ public interface BenDataAccessRepo extends CrudRepository<TBendataaccess, BigInt
 	List<TBendataaccess> findByUserAgentIdAndAccessedOnBetweenOrderByAccessIdAsc(Integer userAgentId,
 			Timestamp fromDate, Timestamp toDate);
 
-	// commented as userAgentIpAddr is unknown column
-	// List<TBendataaccess> findByUserAgentIpAddr(String userAgentIpAddr);
-	// List<TBendataaccess> findByUserAgentIpAddrAndAccessedOnBetween(String userAgentIpAddr, Timestamp fromDate,
-	// Timestamp toDate);
-	// List<TBendataaccess> findByUserAgentIdAndUserAgentIpAddr(Integer userAgentId, String userAgentIpAddr);
-	// List<TBendataaccess> findByUserAgentIdAndUserAgentIpAddrAndAccessedOnBetween(Integer userAgentId, String
-	// userAgentIpAddr, Timestamp fromDate, Timestamp toDate);
 
 	List<TBendataaccess> findByUserAgentPSMapIdOrderByAccessIdAsc(Integer userAgentPSMapId);
 
 	List<TBendataaccess> findByUserAgentRoleIdOrderByAccessIdAsc(Integer userAgentRoleId);
 
 	List<TBendataaccess> findByUserAgentServiceIdOrderByAccessIdAsc(Integer userAgentServiceId);
-	// List<TBendataaccess> findByUserAgentStateId(Integer userAgentStateId);
-	// List<TBendataaccess> findByUserAgentServiceProviderId(Integer userAgentServiceProviderId);
 
 	List<TBendataaccess> findByUserAgentPSMapIdAndAccessedOnBetweenOrderByAccessIdAsc(Integer userAgentPSMapId,
 			Timestamp fromDate, Timestamp toDate);
@@ -64,15 +55,8 @@ List<TBendataaccess> findByUserAgentRoleIdAndAccessedOnBetweenOrderByAccessIdAsc
 
 	List<TBendataaccess> findByUserAgentServiceIdAndAccessedOnBetweenOrderByAccessIdAsc(Integer userAgentServiceId,
 			Timestamp fromDate, Timestamp toDate);
-	// List<TBendataaccess> findByUserAgentStateIdAndAccessedOnBetween(Integer userAgentStateId, Timestamp fromDate,
-	// Timestamp toDate);
-	// List<TBendataaccess> findByUserAgentServiceProviderIdAndAccessedOnBetween(Integer userAgentServiceProviderId,
-	// Timestamp fromDate, Timestamp toDate);
 
 	Long countByUserAgentIdAndAccessedOnBetweenOrderByAccessIdAsc(Integer userAgentId, Timestamp fromDate, Timestamp toDate);
-	// Long countByUserAgentIpAddrAndAccessedOnBetween(String userAgentIpAddr, Timestamp fromDate, Timestamp toDate);
-	// Long countByUserAgentIdAndUserAgentIpAddrAndAccessedOnBetween(Integer userAgentId, String userAgentIpAddr,
-	// Timestamp fromDate, Timestamp toDate);
 
 	Long countByUserAgentPSMapId(Integer userAgentPSMapId);
 
@@ -80,17 +64,12 @@ List<TBendataaccess> findByUserAgentServiceIdAndAccessedOnBetweenOrderByAccessId
 
 	Long countByUserAgentServiceId(Integer userAgentServiceId);
 
-	// Long countByUserAgentStateId(Integer userAgentStateId);
-	// Long countByUserAgentServiceProviderId(Integer userAgentServiceProviderId);
 	Long countByUserAgentPSMapIdAndAccessedOnBetween(Integer userAgentPSMapId, Timestamp fromDate, Timestamp toDate);
 
 	Long countByUserAgentRoleIdAndAccessedOnBetween(Integer userAgentRoleId, Timestamp fromDate, Timestamp toDate);
 
 	Long countByUserAgentServiceIdAndAccessedOnBetween(Integer userAgentServiceId, Timestamp fromDate,
 			Timestamp toDate);
-	// Long countByUserAgentStateIdAndAccessedOnBetween(Integer userAgentStateId, Timestamp fromDate, Timestamp toDate);
-	// Long countByUserAgentServiceProviderIdAndAccessedOnBetween(Integer userAgentServiceProviderId, Timestamp
-	// fromDate, Timestamp toDate);
 
 	List<TBendataaccess> findByaccessedOnBetweenOrderByAccessIdAsc(Timestamp fromDate, Timestamp toDate);
 }
diff --git a/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java b/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java
index 8668bce0..af2998cd 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenDetailRepo.java
@@ -42,18 +42,12 @@ public interface BenDetailRepo extends CrudRepository<MBeneficiarydetail, BigInt
 	List<MBeneficiarydetail> findByCreatedDateBetweenOrderByBeneficiaryDetailsIdAsc(Timestamp fromDate,
 			Timestamp toDate);
 
-	// List<MBeneficiarydetail> findByMBeneficiaryregid(MBeneficiaryregidmapping
-	// MBeneficiaryregid);
 	List<MBeneficiarydetail> findByFirstNameAndLastNameOrderByBeneficiaryDetailsIdAsc(String fName, String mName);
 
-	// searching with criterias
 
 	@Query("select d from MBeneficiarydetail d " + "where d.mBeneficiarymapping.benRegId = :benRegId")
 	MBeneficiarydetail findByBenRegId(BigInteger benRegId);
 
-	// @Query("select d from MBeneficiarydetail d "
-	// + "where d.mBeneficiarymapping.beneficiaryID = :beneficiaryID")
-	// MBeneficiarydetail findByBeneficiaryID(BigInteger beneficiaryID);
 
 	@Query("select d from MBeneficiarydetail d where d.firstName = :fName and d.middleName = :mName and "
 			+ "d.lastName = :lName Order By d.beneficiaryDetailsId Asc")
@@ -84,17 +78,12 @@ List<MBeneficiarydetail> findByNameAndSpouseNameAndDob(String fName, String mNam
 	@Query("select new MBeneficiarydetail(d.beneficiaryDetailsId, d.firstName, d.lastName, d.middleName, "
 			+ "d.fatherName, d.spouseName) "
 			+ "from MBeneficiarydetail d where d.mBeneficiarymapping.benRegId = :benRegId")
-	// + "in (select beneficiaryDetailsId from MBeneficiarymapping where benRegId =
-	// :benRegId)")
 	MBeneficiarydetail findPartialBeneficiaryDetailByBenRegId(@Param("benRegId") BigInteger benRegId);
 
 	@Query("select new MBeneficiarydetail(d.beneficiaryDetailsId, d.firstName, d.lastName, d.middleName, "
 			+ "d.fatherName, d.spouseName) "
 			+ "from MBeneficiarydetail d where d.mBeneficiarymapping.benRegId in :benRegIds")
 	List<MBeneficiarydetail> findPartialBeneficiaryDetailByBenRegId(@Param("benRegIds") List<BigInteger> benRegId);
-	// @Query("select d from MBeneficiarydetail d where d.MBeneficiaryregid.benRegId
-	// = :benRegid")
-	// List<MBeneficiarydetail> findByBeneficiaryRegid(BigInteger benRegid);
 
 	@Transactional
 	@Modifying
diff --git a/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java b/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
index c77a1b19..f8ae764c 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
@@ -72,19 +72,10 @@ public List<MBeneficiarydetail> advanceFilterSearch(IdentitySearchDTO searchDTO)
 		/**
 		 * Beneficiary ID is present, no need for other criteria
 		 */
-		// if(filterDTO.getBeneficiaryId().isPresent()) {
-		// //filterDTO.getBeneficiaryId().get();
-		// MBeneficiaryregidmapping regId = regIdRepo.findByBeneficiaryID(filterDTO.getBeneficiaryId().get());
-		// predicates.add(criteriaBuilder.equal(root.get("beneficiaryRegID"), regId.getBenRegId()));
-		// }
 
 		/**
 		 * Beneficiary Reg ID is present, no need for other criteria
 		 */
-		// if(filterDTO.getBeneficiaryRegId().isPresent()) {
-		// //filterDTO.getBeneficiaryRegId().get();
-		// predicates.add(criteriaBuilder.equal(root.get("beneficiaryRegID"), filterDTO.getBeneficiaryRegId().get()));
-		// }
 
 		/**
 		 * First Name is present, additional criteria needed
@@ -173,9 +164,6 @@ public List<MBeneficiarydetail> advanceFilterSearch(IdentitySearchDTO searchDTO)
 		/**
 		 * Contact Number is present, additional criteria needed
 		 */
-		// if(filterDTO.getContactNumber().isPresent()){
-		// predicates.add(criteriaBuilder.equal(root.get("contactNumber"), filterDTO.getPinCode().get()));
-		// }
 
 		criteriaQuery.select(root).where(predicates.toArray(new Predicate[] {}))
 				.orderBy(criteriaBuilder.asc(root.get("benMapId")));
diff --git a/src/main/java/com/iemr/common/identity/repo/BenFamilyMappingRepo.java b/src/main/java/com/iemr/common/identity/repo/BenFamilyMappingRepo.java
index 05b49af4..f4f55096 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenFamilyMappingRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenFamilyMappingRepo.java
@@ -27,7 +27,6 @@
 
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
-// import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
@@ -39,18 +38,9 @@
 public interface BenFamilyMappingRepo extends CrudRepository<MBeneficiaryfamilymapping, BigInteger> {
 	List<MBeneficiaryfamilymapping> findByBenFamilyMapIdOrderByBenFamilyMapIdAsc(BigInteger benFamilyMapId);
 
-	// List<MBeneficiaryfamilymapping> findByAssociatedBenRegID(BigInteger
-	// associatedBenRegID);
-	// List<MBeneficiaryfamilymapping>
-	// findByAssociatedBenRegIDAndIsEmergencyContact(BigInteger associatedBenRegID,
-	// Boolean isEmergencyContact);
 	List<MBeneficiaryfamilymapping> findByCreatedDateBetweenOrderByBenFamilyMapIdAsc(Timestamp fromDate,
 			Timestamp toDate);
 
-	// @Query("select f from MBeneficiaryfamilymapping f where
-	// f.MBeneficiaryregid.benRegId = :associatedBenID")
-	// List<MBeneficiaryfamilymapping> findByAssociatedBenID(BigInteger
-	// associatedBenID);
 
 	List<MBeneficiaryfamilymapping> findByBenMapIdOrderByBenFamilyMapIdAsc(BigInteger benMapId);
 
diff --git a/src/main/java/com/iemr/common/identity/repo/BenMappingRepo.java b/src/main/java/com/iemr/common/identity/repo/BenMappingRepo.java
index 4d3ae32f..ceaca5de 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenMappingRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenMappingRepo.java
@@ -26,20 +26,14 @@
 
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
-// import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.CrudRepository;
 import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.iemr.common.identity.domain.MBeneficiaryaddress;
-// import com.iemr.common.identity.domain.MBeneficiaryaddress;
-// import com.iemr.common.identity.domain.MBeneficiaryconsent;
 import com.iemr.common.identity.domain.MBeneficiarycontact;
 import com.iemr.common.identity.domain.MBeneficiarydetail;
-// import com.iemr.common.identity.domain.MBeneficiarydetail;
-// import com.iemr.common.identity.domain.MBeneficiaryfamilymapping;
-// import com.iemr.common.identity.domain.MBeneficiaryidentity;
 import com.iemr.common.identity.domain.MBeneficiarymapping;
 import com.iemr.common.identity.domain.MBeneficiaryregidmapping;
 
@@ -54,17 +48,6 @@ public interface BenMappingRepo extends CrudRepository<MBeneficiarymapping, BigI
 	List<MBeneficiarymapping> findByMBeneficiaryregidmappingOrderByBenMapIdAsc(
 			MBeneficiaryregidmapping MBeneficiaryregidmapping);
 
-	// @Query("select m from MBeneficiarymapping m where
-	// m.mBeneficiarycontact.benContactsID = :benContactsID")
-	// MBeneficiarymapping findByBenContactsID(@Param("benContactsID")
-	// BigInteger benContactsID);
-	// List<MBeneficiarymapping>
-	// findByMBeneficiaryregidmapping(MBeneficiaryregidmapping
-	// MBeneficiaryregidmapping);
-	// MBeneficiarymapping findByMBeneficiaryaddress(MBeneficiaryaddress
-	// MBeneficiaryaddress);
-	// List<MBeneficiarymapping> findByMBeneficiarycontact(MBeneficiarycontact
-	// MBeneficiarycontact);
 
 	List<MBeneficiarymapping> findByMBeneficiarydetailOrderByBenMapIdAsc(MBeneficiarydetail mBeneficiarydetail);
 
@@ -91,65 +74,6 @@ List<MBeneficiarymapping> findByMBeneficiarydetailAndMBeneficiaryaddressAndMBene
 	@Query("select t from MBeneficiarymapping t where t.benRegId = :benRegID")
 	MBeneficiarymapping getBenImageIdByBenRegID(@Param("benRegID") BigInteger benRegID);
 
-	// List<MBeneficiarymapping> findByMBeneficiaryconsent(MBeneficiaryconsent
-	// MBeneficiaryconsent);
-
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryRegIdMapping.benRegId = :benRegId")
-	// List<MBeneficiarymapping> findByBeneficiaryRegId(BigInteger benRegId);
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryaddress.benAddressID = :benAddressID")
-	// List<MBeneficiarymapping> findByBeneficiaryAddressId(BigInteger
-	// benAddressID);
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiarycontact.benContactsID = :benContactsID")
-	// List<MBeneficiarymapping> findByBeneficiaryContactId(BigInteger
-	// benContactsID);
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryconsent.benConsentID = :benConsentID")
-	// List<MBeneficiarymapping> findByBeneficiaryConsentId(BigInteger
-	// benConsentID);
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiarydetail.beneficiaryDetailsId =
-	// :beneficiaryDetailsId")
-	// List<MBeneficiarymapping> findByBeneficiaryDetailId(BigInteger
-	// beneficiaryDetailsId);
-	//
-	//
-	// @Query("select m from MBeneficiarymapping m where m.deleted = b'1'")
-	// List<MBeneficiarymapping> findByDeleted();
-	//
-	// @Query("select m from MBeneficiarymapping m where m.reserved = b'1'")
-	// List<MBeneficiarymapping> findByReserved();
-	//
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryregidmapping.beneficiaryID = :BeneficiaryID")
-	// List<MBeneficiarymapping> findByBeneficiaryId(BigInteger BeneficiaryID);
-	//
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryidentities.MBeneficiaryidentity =
-	// :MBeneficiaryidentity")
-	// List<MBeneficiarymapping> findByMBeneficiaryidentity(MBeneficiaryidentity
-	// MBeneficiaryidentity);
-	//
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryfamilymappings.MBeneficiaryfamilymapping =
-	// :MBeneficiaryfamilymapping")
-	// List<MBeneficiarymapping>
-	// findByMBeneficiaryfamilymapping(MBeneficiaryfamilymapping
-	// MBeneficiaryfamilymapping);
-	//
-	// @Query("select m from MBeneficiarymapping m where
-	// m.MBeneficiaryfamilymappings.MBeneficiaryservicemapping =
-	// :MBeneficiaryservicemapping")
-	// List<MBeneficiarymapping>
-	// findByMBeneficiaryservicemapping(MBeneficiaryservicemapping
-	// MBeneficiaryservicemapping);
-	//
-	// @Query("select m from MBeneficiarymapping m where
-	// m.TBendataaccesses.tBendataaccess = :tBendataaccess")
-	// List<MBeneficiarymapping> findByTBendataaccess(TBendataaccess
-	// tBendataaccess);
 
 	@Transactional
 	@Modifying
@@ -162,14 +86,12 @@ List<MBeneficiarymapping> findByMBeneficiarydetailAndMBeneficiaryaddressAndMBene
 			+ " WHERE t.benRegId = :benRegID ORDER BY t.benMapId Desc ")
 	public List<Object[]> getBenMappingByRegID(@Param("benRegID") BigInteger benRegID);
 
-	// old code 1.0
 	@Query("SELECT t.benMapId, t.benAddressId, t.benConsentId, t.benContactsId, t.benDetailsId, "
 			+ " t.benRegId, t.benImageId, t.benAccountID, t.vanID, t.vanSerialNo, "
 			+ " t.createdBy, t.createdDate FROM MBeneficiarymapping t "
 			+ "  WHERE t.benContactsId IN :contactIDList  ORDER BY t.benMapId Desc ")
 	public List<Object[]> getBenMappingByBenContactIdList(@Param("contactIDList") List<BigInteger> contactIDList);
 
-	// new code 1.0
 	@Query("SELECT t.benMapId, t.benAddressId, t.benConsentId, t.benContactsId, t.benDetailsId, "
 			+ " t.benRegId, t.benImageId, t.benAccountID, t.vanID, t.vanSerialNo, "
 			+ " t.createdBy, t.createdDate FROM MBeneficiarymapping t "
@@ -177,7 +99,6 @@ List<MBeneficiarymapping> findByMBeneficiarydetailAndMBeneficiaryaddressAndMBene
 	public List<Object[]> getBenMappingByBenContactIdListNew(@Param("benContactId") BigInteger benContactId,
 			@Param("vanID") Integer vanID);
 
-	// 19-12-2018, neeraj
 	@Query("SELECT t.benMapId, t.benAddressId, t.benConsentId, t.benContactsId, t.benDetailsId, "
 			+ " t.benRegId, t.benImageId, t.benAccountID, t.vanID, t.vanSerialNo, "
 			+ " t.createdBy, t.createdDate FROM MBeneficiarymapping t "
@@ -190,7 +111,6 @@ public List<Object[]> getBenMappingByBenContactIdListNew(@Param("benContactId")
 	@Query("SELECT t.benRegId FROM MBeneficiarymapping t WHERE t.benDetailsId =:benDetailsId AND vanID = :vanID")
 	public BigInteger getBenRegId(@Param("benDetailsId") BigInteger benDetailsId, @Param("vanID") Integer vanID);
 
-	// 12-09-2022
 	@Query("SELECT t.benMapId, t.benAddressId, t.benConsentId, t.benContactsId, t.benDetailsId, "
 			+ " t.benRegId, t.benImageId, t.benAccountID, t.vanID, t.vanSerialNo, "
 			+ " t.createdBy, t.createdDate FROM MBeneficiarymapping t "
@@ -198,7 +118,6 @@ public List<Object[]> getBenMappingByBenContactIdListNew(@Param("benContactId")
 	public List<Object[]> getBenMappingByBenDetailsIds(@Param("benDetailsIds") List<BigInteger> benDetailsIds,
 			@Param("vanID") Integer vanID);
 
-	// 12-09-2022
 	@Query("SELECT t.benMapId, t.benAddressId, t.benConsentId, t.benContactsId, t.benDetailsId, "
 			+ " t.benRegId, t.benImageId, t.benAccountID, t.vanID, t.vanSerialNo, "
 			+ " t.createdBy, t.createdDate FROM MBeneficiarymapping t "
diff --git a/src/main/java/com/iemr/common/identity/repo/BenMappingRepoImpl.java b/src/main/java/com/iemr/common/identity/repo/BenMappingRepoImpl.java
index 04a2bc36..ce01b507 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenMappingRepoImpl.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenMappingRepoImpl.java
@@ -339,8 +339,6 @@ public List<MBeneficiarymapping> finiteSearch(IdentityDTO identityDTO) {
 
 			predicates.add(criteriaBuilder.equal(benContact.get("preferredPhoneNum"),
 					identityDTO.getContact().getPreferredPhoneNum()));
-			// predicates.add(criteriaBuilder.or(benContact.get("phoneNum1"),
-			// identityDTO.getContact().getPreferredPhoneNum()));
 		}
 
 		criteriaQuery.select(root).where(predicates.toArray(new Predicate[] {}));
diff --git a/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java b/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java
index 55683eb4..830b0f41 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenRegIdMappingRepo.java
@@ -41,8 +41,6 @@ public interface BenRegIdMappingRepo extends CrudRepository<MBeneficiaryregidmap
 
 	MBeneficiaryregidmapping findByBeneficiaryID(BigInteger beneficiaryID);
 
-	// List<MBeneficiaryregidmapping> findByMBeneficiarydetail(MBeneficiarydetail
-	// MBeneficiarydetail);
 	List<MBeneficiaryregidmapping> findByCreatedDateBetweenOrderByBenRegIdAsc(Timestamp fromDate, Timestamp toDate);
 
 	MBeneficiaryregidmapping findFirstByProvisionedAndReserved(Boolean isProvisioned, Boolean isReserved);
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..5c96ca03 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]));
 
@@ -606,12 +599,9 @@ private MBeneficiarymapping getBeneficiariesDTONewPartial(Object[] benMapArr) {
 		return benMapOBJ;
 	}
 
-	// 03-10-2018
-	// get ben mapping object from v_benadvancesearch
 	private MBeneficiarymapping getBeneficiariesDTONew1(V_BenAdvanceSearch benAdvanceSearchOBJ) {
 		MBeneficiarymapping benMapOBJ = new MBeneficiarymapping();
 
-		// for createdBy & createdDate
 		if (benAdvanceSearchOBJ != null) {
 			MBeneficiarydetail benDetailsOBJ = detailRepo
 					.getWith_vanSerialNo_vanID(benAdvanceSearchOBJ.getBenDetailsID(), benAdvanceSearchOBJ.getVanID());
@@ -688,11 +678,9 @@ 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
 		logger.debug("identity.getChangeInSelfDetails = " + identity.getChangeInSelfDetails());
 		logger.debug("identity.getChangeInOtherDetails = " + identity.getChangeInOtherDetails());
 		logger.debug("identity.getChangeInAssociations = " + identity.getChangeInAssociations());
@@ -700,19 +688,12 @@ 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());
-			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benDetails != null) {
 				mbDetl.setBeneficiaryDetailsId(benDetails.getBeneficiaryDetailsId());
 				if (benDetails.getFamilyId() != null)
@@ -730,13 +711,10 @@ 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);
 		}
 
-		// edition in current emergency and permanent is implement below
 		logger.debug("identity.getChangeInAddress = " + identity.getChangeInAddress());
 		if (Boolean.TRUE.equals(identity.getChangeInAddress())) {
 
@@ -745,13 +723,8 @@ 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(
 					benMapping.getMBeneficiaryaddress().getBenAddressID(), benMapping.getVanID());
-			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benAddressID != null)
 				mbAddr.setBenAddressID(benAddressID);
 			else
@@ -761,13 +734,10 @@ 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);
 		}
 
-		// edition in beneficiary contacts is updated here
 		logger.debug("identity.getChangeInContacts = " + identity.getChangeInContacts());
 		if (Boolean.TRUE.equals(identity.getChangeInContacts())) {
 
@@ -776,13 +746,8 @@ 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(
 					benMapping.getMBeneficiarycontact().getBenContactsID(), benMapping.getVanID());
-			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benContactsID != null)
 				benCon.setBenContactsID(benContactsID);
 			else
@@ -793,11 +758,9 @@ 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);
 		}
 
-		// change in identities are added here
 		logger.debug("identity.getChangeInIdentities = " + identity.getChangeInIdentities());
 		if (Boolean.TRUE.equals(identity.getChangeInIdentities())) {
 
@@ -806,11 +769,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());
 
 			logger.debug("existing identies = " + OutputMapper.gson().toJson(idList));
@@ -819,58 +777,33 @@ 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
 				if (index >= idList.size() && beneficiaryidentity.getBenIdentityId() == null) {
 					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);
 
-				// new code, update van serial no for new entry, 26-09-2018
 				if (index >= idList.size() && beneficiaryidentity.getBenIdentityId() == null) {
 					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())) {
 			List<MBeneficiaryfamilymapping> fbMaps = editMapper
@@ -878,11 +811,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,10 +821,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());
 
 				logger.debug("family mapping to update = " + OutputMapper.gson().toJson(familymapping));
@@ -909,13 +833,8 @@ 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);
 
-				// new code, update van serial no for new entry, 26-09-2018
 				if (familymapping.getBenFamilyMapId() == null) {
 					int i8 = familyMapRepo.updateVanSerialNo(m.getBenFamilyMapId());
 				}
@@ -924,18 +843,14 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			}
 		}
 
-		// start
-		// Feature used in outreach
 		if (Boolean.TRUE.equals(identity.getChangeInBankDetails())) {
 			MBeneficiaryAccount beneficiaryAccount = editMapper.identityEditDTOToMBeneficiaryAccount(identity);
 
 			/**
 			 * new logic for data sync, 26-09-2018
 			 */
-			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			BigInteger benAccountID = accountRepo.findIdByVanSerialNoAndVanID(
 					benMapping.getMBeneficiaryAccount().getBenAccountID(), benMapping.getVanID());
-			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benAccountID != null)
 				beneficiaryAccount.setBenAccountID(benAccountID);
 			else
@@ -955,10 +870,8 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			/**
 			 * new logic for data sync, 26-09-2018
 			 */
-			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			Long benImageId = imageRepo.findIdByVanSerialNoAndVanID(benMapping.getMBeneficiaryImage().getBenImageId(),
 					benMapping.getVanID());
-			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benImageId != null)
 				beneficiaryImage.setBenImageId(benImageId);
 			else
@@ -972,17 +885,8 @@ 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 +894,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 +919,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());
@@ -1065,80 +948,36 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		mAddr = addressRepo.save(mAddr);
 		logger.info("IdentityService.createIdentity - Address saved - id = " + mAddr.getBenAddressID());
 
-		// 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);
 		logger.info("IdentityService.createIdentity - Consent saved - id = " + mConsnt.getBenConsentID());
 
-		// 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);
 		logger.info("IdentityService.createIdentity - Contacts saved - id = " + mContc.getBenContactsID());
-
-		// 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);
 		logger.info("IdentityService.createIdentity - Details saved - id = " + mDetl.getBeneficiaryDetailsId());
-
-		// 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);
@@ -1148,50 +987,22 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		benMapping.setMBeneficiaryAccount(bankOBJ);
 
 		regMap.setProviderServiceMapID(identity.getProviderServiceMapId());
-		// added columns for data sync
-		// 17-09-2018
 		if (identity.getVanID() != null)
 			regMap.setVanID(identity.getVanID());
 		if (identity.getParkingPlaceId() != null)
 			regMap.setParkingPlaceID(identity.getParkingPlaceId());
 		regMap.setVanSerialNo(regMap.getBenRegId());
-		// 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>();
 
-		// new logic (18-09-2018, Neeraj kumar)
 		if (null != identity.getBenFamilyDTOs()) {
 			fIdenList = mapper.IdentityDTOListToMBeneficiaryfamilymappingList(identity.getBenFamilyDTOs());
 			if (fIdenList != null) {
@@ -1209,7 +1020,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 					}
 				}
 				fList = (List<MBeneficiaryfamilymapping>) familyMapRepo.save(fIdenList);
-				// Update van serial no for data sync
 				if (fList != null && fList.size() > 0) {
 					for (MBeneficiaryfamilymapping obj : fList) {
 						int i7 = familyMapRepo.updateVanSerialNo(obj.getBenFamilyMapId());
@@ -1222,17 +1032,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 			 * 
 			 */
 
-			// 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
 			 * 
@@ -1240,29 +1039,16 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		}
 
 		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());
 
-		// Update van serial no for data sync
 		int i7 = serviceMapRepo.updateVanSerialNo(sMap.getBenServiceMapID());
 
 		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()) {
@@ -1273,7 +1059,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 				mIden.setCreatedBy(identity.getAgentName());
 				mIden.setCreatedDate(identity.getEventTypeDate());
 
-				// set new column(vanID, parkingPlaceID) value for data sync
 				if (identity.getVanID() != null)
 					mIden.setVanID(identity.getVanID());
 				if (identity.getParkingPlaceId() != null)
@@ -1281,7 +1066,6 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 
 				MBeneficiaryidentity m = identityRepo.save(mIden);
 
-				// Update van serial no for data sync
 				int i8 = identityRepo.updateVanSerialNo(m.getBenIdentityId());
 
 				mIdenList2.add(m);
@@ -1289,14 +1073,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,61 +1124,17 @@ 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<>();
 		if (BenRegIds != null && BenRegIds.size() > 0) {
 			benMapObjArr = mappingRepo.getBenMappingByRegIDList(BenRegIds);
 			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,77 +1155,16 @@ 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<>();
 		if (BenRegIds != null && BenRegIds.size() > 0) {
 			benMapObjArr = mappingRepo.getBenMappingByRegIDList(BenRegIds);
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				for (Object[] objArr : benMapObjArr) {
 					MBeneficiarymapping benMap = this.getBeneficiariesDTONew(objArr);
-//					logger.info("benMap " + benMap);
 
 					list.add(this.getBeneficiariesDTO(benMap));
 				}
@@ -1501,7 +1172,6 @@ public List<BeneficiariesDTO> getBeneficiariesDeatilsByBenRegIdList(List<BigInte
 			logger.info("benMap size" + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
 
 		}
-		// end
 
 		logger.info("IdetityService.getBeneficiariesPartialDeatilsByBenRegId - end");
 
@@ -1523,7 +1193,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 +1214,6 @@ private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 			}
 			bdto.setAbhaDetails(abhaDTOList);
 		}
-		// System.out.println("ABHA end....");
 		return bdto;
 	}
 
@@ -1559,30 +1227,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 +1244,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());
@@ -1637,28 +1284,6 @@ public void editIdentityEducationOrCommunity(IdentityEditDTO identity) throws Mi
 			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) {
 			if (identity.getCommunityId() != null) {
@@ -1695,15 +1320,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;

From f3c6d468520327595f847f3a854d2be45180222a Mon Sep 17 00:00:00 2001
From: swetatech24 <sweta.prakash@wipro.com>
Date: Thu, 15 Jun 2023 17:37:38 +0530
Subject: [PATCH 2/4] code smell fixes

---
 .../identity/domain/MBeneficiarydetail.java   |  10 -
 .../iemr/common/identity/dto/IdentityDTO.java |   9 -
 .../identity/dto/IdentitySearchDTO.java       |   1 -
 .../identity/repo/BenDetailRepoImpl.java      |  66 ++----
 .../identity/service/IdentityService.java     | 202 +++---------------
 src/main/resources/application.properties     |   8 +
 6 files changed, 47 insertions(+), 249 deletions(-)

diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
index 91922bdb..4c3f46e8 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
@@ -41,10 +41,6 @@
 
 import lombok.Data;
 
-/**
- * The persistent class for the m_beneficiarydetails database table.
- * 
- */
 @Entity
 @Table(name = "i_beneficiarydetails")
 @NamedQuery(name = "MBeneficiarydetail.findAll", query = "SELECT m FROM MBeneficiarydetail m order by beneficiaryDetailsId asc")
@@ -236,16 +232,10 @@ public class MBeneficiarydetail implements Serializable {
 	@Column(name = "VanSerialNo", updatable = false)
 	private BigInteger vanSerialNo;
 
-	/**
-	 * Default constructor
-	 */
 	public MBeneficiarydetail() {
 
 	}
 
-	/**
-	 * Constructor for retrieving partial beneficiary details
-	 */
 	public MBeneficiarydetail(BigInteger beneficiaryDetailsId, String firstName, String lastName, String middleName,
 			String fatherName, String spouseName) {
 
diff --git a/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java b/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
index a87e7619..590bbfa3 100644
--- a/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
+++ b/src/main/java/com/iemr/common/identity/dto/IdentityDTO.java
@@ -35,7 +35,6 @@
 public class IdentityDTO {
 
 	private String eventTypeName; // created, reserved, registered, modified,
-									// deleted
 	private Timestamp eventTypeDate;
 	private Integer agentId;
 	private String agentName;
@@ -49,7 +48,6 @@ public class IdentityDTO {
 	private String stateName;
 	private Integer providerServiceMapId;
 
-	// details
 	private Integer areaId;
 	private Integer beneficiaryId;
 	private Integer beneficiaryRegId;
@@ -90,7 +88,6 @@ public class IdentityDTO {
 	private String title;
 	private Integer zoneId;
 
-	// address
 	private Address currentAddress;
 	private Address permanentAddress;
 	private Address emergencyAddress;
@@ -100,21 +97,16 @@ public class IdentityDTO {
 	private Boolean isEmerAddrSameAsPermAddr;
 	private String addressType;
 
-	// contacts
 	private String preferredEmailId;
 	private Contact contact;
 
-	// family tagging
 	List<BenFamilyDTO> benFamilyDTOs;
 
-	// identities
 	private List<Identity> identities;
 
-	// Start 1097
 	private Integer sexualOrientationID;
 	private String sexualOrientationType;
 	private String isHIVPositive;
-	// End 1097
 
 	
 	private String bankName;
@@ -127,7 +119,6 @@ public class IdentityDTO {
 	private Integer ageAtMarriage;
 	private Integer incomeStatusId;
 	private String incomeStatus;
-	// End
 
 	@Expose
 	private Integer vanID;
diff --git a/src/main/java/com/iemr/common/identity/dto/IdentitySearchDTO.java b/src/main/java/com/iemr/common/identity/dto/IdentitySearchDTO.java
index 6506897a..db4bf011 100644
--- a/src/main/java/com/iemr/common/identity/dto/IdentitySearchDTO.java
+++ b/src/main/java/com/iemr/common/identity/dto/IdentitySearchDTO.java
@@ -56,7 +56,6 @@ public class IdentitySearchDTO {
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Timestamp dob;
 
-	// new column added for D2D, 21-01-2021
 	private Long houseHoldID;
 	private Boolean isD2D;
 
diff --git a/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java b/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
index f8ae764c..d1784c4c 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
@@ -45,18 +45,7 @@ public class BenDetailRepoImpl implements BenDetailRepoCustom
 	@Autowired
 	BenRegIdMappingRepo regIdRepo;
 
-	/**
-	 * Search Criteria: the following are necessary to conduct a finite search
-	 * 
-	 * 1. beneficiary ID 2. beneficiary Reg ID 3. Contact Number 4. Name (First, Middle, Last), Age, Gender 5. Village
-	 * Name 6. District State Zone Coordinates 7. Pin Code 8. Father Name 9. Spouse Name
-	 * 
-	 * Allowed Single Parameters: - beneficiary Id - beneficiary Reg Id - Contact Number
-	 * 
-	 * Allowed Multi-Parameters: - Name (First, Middle, Last), Age, Gender - Contact Number & Name (First, Middle, Last)
-	 * - Pin Code & Name (First, Middle, Last) - Village, Father Name & Name (First, Middle, Last) - Village, Spouse
-	 * Name & Name (First, Middle, Last) - Village, District, State - Govt identities(keys, values)
-	 */
+	
 
 	@Override
 	public List<MBeneficiarydetail> advanceFilterSearch(IdentitySearchDTO searchDTO)
@@ -66,104 +55,73 @@ public List<MBeneficiarydetail> advanceFilterSearch(IdentitySearchDTO searchDTO)
 		CriteriaQuery<MBeneficiarydetail> criteriaQuery = criteriaBuilder.createQuery(MBeneficiarydetail.class);
 		Root<MBeneficiarydetail> root = criteriaQuery.from(MBeneficiarydetail.class);
 
-		// add predicates to see more parameters
 		List<Predicate> predicates = new ArrayList<Predicate>();
 
-		/**
-		 * Beneficiary ID is present, no need for other criteria
-		 */
-
-		/**
-		 * Beneficiary Reg ID is present, no need for other criteria
-		 */
-
-		/**
-		 * First Name is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getFirstName() != null)
 		{
 
 			predicates.add(criteriaBuilder.like(root.<String> get("firstName"), "%" + searchDTO.getFirstName() + "%"));
 		}
 
-		/**
-		 * Middle Name is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getMiddleName() != null)
 		{
 			predicates
 					.add(criteriaBuilder.like(root.<String> get("middleName"), "%" + searchDTO.getMiddleName() + "%"));
 		}
 
-		/**
-		 * Last Name is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getLastName() != null)
 		{
 			predicates.add(criteriaBuilder.like(root.<String> get("lastName"), "%" + searchDTO.getLastName() + "%"));
 		}
 
-		/**
-		 * Age Id is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getAgeId() != null)
 		{
 			predicates.add(criteriaBuilder.equal(root.get("ageId"), searchDTO.getAgeId()));
 		}
 
-		/**
-		 * Age is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getAge() != null)
 		{
 			predicates.add(criteriaBuilder.equal(root.get("age"), searchDTO.getAge()));
 		}
 
-		/**
-		 * Gender Id is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getGenderId() != null)
 		{
 			predicates.add(criteriaBuilder.equal(root.get("genderId"), searchDTO.getGenderId()));
 		}
 
-		/**
-		 * Gender Name is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getGenderName() != null)
 		{
 			predicates.add(criteriaBuilder.equal(root.get("genderName"), searchDTO.getGenderName()));
 		}
 
-		/**
-		 * Spouse Name is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getSpouseName() != null)
 		{
 			predicates
 					.add(criteriaBuilder.like(root.<String> get("spouseName"), "%" + searchDTO.getSpouseName() + "%"));
 		}
 
-		/**
-		 * Father Name present, additional criteria needed
-		 */
+		
 		if (searchDTO.getFatherName() != null)
 		{
 			predicates
 					.add(criteriaBuilder.like(root.<String> get("fatherName"), "%" + searchDTO.getFatherName() + "%"));
 		}
 
-		/**
-		 * Pin Code is present, additional criteria needed
-		 */
+		
 		if (searchDTO.getPinCode() != null)
 		{
 			predicates.add(criteriaBuilder.equal(root.get("pinCode"), searchDTO.getPinCode()));
 		}
 
-		/**
-		 * Contact Number is present, additional criteria needed
-		 */
+		
 
 		criteriaQuery.select(root).where(predicates.toArray(new Predicate[] {}))
 				.orderBy(criteriaBuilder.asc(root.get("benMapId")));
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 5c96ca03..54a018ee 100644
--- a/src/main/java/com/iemr/common/identity/service/IdentityService.java
+++ b/src/main/java/com/iemr/common/identity/service/IdentityService.java
@@ -168,36 +168,24 @@ public void getBenAdress() {
 		logger.debug("Mapping By Id: " + mappingRepo.findByBenMapIdOrderByBenMapIdAsc(new BigInteger("12")));
 	}
 
-	/**
-	 * 
-	 * @param searchDTO
-	 * @return
-	 */
 	public List<BeneficiariesDTO> getBeneficiaries(IdentitySearchDTO searchDTO)
 			throws NoResultException, QueryTimeoutException, Exception {
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 
-		/**
-		 * if beneficiary Id present
-		 */
+		
 		if (searchDTO.getBeneficiaryId() != null) {
 			logger.info("getting beneficiaries by ID for " + searchDTO.getBeneficiaryId());
 			List<BeneficiariesDTO> list1 = this.getBeneficiariesByBenId(searchDTO.getBeneficiaryId());
 			return list1;
 		}
 
-		/**
-		 * if beneficiary Reg Id present
-		 */
 		if (searchDTO.getBeneficiaryRegId() != null) {
 			logger.info("getting beneficiaries by reg ID for " + searchDTO.getBeneficiaryRegId());
 			List<BeneficiariesDTO> list2 = this.getBeneficiariesByBenRegId(searchDTO.getBeneficiaryRegId());
 			return list2;
 		}
 
-		/**
-		 * if beneficiary Reg Id present
-		 */
+		
 		if (searchDTO.getContactNumber() != null) {
 			logger.info("getting beneficiaries by contact no for " + searchDTO.getContactNumber());
 			List<BeneficiariesDTO> list3 = this.getBeneficiariesByPhoneNum(searchDTO.getContactNumber());
@@ -290,29 +278,18 @@ public List<BeneficiariesDTO> getBeneficiaries(IdentitySearchDTO searchDTO)
 			return list3;
 		}
 
-		/**
-		 * New logic for advance search, 03-10-2018
-		 */
+		
 		List<V_BenAdvanceSearch> tmpList = mappingRepo.dynamicFilterSearchNew(searchDTO);
 		for (V_BenAdvanceSearch obj : tmpList) {
 			list.add(this.getBeneficiariesDTO(this.getBeneficiariesDTONew1(obj)));
 			logger.debug("benMapId: " + obj.getBenMapID());
 		}
-		/**
-		 * End
-		 */
+		
 
 		return list;
 	}
 
-	/**
-	 * 
-	 * Check which parameters available Get BenMapID based on the parameter/set of
-	 * parameters Use BenMapID to retrieve all data for a Beneficiary
-	 * 
-	 * @param benId
-	 * @return
-	 */
+	
 	public List<BeneficiariesDTO> getBeneficiariesByBenId(BigInteger benId)
 			throws NoResultException, QueryTimeoutException, Exception {
 		logger.info("IdentityService.getBeneficiariesByBenId - start, beneficiaryID : " + benId);
@@ -323,40 +300,31 @@ public List<BeneficiariesDTO> getBeneficiariesByBenId(BigInteger benId)
 		if (regId != null && regId.getBenRegId() != null) {
 			List<Object[]> benMapObjArr = mappingRepo.getBenMappingByRegID(regId.getBenRegId());
 
-			// new logic, 27-08-2018
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				MBeneficiarymapping benMap = this.getBeneficiariesDTONew(benMapObjArr.get(0));
 				list.add(this.getBeneficiariesDTO(benMap));
 			}
 		}
 		logger.info("benMap size " + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
-		// end new logic
 
 		logger.info("IdentityService.getBeneficiariesByBenId - end - beneficiaryID : " + benId);
 
 		return list;
 	}
 
-	/**
-	 * 
-	 * @param BenRegId
-	 * @return
-	 */
+	
 	public List<BeneficiariesDTO> getBeneficiariesByBenRegId(BigInteger benRegId)
 			throws NoResultException, QueryTimeoutException, Exception {
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 		logger.info("IdentityService.getBeneficiariesByBenRegId - start for benRegId " + benRegId);
 		try {
-			// new logic, 27-09-2018
 			List<Object[]> benMapObjArr = mappingRepo.getBenMappingByRegID(benRegId);
 
-			// new logic, 27-08-2018
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				MBeneficiarymapping benMap = this.getBeneficiariesDTONew(benMapObjArr.get(0));
 				list.add(this.getBeneficiariesDTO(benMap));
 			}
 			logger.info("benMap size" + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
-			// end new logic
 
 			logger.info("IdentityService.getBeneficiariesByBenRegId - end for benRegId " + benRegId);
 		} catch (Exception e) {
@@ -367,18 +335,10 @@ public List<BeneficiariesDTO> getBeneficiariesByBenRegId(BigInteger benRegId)
 		return list;
 	}
 
-	/**
-	 * 
-	 * Check which parameters available Get BenMapID based on the parameter/set of
-	 * parameters Use BenMapID to retrieve all data for a Beneficiary
-	 * 
-	 * @param phoneNum
-	 * @return
-	 */
+	
 
 	public List<BeneficiariesDTO> getBeneficiariesByPhoneNum(String phoneNum)
 			throws NoResultException, QueryTimeoutException, Exception {
-		// new logic, 27-09-2018
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 		try {
 			List<MBeneficiarycontact> benContact = contactRepo.findByAnyPhoneNum(phoneNum);
@@ -402,20 +362,10 @@ public List<BeneficiariesDTO> getBeneficiariesByPhoneNum(String phoneNum)
 		}
 
 		logger.info("IdentityService.getBeneficiariesByPhoneNum - end");
-		// end
 		return list;
 	}
 
-	/***
-	 * 
-	 * Search beneficiary by healthID / ABHA address
-	 * 
-	 * @param healthID
-	 * @return
-	 * @throws NoResultException
-	 * @throws QueryTimeoutException
-	 * @throws Exception
-	 */
+	
 
 	public List<BeneficiariesDTO> getBeneficiaryByHealthID_AbhaAddress(String healthID)
 			throws NoResultException, QueryTimeoutException, Exception {
@@ -437,16 +387,7 @@ public List<BeneficiariesDTO> getBeneficiaryByHealthID_AbhaAddress(String health
 		return beneficiaryList;
 	}
 
-	/***
-	 * 
-	 * Search beneficiary by healthIDNo / ABHA ID No
-	 * 
-	 * @param healthIDNo
-	 * @return
-	 * @throws NoResultException
-	 * @throws QueryTimeoutException
-	 * @throws Exception
-	 */
+	
 
 	public List<BeneficiariesDTO> getBeneficiaryByHealthIDNo_AbhaIdNo(String healthIDNo)
 			throws NoResultException, QueryTimeoutException, Exception {
@@ -473,7 +414,6 @@ public List<BeneficiariesDTO> searhBeneficiaryByFamilyId(String familyId)
 		List<BeneficiariesDTO> beneficiaryList = new ArrayList<BeneficiariesDTO>();
 		try {
 
-			// find benmap ids
 			List<Object[]> benMapObjArr = new ArrayList<>();
 			List<BigInteger> benDetailsVanSerialNoList = new ArrayList<>();
 			int vanID = 0;
@@ -483,8 +423,6 @@ public List<BeneficiariesDTO> searhBeneficiaryByFamilyId(String familyId)
 			if (benDetailsList == null || benDetailsList.size() == 0)
 				return beneficiaryList;
 			else {
-				// considering as of now family creation is possible through facility modules
-				// only
 				vanID = benDetailsList.get(0).getVanID();
 
 				for (MBeneficiarydetail benDetails : benDetailsList) {
@@ -513,10 +451,8 @@ public List<BeneficiariesDTO> searhBeneficiaryByGovIdentity(String identity)
 
 			List<Object[]> benMapObjArr = new ArrayList<>();
 
-			// find identity no
 			List<MBeneficiaryidentity> benIdentityList = identityRepo.searchByIdentityNo(identity);
 
-			// find benmap ids
 			if (benIdentityList == null || benIdentityList.size() == 0)
 				return beneficiaryList;
 			else {
@@ -659,19 +595,7 @@ private BigInteger getBigIntegerValueFromObject(Object value) {
 		return ret;
 	}
 
-	/**
-	 * The following parameters can be changed/edited once created: - First Name -
-	 * Middle Name - Last Name - DOB/Age - Address (Current, Permanent, Emergency) -
-	 * Contact Numbers/Email Ids - Spouse Name - Preferred Num - Preferred SMS Num -
-	 * Email Id - Identity
-	 * 
-	 * Following changes need Additional Authorization - First Name - Middle Name -
-	 * Last Name - Father Name - Spouse Name - Identity
-	 *
-	 * @param identity
-	 * @return
-	 * @throws MissingMandatoryFieldsException
-	 */
+	
 	public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFieldsException {
 		logger.info("IdentityService.editIdentity - start");
 		if (identity.getBeneficiaryRegId() == null && null == identity.getBeneficaryId()) {
@@ -689,9 +613,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 				|| Boolean.TRUE.equals(identity.getChangeInAssociations())) {
 
 			MBeneficiarydetail mbDetl = editMapper.IdentityEditDTOToMBeneficiarydetail(identity);
-			/**
-			 * new logic for data sync, 26-09-2018
-			 */
+			
 			MBeneficiarydetail benDetails = detailRepo.findBenDetailsByVanSerialNoAndVanID(
 					benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId(), benMapping.getVanID());
 			if (benDetails != null) {
@@ -707,9 +629,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			} else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			/**
-			 * END
-			 */
 
 			logger.debug("Beneficiary details to update = " + new OutputMapper().gson().toJson(mbDetl));
 			detailRepo.save(mbDetl);
@@ -720,9 +639,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 
 			MBeneficiaryaddress mbAddr = editMapper.IdentityEditDTOToMBeneficiaryaddress(identity);
 
-			/**
-			 * new logic for data sync, 26-09-2018
-			 */
+			
 			BigInteger benAddressID = addressRepo.findIdByVanSerialNoAndVanID(
 					benMapping.getMBeneficiaryaddress().getBenAddressID(), benMapping.getVanID());
 			if (benAddressID != null)
@@ -730,9 +647,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			/**
-			 * END
-			 */
+			
 
 			logger.debug("Beneficiary address to update = " + OutputMapper.gson().toJson(mbAddr));
 			addressRepo.save(mbAddr);
@@ -743,9 +658,6 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 
 			MBeneficiarycontact benCon = editMapper.IdentityEdiDTOToMBeneficiarycontact(identity);
 
-			/**
-			 * new logic for data sync, 26-09-2018
-			 */
 			BigInteger benContactsID = contactRepo.findIdByVanSerialNoAndVanID(
 					benMapping.getMBeneficiarycontact().getBenContactsID(), benMapping.getVanID());
 			if (benContactsID != null)
@@ -753,10 +665,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			/**
-			 * END
-			 */
-
+			
 			logger.debug("Beneficiary contact to update = " + OutputMapper.gson().toJson(benCon));
 			contactRepo.save(benCon);
 		}
@@ -787,12 +696,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 					beneficiaryidentity.setVanID(benMapping.getVanID());
 					beneficiaryidentity.setParkingPlaceID(benMapping.getParkingPlaceID());
 				}
-				/**
-				 * add vanID & parkingPlaceID for data sync
-				 */
-				/**
-				 * END
-				 */
+				
 
 				MBeneficiaryidentity m = identityRepo.save(beneficiaryidentity);
 
@@ -846,9 +750,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 		if (Boolean.TRUE.equals(identity.getChangeInBankDetails())) {
 			MBeneficiaryAccount beneficiaryAccount = editMapper.identityEditDTOToMBeneficiaryAccount(identity);
 
-			/**
-			 * new logic for data sync, 26-09-2018
-			 */
+			
 			BigInteger benAccountID = accountRepo.findIdByVanSerialNoAndVanID(
 					benMapping.getMBeneficiaryAccount().getBenAccountID(), benMapping.getVanID());
 			if (benAccountID != null)
@@ -856,9 +758,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			/**
-			 * END
-			 */
+			
 
 			logger.debug("Account to upsert = " + OutputMapper.gson().toJson(beneficiaryAccount));
 			beneficiaryAccount = accountRepo.save(beneficiaryAccount);
@@ -867,9 +767,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 		if (Boolean.TRUE.equals(identity.getChangeInBenImage())) {
 			MBeneficiaryImage beneficiaryImage = editMapper.identityEditDTOToMBeneficiaryImage(identity);
 
-			/**
-			 * new logic for data sync, 26-09-2018
-			 */
+			
 			Long benImageId = imageRepo.findIdByVanSerialNoAndVanID(benMapping.getMBeneficiaryImage().getBenImageId(),
 					benMapping.getVanID());
 			if (benImageId != null)
@@ -877,10 +775,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			/**
-			 * END
-			 */
-
+			
 			logger.debug("Image to upsert = " + OutputMapper.gson().toJson(beneficiaryImage));
 			imageRepo.save(beneficiaryImage);
 		}
@@ -889,10 +784,7 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 		logger.info("IdentityService.editIdentity - end. id = " + benMapping.getBenMapId());
 	}
 
-	/**
-	 * @param identity
-	 * @return
-	 */
+	
 
 	ArrayDeque<MBeneficiaryregidmapping> queue = new ArrayDeque<MBeneficiaryregidmapping>();
 
@@ -1027,15 +919,7 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 				}
 			}
 
-			/**
-			 * commenting below code as optimization process, ABOVE code replaced it
-			 * 
-			 */
-
-			/**
-			 * END
-			 * 
-			 */
+			
 		}
 
 		logger.info("IdentityService.createIdentity - FamilyMap saved ");
@@ -1083,11 +967,7 @@ public String getReservedIdList() {
 		return "success";
 	}
 
-	/**
-	 * 
-	 * @param reserveIdentityDTO
-	 * @return
-	 */
+	
 	public String reserveIdentity(ReserveIdentityDTO reserveIdentityDTO) {
 
 		Long availableCount = regIdRepo.countByProviderServiceMapIDAndVehicalNoOrderByBenRegIdAsc(
@@ -1117,13 +997,7 @@ public String unReserveIdentity(ReserveIdentityDTO unReserve) {
 		return "Successfully Completed";
 	}
 
-	/**
-	 * Get partial details of beneficiaries (first name middle name and last name)
-	 * list on benId's list
-	 * 
-	 * @param BenRegIds
-	 * @return {@link List} Beneficiaries
-	 */
+	
 
 	public List<BeneficiariesPartialDTO> getBeneficiariesPartialDeatilsByBenRegIdList(List<BigInteger> BenRegIds) {
 
@@ -1142,19 +1016,12 @@ public List<BeneficiariesPartialDTO> getBeneficiariesPartialDeatilsByBenRegIdLis
 			logger.info("benMap size" + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
 
 		}
-		// end
 		logger.info("IdetityService.getBeneficiariesPartialDeatilsByBenRegId - end");
 
 		return list;
 	}
 
-	/**
-	 * Get partial details of beneficiaries (first name middle name and last name)
-	 * list on benId's list
-	 * 
-	 * @param BenRegIds
-	 * @return {@link List} Beneficiaries
-	 */
+	
 	public List<BeneficiariesDTO> getBeneficiariesDeatilsByBenRegIdList(List<BigInteger> BenRegIds) {
 
 		logger.info("IdentityService.getBeneficiariesDeatilsByBenRegIdList - end");
@@ -1178,13 +1045,7 @@ public List<BeneficiariesDTO> getBeneficiariesDeatilsByBenRegIdList(List<BigInte
 		return list;
 	}
 
-	/**
-	 * 
-	 * @param benMap
-	 * @return
-	 */
-	// private synchronized BeneficiariesDTO
-	// getBeneficiariesDTO(MBeneficiarymapping benMap)
+	
 	private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 
 		BeneficiariesDTO bdto = mapper.MBeneficiarymappingToBeneficiariesDTO(benMap);
@@ -1217,12 +1078,7 @@ private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 		return bdto;
 	}
 
-	/**
-	 * finite search
-	 * 
-	 * @param identityDTO
-	 * @return
-	 */
+	
 	public List<BeneficiariesDTO> getBeneficiaries(IdentityDTO identityDTO) {
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 
@@ -1236,10 +1092,7 @@ public List<BeneficiariesDTO> getBeneficiaries(IdentityDTO identityDTO) {
 		return list;
 	}
 
-	/***
-	 * 
-	 * @return beneficiary image for beneficiary Reg ID.
-	 */
+	
 	public String getBeneficiaryImage(String requestOBJ) {
 		OutputResponse response = new OutputResponse();
 		try {
@@ -1278,7 +1131,6 @@ 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.");
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 238ccda5..99546eb6 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -54,6 +54,14 @@ getHealthID=healthID/getBenhealthID
 
 ## commit miss error in ci
 
+# DataSource settings: set here your own configurations for the database
+spring.datasource.url=jdbc:mysql://10.208.122.38:3306/db_identity?autoReconnect=true&useSSL=false
+encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
+encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+server.port=7078
+
+
 
 
 

From e67892bb002234960082ddf676e54f69cd715401 Mon Sep 17 00:00:00 2001
From: swetatech24 <sweta.prakash@wipro.com>
Date: Thu, 15 Jun 2023 18:39:58 +0530
Subject: [PATCH 3/4] Sonarqube reported code smell fix

---
 .../identity/domain/MBeneficiaryAccount.java  |   1 -
 .../identity/domain/MBeneficiaryImage.java    |   1 -
 .../identity/domain/MBeneficiarydetail.java   |   1 -
 .../identity/domain/MBeneficiarymapping.java  |  33 +
 .../identity/repo/BenDetailRepoImpl.java      | 111 ++--
 .../identity/service/IdentityService.java     | 583 +++++++++++++++++-
 6 files changed, 655 insertions(+), 75 deletions(-)

diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java
index a89b7743..eedd6f38 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryAccount.java
@@ -92,7 +92,6 @@ public class MBeneficiaryAccount {
 	@Column(name = "VehicalNo", length = 30)
 	private String vehicleNo;
 
-	// @Column(name = "ParkingPlaceID")
 
 	@Column(name = "SyncedBy", length = 30)
 	private String syncedBy;
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java
index acca6ced..a762f64d 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiaryImage.java
@@ -72,7 +72,6 @@ public class MBeneficiaryImage {
 
 	@Column(name = "VehicalNo")
 	private String vehicalNo;
-	// @Column(name = "ParkingPlaceID")
 	@Column(name = "SyncedBy")
 	private String syncedBy;
 	@Column(name = "SyncedDate", unique = true, nullable = false)
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
index 4c3f46e8..f9bd7858 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiarydetail.java
@@ -58,7 +58,6 @@ public class MBeneficiarydetail implements Serializable {
 	@Id
 	@GeneratedValue(strategy = GenerationType.AUTO)
 	@Column(unique = true, nullable = false)
-	// @OrderBy(value = "beneficiaryDetailsId asc")
 	private BigInteger beneficiaryDetailsId;
 
 	private Integer areaId;
diff --git a/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java b/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java
index 1503d463..944df5c7 100644
--- a/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java
+++ b/src/main/java/com/iemr/common/identity/domain/MBeneficiarymapping.java
@@ -84,6 +84,7 @@ public class MBeneficiarymapping implements Serializable {
 
 	private Timestamp reservedOn;
 
+	// uni-directional one-to-one association to MBeneficiaryaddress
 	@OneToOne
 	@JoinColumn(name = "BenAddressId", nullable = false)
 	private MBeneficiaryaddress mBeneficiaryaddress;
@@ -91,6 +92,7 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenAddressId", insertable = false, updatable = false)
 	private BigInteger benAddressId;
 
+	// uni-directional one-to-one association to MBeneficiaryconsent
 	@OneToOne
 	@JoinColumn(name = "BenConsentId"/* , nullable=false */)
 	private MBeneficiaryconsent mBeneficiaryconsent;
@@ -98,6 +100,7 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenConsentId", insertable = false, updatable = false)
 	private BigInteger benConsentId;
 
+	// uni-directional one-to-one association to MBeneficiarycontact
 	@OneToOne
 	@JoinColumn(name = "BenContactsId", nullable = false)
 	private MBeneficiarycontact mBeneficiarycontact;
@@ -105,6 +108,7 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenContactsId", insertable = false, updatable = false)
 	private BigInteger benContactsId;
 
+	// uni-directional one-to-one association to MBeneficiarydetail
 	@OneToOne
 	@JoinColumn(name = "BenDetailsId", referencedColumnName = "BeneficiaryDetailsId", nullable = false)
 	private MBeneficiarydetail mBeneficiarydetail;
@@ -112,33 +116,56 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "BenDetailsId", insertable = false, updatable = false)
 	private BigInteger benDetailsId;
 
+	// uni-directional one-to-one association to MBeneficiaryregidmapping
 	@OneToOne
 	@JoinColumn(name = "BenRegId"/* , nullable=false */)
 	private MBeneficiaryregidmapping mBeneficiaryregidmapping;
 
+	// adding BenRegId variable to get BenMapId for edit beneficiary details
 	@Column(name = "BenRegId", insertable = false, updatable = false)
 	private BigInteger benRegId;
 
+	// uni-directional one-to-one association to MBensecurestack
 	@OneToOne
 	@JoinColumn(name = "BenSecureStackId", nullable = false)
 	private MBensecurestack mBeneficiarysecurestack;
 
+	// uni-directional, new, 28-09-2018
+	// bi-directional many-to-one association to MBeneficiaryfamilymapping
+	// @OneToMany(mappedBy="MBeneficiarymapping", fetch=FetchType.EAGER)
+	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<MBeneficiaryfamilymapping> mBeneficiaryfamilymappings;
 
+	// uni-directional, new, 28-09-2018
+	// bi-directional many-to-one association to MBeneficiaryidentity
+	// @OneToMany(mappedBy = "MBeneficiarymapping", fetch = FetchType.EAGER)
+	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<MBeneficiaryidentity> mBeneficiaryidentities;
 
+	// uni-directional, new, 28-09-2018
+	// bi-directional many-to-one association to MBeneficiaryservicemapping
+	// @OneToMany(mappedBy = "MBeneficiarymapping", fetch = FetchType.EAGER)
+	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<MBeneficiaryservicemapping> mBeneficiaryservicemappings;
 
+	// uni-directional, new, 28-09-2018
+	// bi-directional many-to-one association to TBendataaccess
+	// @OneToMany(mappedBy = "MBeneficiarymapping", fetch = FetchType.EAGER)
+	// @Fetch(FetchMode.SUBSELECT)
 	@OneToMany
 	@JoinColumn(referencedColumnName = "benMapId", name = "benMapId", insertable = false, updatable = false)
 	private List<TBendataaccess> tBendataaccesses;
 
+	/*
+	 * New columns added for MMU integration 11-04-2018
+	 */
+	// uni-directional one-to-one association
 	@OneToOne
 	@JoinColumn(name = "BenImageId")
 	private MBeneficiaryImage mBeneficiaryImage;
@@ -146,6 +173,7 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "benImageId", insertable = false, updatable = false)
 	private Long benImageId;
 
+	// uni-directional one-to-one association
 	@OneToOne
 	@JoinColumn(name = "BenAccountID")
 	private MBeneficiaryAccount mBeneficiaryAccount;
@@ -153,7 +181,10 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "benAccountID", insertable = false, updatable = false)
 	private Long benAccountID;
 
+	// End
 
+	// new column added for data sync
+	// 17-06-2018
 	@Expose
 	@Column(name = "vanID", updatable = false)
 	private Integer vanID;
@@ -165,6 +196,7 @@ public class MBeneficiarymapping implements Serializable {
 	@Column(name = "VanSerialNo", updatable = false)
 	private BigInteger vanSerialNo;
 
+	// 20-01-2021, added for D2D
 	@Expose
 	@Transient
 	private Long houseHoldID;
@@ -198,5 +230,6 @@ public MBeneficiarymapping(BigInteger benMapId, BigInteger benAddressId, BigInte
 		this.createdDate = createdDate;
 	}
 
+	// END OF new column added for data sync
 
 }
\ No newline at end of file
diff --git a/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java b/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
index d1784c4c..ca18a43b 100644
--- a/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
+++ b/src/main/java/com/iemr/common/identity/repo/BenDetailRepoImpl.java
@@ -37,91 +37,114 @@
 import com.iemr.common.identity.domain.MBeneficiarydetail;
 import com.iemr.common.identity.dto.IdentitySearchDTO;
 
-public class BenDetailRepoImpl implements BenDetailRepoCustom
-{
+public class BenDetailRepoImpl implements BenDetailRepoCustom {
 
 	@PersistenceContext
 	private EntityManager entityManager;
 	@Autowired
 	BenRegIdMappingRepo regIdRepo;
 
-	
+	/**
+	 * Search Criteria: the following are necessary to conduct a finite search
+	 * 
+	 * 1. beneficiary ID 2. beneficiary Reg ID 3. Contact Number 4. Name (First,
+	 * Middle, Last), Age, Gender 5. Village Name 6. District State Zone Coordinates
+	 * 7. Pin Code 8. Father Name 9. Spouse Name
+	 * 
+	 * Allowed Single Parameters: - beneficiary Id - beneficiary Reg Id - Contact
+	 * Number
+	 * 
+	 * Allowed Multi-Parameters: - Name (First, Middle, Last), Age, Gender - Contact
+	 * Number & Name (First, Middle, Last) - Pin Code & Name (First, Middle, Last) -
+	 * Village, Father Name & Name (First, Middle, Last) - Village, Spouse Name &
+	 * Name (First, Middle, Last) - Village, District, State - Govt identities(keys,
+	 * values)
+	 */
 
 	@Override
-	public List<MBeneficiarydetail> advanceFilterSearch(IdentitySearchDTO searchDTO)
-	{
+	public List<MBeneficiarydetail> advanceFilterSearch(IdentitySearchDTO searchDTO) {
 
 		CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
 		CriteriaQuery<MBeneficiarydetail> criteriaQuery = criteriaBuilder.createQuery(MBeneficiarydetail.class);
 		Root<MBeneficiarydetail> root = criteriaQuery.from(MBeneficiarydetail.class);
 
+		// add predicates to see more parameters
 		List<Predicate> predicates = new ArrayList<Predicate>();
 
-		
-		if (searchDTO.getFirstName() != null)
-		{
+		/**
+		 * First Name is present, additional criteria needed
+		 */
+		if (searchDTO.getFirstName() != null) {
 
-			predicates.add(criteriaBuilder.like(root.<String> get("firstName"), "%" + searchDTO.getFirstName() + "%"));
+			predicates.add(criteriaBuilder.like(root.<String>get("firstName"), "%" + searchDTO.getFirstName() + "%"));
 		}
 
-		
-		if (searchDTO.getMiddleName() != null)
-		{
-			predicates
-					.add(criteriaBuilder.like(root.<String> get("middleName"), "%" + searchDTO.getMiddleName() + "%"));
+		/**
+		 * Middle Name is present, additional criteria needed
+		 */
+		if (searchDTO.getMiddleName() != null) {
+			predicates.add(criteriaBuilder.like(root.<String>get("middleName"), "%" + searchDTO.getMiddleName() + "%"));
 		}
 
-		
-		if (searchDTO.getLastName() != null)
-		{
-			predicates.add(criteriaBuilder.like(root.<String> get("lastName"), "%" + searchDTO.getLastName() + "%"));
+		/**
+		 * Last Name is present, additional criteria needed
+		 */
+		if (searchDTO.getLastName() != null) {
+			predicates.add(criteriaBuilder.like(root.<String>get("lastName"), "%" + searchDTO.getLastName() + "%"));
 		}
 
-		
-		if (searchDTO.getAgeId() != null)
-		{
+		/**
+		 * Age Id is present, additional criteria needed
+		 */
+		if (searchDTO.getAgeId() != null) {
 			predicates.add(criteriaBuilder.equal(root.get("ageId"), searchDTO.getAgeId()));
 		}
 
-		
-		if (searchDTO.getAge() != null)
-		{
+		/**
+		 * Age is present, additional criteria needed
+		 */
+		if (searchDTO.getAge() != null) {
 			predicates.add(criteriaBuilder.equal(root.get("age"), searchDTO.getAge()));
 		}
 
-		
-		if (searchDTO.getGenderId() != null)
-		{
+		/**
+		 * Gender Id is present, additional criteria needed
+		 */
+		if (searchDTO.getGenderId() != null) {
 			predicates.add(criteriaBuilder.equal(root.get("genderId"), searchDTO.getGenderId()));
 		}
 
-		
-		if (searchDTO.getGenderName() != null)
-		{
+		/**
+		 * Gender Name is present, additional criteria needed
+		 */
+		if (searchDTO.getGenderName() != null) {
 			predicates.add(criteriaBuilder.equal(root.get("genderName"), searchDTO.getGenderName()));
 		}
 
-		
-		if (searchDTO.getSpouseName() != null)
-		{
-			predicates
-					.add(criteriaBuilder.like(root.<String> get("spouseName"), "%" + searchDTO.getSpouseName() + "%"));
+		/**
+		 * Spouse Name is present, additional criteria needed
+		 */
+		if (searchDTO.getSpouseName() != null) {
+			predicates.add(criteriaBuilder.like(root.<String>get("spouseName"), "%" + searchDTO.getSpouseName() + "%"));
 		}
 
-		
-		if (searchDTO.getFatherName() != null)
-		{
-			predicates
-					.add(criteriaBuilder.like(root.<String> get("fatherName"), "%" + searchDTO.getFatherName() + "%"));
+		/**
+		 * Father Name present, additional criteria needed
+		 */
+		if (searchDTO.getFatherName() != null) {
+			predicates.add(criteriaBuilder.like(root.<String>get("fatherName"), "%" + searchDTO.getFatherName() + "%"));
 		}
 
-		
-		if (searchDTO.getPinCode() != null)
-		{
+		/**
+		 * Pin Code is present, additional criteria needed
+		 */
+		if (searchDTO.getPinCode() != null) {
 			predicates.add(criteriaBuilder.equal(root.get("pinCode"), searchDTO.getPinCode()));
 		}
 
-		
+		/**
+		 * Contact Number is present, additional criteria needed
+		 */
 
 		criteriaQuery.select(root).where(predicates.toArray(new Predicate[] {}))
 				.orderBy(criteriaBuilder.asc(root.get("benMapId")));
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 54a018ee..ab8bb995 100644
--- a/src/main/java/com/iemr/common/identity/service/IdentityService.java
+++ b/src/main/java/com/iemr/common/identity/service/IdentityService.java
@@ -95,6 +95,8 @@
 @Service
 public class IdentityService {
 	private static final Logger logger = LoggerFactory.getLogger(IdentityService.class);
+	// private ExecutorService executor = Executors
+	// .newFixedThreadPool(5)/* .newCachedThreadPool() */;
 
 	@Autowired
 	private DataSource dataSource;
@@ -168,24 +170,36 @@ public void getBenAdress() {
 		logger.debug("Mapping By Id: " + mappingRepo.findByBenMapIdOrderByBenMapIdAsc(new BigInteger("12")));
 	}
 
+	/**
+	 * 
+	 * @param searchDTO
+	 * @return
+	 */
 	public List<BeneficiariesDTO> getBeneficiaries(IdentitySearchDTO searchDTO)
 			throws NoResultException, QueryTimeoutException, Exception {
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 
-		
+		/**
+		 * if beneficiary Id present
+		 */
 		if (searchDTO.getBeneficiaryId() != null) {
 			logger.info("getting beneficiaries by ID for " + searchDTO.getBeneficiaryId());
 			List<BeneficiariesDTO> list1 = this.getBeneficiariesByBenId(searchDTO.getBeneficiaryId());
 			return list1;
 		}
 
+		/**
+		 * if beneficiary Reg Id present
+		 */
 		if (searchDTO.getBeneficiaryRegId() != null) {
 			logger.info("getting beneficiaries by reg ID for " + searchDTO.getBeneficiaryRegId());
 			List<BeneficiariesDTO> list2 = this.getBeneficiariesByBenRegId(searchDTO.getBeneficiaryRegId());
 			return list2;
 		}
 
-		
+		/**
+		 * if beneficiary Reg Id present
+		 */
 		if (searchDTO.getContactNumber() != null) {
 			logger.info("getting beneficiaries by contact no for " + searchDTO.getContactNumber());
 			List<BeneficiariesDTO> list3 = this.getBeneficiariesByPhoneNum(searchDTO.getContactNumber());
@@ -278,18 +292,29 @@ public List<BeneficiariesDTO> getBeneficiaries(IdentitySearchDTO searchDTO)
 			return list3;
 		}
 
-		
+		/**
+		 * New logic for advance search, 03-10-2018
+		 */
 		List<V_BenAdvanceSearch> tmpList = mappingRepo.dynamicFilterSearchNew(searchDTO);
 		for (V_BenAdvanceSearch obj : tmpList) {
 			list.add(this.getBeneficiariesDTO(this.getBeneficiariesDTONew1(obj)));
 			logger.debug("benMapId: " + obj.getBenMapID());
 		}
-		
+		/**
+		 * End
+		 */
 
 		return list;
 	}
 
-	
+	/**
+	 * 
+	 * Check which parameters available Get BenMapID based on the parameter/set of
+	 * parameters Use BenMapID to retrieve all data for a Beneficiary
+	 * 
+	 * @param benId
+	 * @return
+	 */
 	public List<BeneficiariesDTO> getBeneficiariesByBenId(BigInteger benId)
 			throws NoResultException, QueryTimeoutException, Exception {
 		logger.info("IdentityService.getBeneficiariesByBenId - start, beneficiaryID : " + benId);
@@ -300,31 +325,40 @@ public List<BeneficiariesDTO> getBeneficiariesByBenId(BigInteger benId)
 		if (regId != null && regId.getBenRegId() != null) {
 			List<Object[]> benMapObjArr = mappingRepo.getBenMappingByRegID(regId.getBenRegId());
 
+			// new logic, 27-08-2018
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				MBeneficiarymapping benMap = this.getBeneficiariesDTONew(benMapObjArr.get(0));
 				list.add(this.getBeneficiariesDTO(benMap));
 			}
 		}
 		logger.info("benMap size " + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
+		// end new logic
 
 		logger.info("IdentityService.getBeneficiariesByBenId - end - beneficiaryID : " + benId);
 
 		return list;
 	}
 
-	
+	/**
+	 * 
+	 * @param BenRegId
+	 * @return
+	 */
 	public List<BeneficiariesDTO> getBeneficiariesByBenRegId(BigInteger benRegId)
 			throws NoResultException, QueryTimeoutException, Exception {
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 		logger.info("IdentityService.getBeneficiariesByBenRegId - start for benRegId " + benRegId);
 		try {
+			// new logic, 27-09-2018
 			List<Object[]> benMapObjArr = mappingRepo.getBenMappingByRegID(benRegId);
 
+			// new logic, 27-08-2018
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				MBeneficiarymapping benMap = this.getBeneficiariesDTONew(benMapObjArr.get(0));
 				list.add(this.getBeneficiariesDTO(benMap));
 			}
 			logger.info("benMap size" + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
+			// end new logic
 
 			logger.info("IdentityService.getBeneficiariesByBenRegId - end for benRegId " + benRegId);
 		} catch (Exception e) {
@@ -335,10 +369,18 @@ public List<BeneficiariesDTO> getBeneficiariesByBenRegId(BigInteger benRegId)
 		return list;
 	}
 
-	
+	/**
+	 * 
+	 * Check which parameters available Get BenMapID based on the parameter/set of
+	 * parameters Use BenMapID to retrieve all data for a Beneficiary
+	 * 
+	 * @param phoneNum
+	 * @return
+	 */
 
 	public List<BeneficiariesDTO> getBeneficiariesByPhoneNum(String phoneNum)
 			throws NoResultException, QueryTimeoutException, Exception {
+		// new logic, 27-09-2018
 		List<BeneficiariesDTO> list = new ArrayList<BeneficiariesDTO>();
 		try {
 			List<MBeneficiarycontact> benContact = contactRepo.findByAnyPhoneNum(phoneNum);
@@ -362,10 +404,20 @@ public List<BeneficiariesDTO> getBeneficiariesByPhoneNum(String phoneNum)
 		}
 
 		logger.info("IdentityService.getBeneficiariesByPhoneNum - end");
+		// end
 		return list;
 	}
 
-	
+	/***
+	 * 
+	 * Search beneficiary by healthID / ABHA address
+	 * 
+	 * @param healthID
+	 * @return
+	 * @throws NoResultException
+	 * @throws QueryTimeoutException
+	 * @throws Exception
+	 */
 
 	public List<BeneficiariesDTO> getBeneficiaryByHealthID_AbhaAddress(String healthID)
 			throws NoResultException, QueryTimeoutException, Exception {
@@ -387,7 +439,16 @@ public List<BeneficiariesDTO> getBeneficiaryByHealthID_AbhaAddress(String health
 		return beneficiaryList;
 	}
 
-	
+	/***
+	 * 
+	 * Search beneficiary by healthIDNo / ABHA ID No
+	 * 
+	 * @param healthIDNo
+	 * @return
+	 * @throws NoResultException
+	 * @throws QueryTimeoutException
+	 * @throws Exception
+	 */
 
 	public List<BeneficiariesDTO> getBeneficiaryByHealthIDNo_AbhaIdNo(String healthIDNo)
 			throws NoResultException, QueryTimeoutException, Exception {
@@ -414,6 +475,7 @@ public List<BeneficiariesDTO> searhBeneficiaryByFamilyId(String familyId)
 		List<BeneficiariesDTO> beneficiaryList = new ArrayList<BeneficiariesDTO>();
 		try {
 
+			// find benmap ids
 			List<Object[]> benMapObjArr = new ArrayList<>();
 			List<BigInteger> benDetailsVanSerialNoList = new ArrayList<>();
 			int vanID = 0;
@@ -423,6 +485,8 @@ public List<BeneficiariesDTO> searhBeneficiaryByFamilyId(String familyId)
 			if (benDetailsList == null || benDetailsList.size() == 0)
 				return beneficiaryList;
 			else {
+				// considering as of now family creation is possible through facility modules
+				// only
 				vanID = benDetailsList.get(0).getVanID();
 
 				for (MBeneficiarydetail benDetails : benDetailsList) {
@@ -451,8 +515,10 @@ public List<BeneficiariesDTO> searhBeneficiaryByGovIdentity(String identity)
 
 			List<Object[]> benMapObjArr = new ArrayList<>();
 
+			// find identity no
 			List<MBeneficiaryidentity> benIdentityList = identityRepo.searchByIdentityNo(identity);
 
+			// find benmap ids
 			if (benIdentityList == null || benIdentityList.size() == 0)
 				return beneficiaryList;
 			else {
@@ -509,8 +575,13 @@ 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]));
 
@@ -535,9 +606,12 @@ private MBeneficiarymapping getBeneficiariesDTONewPartial(Object[] benMapArr) {
 		return benMapOBJ;
 	}
 
+	// 03-10-2018
+	// get ben mapping object from v_benadvancesearch
 	private MBeneficiarymapping getBeneficiariesDTONew1(V_BenAdvanceSearch benAdvanceSearchOBJ) {
 		MBeneficiarymapping benMapOBJ = new MBeneficiarymapping();
 
+		// for createdBy & createdDate
 		if (benAdvanceSearchOBJ != null) {
 			MBeneficiarydetail benDetailsOBJ = detailRepo
 					.getWith_vanSerialNo_vanID(benAdvanceSearchOBJ.getBenDetailsID(), benAdvanceSearchOBJ.getVanID());
@@ -595,16 +669,30 @@ private BigInteger getBigIntegerValueFromObject(Object value) {
 		return ret;
 	}
 
-	
+	/**
+	 * The following parameters can be changed/edited once created: - First Name -
+	 * Middle Name - Last Name - DOB/Age - Address (Current, Permanent, Emergency) -
+	 * Contact Numbers/Email Ids - Spouse Name - Preferred Num - Preferred SMS Num -
+	 * Email Id - Identity
+	 * 
+	 * Following changes need Additional Authorization - First Name - Middle Name -
+	 * Last Name - Father Name - Spouse Name - Identity
+	 *
+	 * @param identity
+	 * @return
+	 * @throws MissingMandatoryFieldsException
+	 */
 	public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFieldsException {
 		logger.info("IdentityService.editIdentity - 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
 
 		MBeneficiarymapping benMapping = mappingRepo.findByBenRegIdOrderByBenMapIdAsc(identity.getBeneficiaryRegId());
 
+		// change in self details is implement here and other details here
 		logger.debug("identity.getChangeInSelfDetails = " + identity.getChangeInSelfDetails());
 		logger.debug("identity.getChangeInOtherDetails = " + identity.getChangeInOtherDetails());
 		logger.debug("identity.getChangeInAssociations = " + identity.getChangeInAssociations());
@@ -612,10 +700,19 @@ 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());
+			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benDetails != null) {
 				mbDetl.setBeneficiaryDetailsId(benDetails.getBeneficiaryDetailsId());
 				if (benDetails.getFamilyId() != null)
@@ -629,47 +726,78 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			} else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
+			/**
+			 * END
+			 */
 
+			// old logic
+			// mbDetl.setBeneficiaryDetailsId(benMapping.getMBeneficiarydetail().getBeneficiaryDetailsId());
 			logger.debug("Beneficiary details to update = " + new OutputMapper().gson().toJson(mbDetl));
 			detailRepo.save(mbDetl);
 		}
 
+		// edition in current emergency and permanent is implement below
 		logger.debug("identity.getChangeInAddress = " + identity.getChangeInAddress());
 		if (Boolean.TRUE.equals(identity.getChangeInAddress())) {
 
 			MBeneficiaryaddress mbAddr = editMapper.IdentityEditDTOToMBeneficiaryaddress(identity);
 
-			
+			/**
+			 * 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(
 					benMapping.getMBeneficiaryaddress().getBenAddressID(), benMapping.getVanID());
+			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benAddressID != null)
 				mbAddr.setBenAddressID(benAddressID);
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			
+			/**
+			 * END
+			 */
 
+			// old logic
+			// mbAddr.setBenAddressID(benMapping.getMBeneficiaryaddress().getBenAddressID());
 			logger.debug("Beneficiary address to update = " + OutputMapper.gson().toJson(mbAddr));
 			addressRepo.save(mbAddr);
 		}
 
+		// edition in beneficiary contacts is updated here
 		logger.debug("identity.getChangeInContacts = " + identity.getChangeInContacts());
 		if (Boolean.TRUE.equals(identity.getChangeInContacts())) {
 
 			MBeneficiarycontact benCon = editMapper.IdentityEdiDTOToMBeneficiarycontact(identity);
 
+			/**
+			 * 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(
 					benMapping.getMBeneficiarycontact().getBenContactsID(), benMapping.getVanID());
+			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benContactsID != null)
 				benCon.setBenContactsID(benContactsID);
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			
+			/**
+			 * END
+			 */
+
 			logger.debug("Beneficiary contact to update = " + OutputMapper.gson().toJson(benCon));
+			// benCon.setBenContactsID(benMapping.getMBeneficiarycontact().getBenContactsID());
 			contactRepo.save(benCon);
 		}
 
+		// change in identities are added here
 		logger.debug("identity.getChangeInIdentities = " + identity.getChangeInIdentities());
 		if (Boolean.TRUE.equals(identity.getChangeInIdentities())) {
 
@@ -678,6 +806,11 @@ 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());
 
 			logger.debug("existing identies = " + OutputMapper.gson().toJson(idList));
@@ -686,28 +819,58 @@ 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
 				if (index >= idList.size() && beneficiaryidentity.getBenIdentityId() == null) {
 					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);
 
+				// new code, update van serial no for new entry, 26-09-2018
 				if (index >= idList.size() && beneficiaryidentity.getBenIdentityId() == null) {
 					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())) {
 			List<MBeneficiaryfamilymapping> fbMaps = editMapper
@@ -715,6 +878,11 @@ 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());
 
@@ -725,6 +893,10 @@ 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());
 
 				logger.debug("family mapping to update = " + OutputMapper.gson().toJson(familymapping));
@@ -737,8 +909,13 @@ 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);
 
+				// new code, update van serial no for new entry, 26-09-2018
 				if (familymapping.getBenFamilyMapId() == null) {
 					int i8 = familyMapRepo.updateVanSerialNo(m.getBenFamilyMapId());
 				}
@@ -747,18 +924,26 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 			}
 		}
 
+		// start
+		// Feature used in outreach
 		if (Boolean.TRUE.equals(identity.getChangeInBankDetails())) {
 			MBeneficiaryAccount beneficiaryAccount = editMapper.identityEditDTOToMBeneficiaryAccount(identity);
 
-			
+			/**
+			 * new logic for data sync, 26-09-2018
+			 */
+			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			BigInteger benAccountID = accountRepo.findIdByVanSerialNoAndVanID(
 					benMapping.getMBeneficiaryAccount().getBenAccountID(), benMapping.getVanID());
+			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benAccountID != null)
 				beneficiaryAccount.setBenAccountID(benAccountID);
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			
+			/**
+			 * END
+			 */
 
 			logger.debug("Account to upsert = " + OutputMapper.gson().toJson(beneficiaryAccount));
 			beneficiaryAccount = accountRepo.save(beneficiaryAccount);
@@ -767,25 +952,46 @@ public void editIdentity(IdentityEditDTO identity) throws MissingMandatoryFields
 		if (Boolean.TRUE.equals(identity.getChangeInBenImage())) {
 			MBeneficiaryImage beneficiaryImage = editMapper.identityEditDTOToMBeneficiaryImage(identity);
 
-			
+			/**
+			 * new logic for data sync, 26-09-2018
+			 */
+			// getting correct beneficiaryDetailsId by passing vanSerialNo & vanID
 			Long benImageId = imageRepo.findIdByVanSerialNoAndVanID(benMapping.getMBeneficiaryImage().getBenImageId(),
 					benMapping.getVanID());
+			// next statement is new one, setting correct beneficiaryDetailsId
 			if (benImageId != null)
 				beneficiaryImage.setBenImageId(benImageId);
 			else
 				throw new MissingMandatoryFieldsException("Either of vanSerialNO or vanID is missing.");
 
-			
+			/**
+			 * END
+			 */
+
 			logger.debug("Image to upsert = " + OutputMapper.gson().toJson(beneficiaryImage));
 			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;
 	}
 
-	
+	/**
+	 * @param identity
+	 * @return
+	 */
 
+	// SynchronousQueue<MBeneficiaryregidmapping> queue = new
+	// SynchronousQueue<MBeneficiaryregidmapping>();
 	ArrayDeque<MBeneficiaryregidmapping> queue = new ArrayDeque<MBeneficiaryregidmapping>();
 
 	public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRException {
@@ -811,6 +1017,25 @@ 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());
@@ -840,36 +1065,80 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		mAddr = addressRepo.save(mAddr);
 		logger.info("IdentityService.createIdentity - Address saved - id = " + mAddr.getBenAddressID());
 
+		// 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);
 		logger.info("IdentityService.createIdentity - Consent saved - id = " + mConsnt.getBenConsentID());
 
+		// 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);
 		logger.info("IdentityService.createIdentity - Contacts saved - id = " + mContc.getBenContactsID());
+
+		// 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);
 		logger.info("IdentityService.createIdentity - Details saved - id = " + mDetl.getBeneficiaryDetailsId());
+
+		// 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);
@@ -879,22 +1148,50 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 		benMapping.setMBeneficiaryAccount(bankOBJ);
 
 		regMap.setProviderServiceMapID(identity.getProviderServiceMapId());
+		// added columns for data sync
+		// 17-09-2018
 		if (identity.getVanID() != null)
 			regMap.setVanID(identity.getVanID());
 		if (identity.getParkingPlaceId() != null)
 			regMap.setParkingPlaceID(identity.getParkingPlaceId());
 		regMap.setVanSerialNo(regMap.getBenRegId());
+		// 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>();
 
+		// new logic (18-09-2018, Neeraj kumar)
 		if (null != identity.getBenFamilyDTOs()) {
 			fIdenList = mapper.IdentityDTOListToMBeneficiaryfamilymappingList(identity.getBenFamilyDTOs());
 			if (fIdenList != null) {
@@ -912,6 +1209,7 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 					}
 				}
 				fList = (List<MBeneficiaryfamilymapping>) familyMapRepo.save(fIdenList);
+				// Update van serial no for data sync
 				if (fList != null && fList.size() > 0) {
 					for (MBeneficiaryfamilymapping obj : fList) {
 						int i7 = familyMapRepo.updateVanSerialNo(obj.getBenFamilyMapId());
@@ -919,20 +1217,52 @@ 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());
 
+		// Update van serial no for data sync
 		int i7 = serviceMapRepo.updateVanSerialNo(sMap.getBenServiceMapID());
 
 		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()) {
@@ -943,6 +1273,7 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 				mIden.setCreatedBy(identity.getAgentName());
 				mIden.setCreatedDate(identity.getEventTypeDate());
 
+				// set new column(vanID, parkingPlaceID) value for data sync
 				if (identity.getVanID() != null)
 					mIden.setVanID(identity.getVanID());
 				if (identity.getParkingPlaceId() != null)
@@ -950,6 +1281,7 @@ public BeneficiaryCreateResp createIdentity(IdentityDTO identity) throws IEMRExc
 
 				MBeneficiaryidentity m = identityRepo.save(mIden);
 
+				// Update van serial no for data sync
 				int i8 = identityRepo.updateVanSerialNo(m.getBenIdentityId());
 
 				mIdenList2.add(m);
@@ -957,6 +1289,14 @@ 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);
@@ -967,7 +1307,11 @@ public String getReservedIdList() {
 		return "success";
 	}
 
-	
+	/**
+	 * 
+	 * @param reserveIdentityDTO
+	 * @return
+	 */
 	public String reserveIdentity(ReserveIdentityDTO reserveIdentityDTO) {
 
 		Long availableCount = regIdRepo.countByProviderServiceMapIDAndVehicalNoOrderByBenRegIdAsc(
@@ -997,18 +1341,68 @@ public String unReserveIdentity(ReserveIdentityDTO unReserve) {
 		return "Successfully Completed";
 	}
 
-	
+	/**
+	 * Get partial details of beneficiaries (first name middle name and last name)
+	 * list on benId's list
+	 * 
+	 * @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<>();
 		if (BenRegIds != null && BenRegIds.size() > 0) {
 			benMapObjArr = mappingRepo.getBenMappingByRegIDList(BenRegIds);
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				for (Object[] objArr : benMapObjArr) {
 					MBeneficiarymapping benMap = this.getBeneficiariesDTONewPartial(objArr);
+//					logger.info("benMap " + benMap);
 
 					list.add(partialMapper.MBeneficiarymappingToBeneficiariesPartialDTO(benMap));
 				}
@@ -1016,22 +1410,90 @@ public List<BeneficiariesPartialDTO> getBeneficiariesPartialDeatilsByBenRegIdLis
 			logger.info("benMap size" + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
 
 		}
+		// end
 		logger.info("IdetityService.getBeneficiariesPartialDeatilsByBenRegId - end");
 
 		return list;
 	}
 
-	
+	/**
+	 * Get partial details of beneficiaries (first name middle name and last name)
+	 * list on benId's list
+	 * 
+	 * @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<>();
 		if (BenRegIds != null && BenRegIds.size() > 0) {
 			benMapObjArr = mappingRepo.getBenMappingByRegIDList(BenRegIds);
 			if (benMapObjArr != null && benMapObjArr.size() > 0) {
 				for (Object[] objArr : benMapObjArr) {
 					MBeneficiarymapping benMap = this.getBeneficiariesDTONew(objArr);
+//					logger.info("benMap " + benMap);
 
 					list.add(this.getBeneficiariesDTO(benMap));
 				}
@@ -1039,13 +1501,20 @@ public List<BeneficiariesDTO> getBeneficiariesDeatilsByBenRegIdList(List<BigInte
 			logger.info("benMap size" + (list.size() == 0 ? "No Beneficiary Found" : list.size()));
 
 		}
+		// end
 
 		logger.info("IdetityService.getBeneficiariesPartialDeatilsByBenRegId - end");
 
 		return list;
 	}
 
-	
+	/**
+	 * 
+	 * @param benMap
+	 * @return
+	 */
+	// private synchronized BeneficiariesDTO
+	// getBeneficiariesDTO(MBeneficiarymapping benMap)
 	private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 
 		BeneficiariesDTO bdto = mapper.MBeneficiarymappingToBeneficiariesDTO(benMap);
@@ -1054,6 +1523,7 @@ 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<>();
@@ -1075,34 +1545,64 @@ private BeneficiariesDTO getBeneficiariesDTO(MBeneficiarymapping benMap) {
 			}
 			bdto.setAbhaDetails(abhaDTOList);
 		}
+		// System.out.println("ABHA end....");
 		return bdto;
 	}
 
-	
+	/**
+	 * finite search
+	 * 
+	 * @param identityDTO
+	 * @return
+	 */
 	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;
 	}
 
-	
+	/***
+	 * 
+	 * @return beneficiary image for beneficiary Reg ID.
+	 */
 	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());
@@ -1131,11 +1631,34 @@ 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) {
 			if (identity.getCommunityId() != null) {
@@ -1172,11 +1695,15 @@ 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;

From d5b5ed076fe36a111bf439ead77684442c170ee0 Mon Sep 17 00:00:00 2001
From: swetatech24 <sweta.prakash@wipro.com>
Date: Thu, 15 Jun 2023 18:46:45 +0530
Subject: [PATCH 4/4] done correction for application.properties

---
 src/main/resources/application.properties | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 99546eb6..9ec2a197 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -54,12 +54,6 @@ getHealthID=healthID/getBenhealthID
 
 ## commit miss error in ci
 
-# DataSource settings: set here your own configurations for the database
-spring.datasource.url=jdbc:mysql://10.208.122.38:3306/db_identity?autoReconnect=true&useSSL=false
-encDbUserName=zFlYsp9Z0s+lRvLM15A3g/Ba0w8VGs/1usuW7EsGF3k=
-encDbPass=JGGAGn5wTlrbTLUHY+5BzfBa0w8VGs/1usuW7EsGF3k=
-spring.datasource.driver-class-name=com.mysql.jdbc.Driver
-server.port=7078
 
 
 
