-
Notifications
You must be signed in to change notification settings - Fork 33
Release 3.6.0 #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Release 3.6.0 #99
Changes from 23 commits
3c2135e
23cccac
83f693e
8ae4c09
cdd7b2a
128c8f9
a069382
3fd079a
fcbc3da
5cd719d
2a55c54
110fa59
83d3387
b1a893f
b67332f
bdde896
5315e05
486d412
4e5dab6
cd7f567
f06d077
84b679a
7b123e9
a28294f
093ba26
8820fe2
2aab70e
20eaaed
e04b9e5
bd11453
0addca8
b313e03
adc946d
4e3a304
875e40a
41162a4
27241e1
8fb55ce
45250ea
c824879
7231794
e763f9f
3d22060
226c101
74cd354
f719ba5
bb00223
d52c950
86ed8cb
3ae6436
67a4240
f8e646e
8c48069
5f8dcf2
30d3317
6f5a101
1d45257
0acb505
608773a
5a7c6bf
ad6ff5e
eb98a5a
bffa971
c6ded08
2a04bfb
75d06ca
b421d8b
9c206a4
76db67c
d5b3e20
711128e
091bd75
f76f68c
a52081b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,8 @@ | |||||||||||||||||||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||||||||||||||||
| <modelVersion>4.0.0</modelVersion> | ||||||||||||||||||||
| <groupId>com.iemr.admin</groupId> | ||||||||||||||||||||
| <artifactId>admin-api</artifactId> | ||||||||||||||||||||
| <version>3.1.0</version> | ||||||||||||||||||||
| <artifactId>adminapi</artifactId> | ||||||||||||||||||||
| <version>v3.1.0</version> | ||||||||||||||||||||
| <packaging>war</packaging> | ||||||||||||||||||||
| <name>Admin-API</name> | ||||||||||||||||||||
| <description>Admin Page</description> | ||||||||||||||||||||
|
|
@@ -54,6 +54,10 @@ | |||||||||||||||||||
| <groupId>org.springframework.boot</groupId> | ||||||||||||||||||||
| <artifactId>spring-boot-devtools</artifactId> | ||||||||||||||||||||
| </dependency> | ||||||||||||||||||||
| <dependency> | ||||||||||||||||||||
| <groupId>com.fasterxml.jackson.dataformat</groupId> | ||||||||||||||||||||
| <artifactId>jackson-dataformat-xml</artifactId> | ||||||||||||||||||||
| </dependency> | ||||||||||||||||||||
|
Comment on lines
+57
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion | π Major π§© Analysis chainSpecify explicit version for jackson-dataformat-xml to align with Jackson ecosystem. The dependency lacks an explicit Apply this diff to pin the version: <dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
+ <version>2.17.0</version>
</dependency>π Web query: π‘ Result: Latest stable jackson-dataformat-xml: 2.20.0 (released Aug 28, 2025). [1] Compatibility: modules should generally match the Jackson 2.x minor version. For use with Jackson 2.17.0-rc1 you should stick to the 2.17.x xml module (e.g., 2.17.2) β mixing 2.20.0 with a 2.17.0-rc1 core is not recommended and may cause incompatibilities. [2][3] Sources:
Specify explicit version for jackson-dataformat-xml; use stable 2.17.x release instead of RC. The dependency lacks an explicit Apply this diff instead: <dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
+ <version>2.17.2</version>
</dependency>π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||
| <dependency> | ||||||||||||||||||||
| <groupId>org.springframework.boot</groupId> | ||||||||||||||||||||
| <artifactId>spring-boot-starter</artifactId> | ||||||||||||||||||||
|
|
@@ -73,6 +77,11 @@ | |||||||||||||||||||
| <groupId>org.springframework.boot</groupId> | ||||||||||||||||||||
| <artifactId>spring-boot-starter-data-jpa</artifactId> | ||||||||||||||||||||
| </dependency> | ||||||||||||||||||||
| <dependency> | ||||||||||||||||||||
| <groupId>org.apache.commons</groupId> | ||||||||||||||||||||
| <artifactId>commons-compress</artifactId> | ||||||||||||||||||||
| <version>1.21</version> | ||||||||||||||||||||
| </dependency> | ||||||||||||||||||||
|
Comment on lines
+81
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chaincommons-compress 1.21 is old; likely CVEs. Upgrade or let POI manage transitively. Bump to a current secure version or remove the direct pin. - <groupId>org.apache.commons</groupId>
- <artifactId>commons-compress</artifactId>
- <version>1.21</version>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>REPLACE_WITH_SECURE_VERSION</version>To check advisories: π Script executed: #!/bin/bash
rg -n 'commons-compress'
# If feasible in your env:
# mvn -q org.owasp:dependency-check-maven:check -DskipTestsLength of output: 80 π Web query: π‘ Result: Latest release: Apache Commons Compress 1.28.0 β released July 26, 2025. [1][2] Sources: π Web query: π‘ Result: Apache Commons Compress 1.21 is affected by multiple denialβofβservice vulnerabilities (notably CVE-2024-25710 β infinite loop when parsing DUMP files, and CVE-2024-26308 β outβofβmemory during unpacking of malformed Pack200 files). Upgrade to Commons Compress 1.26.0 or later to fix these issues. [1][2][3] Sources:
Upgrade org.apache.commons:commons-compress to 1.28.0 or later - <version>1.21</version>
+ <version>1.28.0</version>π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||
| <dependency> | ||||||||||||||||||||
| <groupId>org.springframework.boot</groupId> | ||||||||||||||||||||
| <artifactId>spring-boot-starter-web</artifactId> | ||||||||||||||||||||
|
|
@@ -181,12 +190,7 @@ | |||||||||||||||||||
| <groupId>org.apache.poi</groupId> | ||||||||||||||||||||
| <artifactId>poi-ooxml</artifactId> | ||||||||||||||||||||
| <version>5.2.3</version> | ||||||||||||||||||||
| <exclusions> | ||||||||||||||||||||
| <exclusion> | ||||||||||||||||||||
| <groupId>org.apache.commons</groupId> | ||||||||||||||||||||
| <artifactId>commons-compress</artifactId> | ||||||||||||||||||||
| </exclusion> | ||||||||||||||||||||
| </exclusions> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| </dependency> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <!-- start newly added dependencies --> | ||||||||||||||||||||
|
|
@@ -275,7 +279,7 @@ | |||||||||||||||||||
| </dependencies> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| <build> | ||||||||||||||||||||
| <finalName>${artifactId}-${version}</finalName> | ||||||||||||||||||||
| <finalName>adminapi-v3.0.0</finalName> | ||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||||||||||||||||||||
| <plugins> | ||||||||||||||||||||
| <plugin> | ||||||||||||||||||||
| <groupId>org.owasp</groupId> | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,90 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.iemr.admin.controller.bulkRegistration; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.iemr.admin.repo.employeemaster.EmployeeMasterRepoo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.iemr.admin.service.bulkRegistration.BulkRegistrationService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.iemr.admin.service.bulkRegistration.BulkRegistrationServiceImpl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.iemr.admin.service.bulkRegistration.EmployeeXmlService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.iemr.admin.service.locationmaster.LocationMasterServiceInter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import io.swagger.v3.oas.annotations.Operation; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import jakarta.servlet.http.HttpServletRequest; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.slf4j.Logger; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.slf4j.LoggerFactory; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.core.io.ClassPathResource; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.http.HttpHeaders; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.http.MediaType; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.http.ResponseEntity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import org.springframework.web.bind.annotation.*; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import java.lang.reflect.Method; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import java.util.HashMap; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import java.util.Map; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @RestController | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class BulkRegistrationController { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Autowired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private EmployeeXmlService employeeXmlService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Autowired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BulkRegistrationServiceImpl bulkRegistrationServiceimpl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Logger logger = LoggerFactory.getLogger(this.getClass().getSimpleName()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Autowired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BulkRegistrationService bulkRegistrationService; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Autowired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private EmployeeMasterRepoo employeeMasterRepoo; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Map<String, Object> errorResponse = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Remove unused field. The Apply this diff: - private Map<String, Object> errorResponse = new HashMap<>();π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Autowired | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private LocationMasterServiceInter locationMasterServiceInter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private Map<String, Object> response = new HashMap<>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @PostMapping(value = "/bulkRegistration", headers = "Authorization") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public ResponseEntity<Map<String, Object>> registerBulkUser(@RequestBody String m_user, @RequestHeader String authorization) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationServiceimpl.bulkRegistrationErrors.clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| logger.info("Bulk registration request received. Request payload is omitted from logs."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationService.registerBulkUser(m_user, authorization); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("status", "Success"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("statusCode", 200); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("totalUser", bulkRegistrationServiceimpl.totalEmployeeListSize); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("registeredUser", bulkRegistrationServiceimpl.m_bulkUser.size()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("error", bulkRegistrationServiceimpl.errorLogs.toString()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationServiceimpl.m_bulkUser.clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationServiceimpl.m_UserDemographics.clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationServiceimpl.errorLogs.clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationServiceimpl.totalEmployeeListSize=0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (Exception e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("message", e.getMessage()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| response.put("statusCode", 500); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ResponseEntity.ok(response); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+48
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thread safety issue with direct field access. Directly accessing and modifying public fields in Consider refactoring the service to:
Example refactor: public class BulkRegistrationResult {
private final int totalUsers;
private final int registeredUsers;
private final List<String> errors;
// constructor, getters...
}
// In service
public BulkRegistrationResult registerBulkUser(String xml, String authorization) {
// ... processing ...
return new BulkRegistrationResult(totalUsers, registeredUsers, errors);
}π€ Prompt for AI AgentsSecurity concern: Response map is reused across requests. The Apply this diff to use local variables: - private Map<String, Object> response = new HashMap<>();
@PostMapping(value = "/bulkRegistration", headers = "Authorization")
public ResponseEntity<Map<String, Object>> registerBulkUser(@RequestBody String m_user, @RequestHeader String authorization) {
bulkRegistrationServiceimpl.bulkRegistrationErrors.clear();
logger.info("Bulk registration request received. Request payload is omitted from logs.");
+ Map<String, Object> response = new HashMap<>();
try {π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @GetMapping(value = "/download-error-sheet", headers = "Authorization") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public ResponseEntity<byte[]> downloadErrorSheet() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| byte[] fileContent = bulkRegistrationServiceimpl.insertErrorLog(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| HttpHeaders headers = new HttpHeaders(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headers.add("Content-Disposition", "attachment; filename=error_log.xlsx"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(!bulkRegistrationServiceimpl.bulkRegistrationErrors.isEmpty()){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bulkRegistrationServiceimpl.bulkRegistrationErrors.clear(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+75
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential race condition when clearing errors. The error list is cleared after the file content is generated, which could cause issues if multiple concurrent requests download the error sheet. One request might clear the errors while another is still processing them. Consider refactoring to:
Additionally, validate that errors exist before generating the file: @GetMapping(value = "/download-error-sheet", headers = "Authorization")
public ResponseEntity<byte[]> downloadErrorSheet() {
try {
+ if (bulkRegistrationServiceimpl.bulkRegistrationErrors.isEmpty()) {
+ return ResponseEntity.status(404)
+ .body("No errors to download".getBytes());
+ }
+
byte[] fileContent = bulkRegistrationServiceimpl.insertErrorLog();
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Disposition", "attachment; filename=error_log.xlsx");
- if(!bulkRegistrationServiceimpl.bulkRegistrationErrors.isEmpty()){
- bulkRegistrationServiceimpl.bulkRegistrationErrors.clear();
- }
return ResponseEntity.ok()
.headers(headers)
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(fileContent);
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ResponseEntity.ok() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .headers(headers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .contentType(MediaType.APPLICATION_OCTET_STREAM) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .body(fileContent); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (Exception e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ResponseEntity.status(500).body(null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.iemr.admin.data.bulkuser; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Data | ||
| public class BulkRegistrationError { | ||
| String userName; | ||
| Integer rowNumber; | ||
| List<String> error; | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,102 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| package com.iemr.admin.data.bulkuser; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import lombok.Data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @Data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlRootElement(localName = "Employee") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class Employee { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Title") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String title=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "FirstName") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String firstName=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "MiddleName") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String middleName=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "LastName") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String lastName=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Gender") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String gender=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "ContactNo") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String contactNo=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Designation") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String designation=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "EmergencyContactNo") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String emergencyContactNo=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "DateOfBirth") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String dob=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Age") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private int age=0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Email") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String email=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "MaritalStatus") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String maritalStatus=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "AadhaarNo") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String aadhaarNo=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "PAN") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String pan=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Qualification") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String qualification=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "FatherName") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String fatherName=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "MotherName") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String motherName=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Community") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String community=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Religion") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String religion=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "CurrentAddressLine1") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String addressLine1=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "CurrentState") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String state=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "CurrentDistrict") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String district=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "CurrentPincode") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String pincode=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "PermanentAddressLine1") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String permanentAddressLine1=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "PermanentState") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String permanentState=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "PermanentDistrict") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String permanentDistrict=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "PermanentPincode") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String permanentPincode=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "DateOfJoining") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String dateOfJoining=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "UserName") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String UserName=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @JacksonXmlProperty(localName = "Password") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private String Password=""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+95
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hide secrets/PII from logs and responses Lombok @DaTa generates toString that will include Password (and other PII). Mark sensitive fields write-only for serialization and exclude from toString. Apply: @@
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.ToString;
@@
- @JacksonXmlProperty(localName = "AadhaarNo")
- private String aadhaarNo="";
+ @JacksonXmlProperty(localName = "AadhaarNo")
+ @ToString.Exclude
+ private String aadhaarNo="";
@@
- @JacksonXmlProperty(localName = "PAN")
- private String pan="";
+ @JacksonXmlProperty(localName = "PAN")
+ @ToString.Exclude
+ private String pan="";
@@
- @JacksonXmlProperty(localName = "Password")
- private String Password="";
+ @JacksonXmlProperty(localName = "Password")
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ @ToString.Exclude
+ private String Password="";π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,17 @@ | ||||||||||||||||||||||||
| package com.iemr.admin.data.bulkuser; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||||||||||||||||||||||||
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; | ||||||||||||||||||||||||
| import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; | ||||||||||||||||||||||||
| import lombok.Data; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import java.util.List; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Data | ||||||||||||||||||||||||
| @JacksonXmlRootElement(localName = "Employees") | ||||||||||||||||||||||||
| public class EmployeeList { | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @JsonProperty("Employee") | ||||||||||||||||||||||||
| @JacksonXmlElementWrapper(useWrapping = false) // To avoid extra nested array in XML | ||||||||||||||||||||||||
| private List<Employee> employees; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+14
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Prevent NPE by default-initializing list Initialize employees to an empty list. +import java.util.ArrayList;
@@
- private List<Employee> employees;
+ private List<Employee> employees = new ArrayList<>();π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,9 +40,16 @@ public interface EmployeeMasterRepoo extends CrudRepository<M_User1, Integer> | |||||
| @Query("SELECT u FROM M_User1 u WHERE u.userID=:userID AND deleted=false") | ||||||
| M_User1 editEmployee(@Param("userID") Integer userID); | ||||||
|
|
||||||
| @Query("SELECT u FROM M_User1 u WHERE u.aadhaarNo=:aadhaar AND deleted=false ") | ||||||
| M_User1 findEmployeeAadhaarNo(@Param("aadhaar") String userName); | ||||||
|
|
||||||
| @Query("SELECT u FROM M_User1 u WHERE u.userName=:userName AND deleted=false ") | ||||||
| M_User1 findEmployeeByName(@Param("userName") String userName); | ||||||
|
|
||||||
|
|
||||||
| @Query("SELECT u FROM M_User1 u WHERE u.contactNo=:contactNo AND deleted=false ") | ||||||
| M_User1 findEmployeeByContact(@Param("contactNo") String userName); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π οΈ Refactor suggestion Fix incorrect parameter name in repository method. The parameter name Apply this diff: - M_User1 findEmployeeByContact(@Param("contactNo") String userName);
+ M_User1 findEmployeeByContact(@Param("contactNo") String contactNo);π Committable suggestion
Suggested change
π€ Prompt for AI Agents |
||||||
|
|
||||||
| @Query("SELECT u FROM M_User1 u WHERE u.userName=:userName OR u.aadhaarNo=:aadhaarNo OR u.pAN=:getpAN OR u.employeeID=:employeeID OR u.healthProfessionalID=:healthProfessionalID AND deleted=false ") | ||||||
| M_User1 checkingEmpDetails(@Param("userName") String userName, @Param("aadhaarNo") String aadhaarNo, | ||||||
| @Param("getpAN") String getpAN,@Param("employeeID") String employeeID, @Param("healthProfessionalID") String healthProfessionalID); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package com.iemr.admin.service.bulkRegistration; | ||
|
|
||
| public interface BulkRegistrationService { | ||
| void registerBulkUser(String user,String authorization); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chainReturn a result and clarify parameter intent. Void makes error handling opaque; name βuserβ doesnβt convey XML payload. Also space after comma. - void registerBulkUser(String user,String authorization);
+ // Consider returning per-row outcome or error list
+ // e.g., List<BulkRegistrationError> registerBulkUsers(String xmlPayload, String authorization);
+ void registerBulkUser(String xmlPayload, String authorization);Search callers/impls that will need updating: π Script executed: #!/bin/bash
rg -n -C2 '\bregisterBulkUser\s*\('
rg -n -C2 'class\s+\w+BulkRegistrationServiceImpl|implements\s+BulkRegistrationService'Length of output: 3244 Use a structured return and clarify the XML parameter
π€ Prompt for AI Agents |
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.