Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1498,19 +1498,37 @@

M_User1 employeeMaster = InputMapper.gson().fromJson(deletedUserDetails, M_User1.class);
M_UserDemographics demographics = InputMapper.gson().fromJson(deletedUserDetails, M_UserDemographics.class);

if (employeeMaster.getUserID() == null) {
throw new Exception("userID is mandatory");

Check warning on line 1503 in src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace generic exceptions with specific library exceptions or a custom exception.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AaCQJ7aaXAYyq3_LD-yc&open=AaCQJ7aaXAYyq3_LD-yc&pullRequest=149
}
if (employeeMaster.getDeleted() == null) {
throw new Exception("deleted flag is mandatory");

Check warning on line 1506 in src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace generic exceptions with specific library exceptions or a custom exception.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AaCQJ7aaXAYyq3_LD-yd&open=AaCQJ7aaXAYyq3_LD-yd&pullRequest=149
}

M_User1 getIdforedit = employeeMasterInter.editData(employeeMaster.getUserID());
if (getIdforedit == null) {
throw new Exception("No user found for userID " + employeeMaster.getUserID());

Check warning on line 1511 in src/main/java/com/iemr/admin/controller/employeemaster/EmployeeMasterController.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace generic exceptions with specific library exceptions or a custom exception.

See more on https://sonarcloud.io/project/issues?id=PSMRI_Admin-API&issues=AaCQJ7aaXAYyq3_LD-ye&open=AaCQJ7aaXAYyq3_LD-ye&pullRequest=149
}
getIdforedit.setDeleted(employeeMaster.getDeleted());
M_User1 editedData = employeeMasterInter.saveeditedData(getIdforedit);

M_UserDemographics getdemographicsData = employeeMasterInter.DataByUserID(employeeMaster.getUserID());
getdemographicsData.setDeleted(demographics.getDeleted());
M_UserDemographics saveDemoData = employeeMasterInter.saveeditedDemoData(getdemographicsData);
if (employeeMaster.getDeleted()) {
M_UserDemographics saveDemoData = null;
if (getdemographicsData != null) {
getdemographicsData.setDeleted(demographics.getDeleted());
saveDemoData = employeeMasterInter.saveeditedDemoData(getdemographicsData);
} else {
logger.warn("No m_userdemographics row for userID {} - activation/deactivation applied to m_user only",
employeeMaster.getUserID());
}

if (Boolean.TRUE.equals(employeeMaster.getDeleted())) {
usrAgentMappingService.updateDeletedAgentIDStatus(editedData.getAgentID());
}
String auth = httpRequest.getHeader("authorization");
employeeMasterInter.expireAuth(editedData, auth);
response.setResponse(saveDemoData.toString());
response.setResponse(saveDemoData != null ? saveDemoData.toString() : editedData.toString());

} catch (Exception e) {
logger.error("Unexpected error:", e);
Expand Down
Loading