-
Notifications
You must be signed in to change notification settings - Fork 20
[ISNE-304] - set createdtime and createdby in audit details for demand and water reindexing #977
Changes from all commits
402c30e
30ea854
5c4f023
e82b5e0
d87fd5c
b34f5d3
b359c05
564d24a
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 |
---|---|---|
|
@@ -240,7 +240,7 @@ public List<WaterConnection> updateWaterConnection(WaterConnectionRequest waterC | |
throw new CustomException("DUPLICATE_OLD_CONNECTION_NUMBER", | ||
"Duplicate Old connection number"); | ||
} | ||
|
||
AuditDetails auditDetails=waterConnection.get(0).getAuditDetails(); | ||
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 NullPointerException when accessing In the methods Apply this diff to fix the issue: + if (waterConnection != null && !waterConnection.isEmpty()) {
AuditDetails auditDetails = waterConnection.get(0).getAuditDetails();
+ } else {
+ // Handle the null or empty waterConnection case appropriately
+ // For example, throw a CustomException or initialize auditDetails differently
+ } Also applies to: 334-334 |
||
mDMSValidator.validateMasterData(waterConnectionRequest, WCConstants.UPDATE_APPLICATION); | ||
Property property = validateProperty.getOrValidateProperty(waterConnectionRequest); | ||
validateProperty.validatePropertyFields(property, waterConnectionRequest.getRequestInfo()); | ||
|
@@ -252,7 +252,7 @@ public List<WaterConnection> updateWaterConnection(WaterConnectionRequest waterC | |
String previousApplicationStatus = workflowService.getApplicationStatus(waterConnectionRequest.getRequestInfo(), | ||
waterConnectionRequest.getWaterConnection().getApplicationNo(), | ||
waterConnectionRequest.getWaterConnection().getTenantId(), config.getBusinessServiceValue()); | ||
enrichmentService.enrichUpdateWaterConnection(waterConnectionRequest); | ||
enrichmentService.enrichUpdateWaterConnection(auditDetails, waterConnectionRequest); | ||
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. Ensure In the methods Apply this diff to validate // Previous code ensuring waterConnection is not null or empty
+ if (auditDetails != null) {
enrichmentService.enrichUpdateWaterConnection(auditDetails, waterConnectionRequest);
+ } else {
+ // Handle the null auditDetails case appropriately
+ // For example, initialize auditDetails or handle the error
+ } Also applies to: 346-346 |
||
actionValidator.validateUpdateRequest(waterConnectionRequest, businessService, previousApplicationStatus); | ||
waterConnectionValidator.validateUpdate(waterConnectionRequest, searchResult, WCConstants.UPDATE_APPLICATION); | ||
userService.updateUser(waterConnectionRequest, searchResult); | ||
|
@@ -331,6 +331,7 @@ private List<WaterConnection> updateWaterConnectionForModifyFlow(WaterConnection | |
throw new CustomException("DUPLICATE_OLD_CONNECTION_NUMBER", | ||
"Duplicate Old connection number"); | ||
} | ||
AuditDetails auditDetails=waterConnection.get(0).getAuditDetails(); | ||
mDMSValidator.validateMasterData(waterConnectionRequest, WCConstants.MODIFY_CONNECTION); | ||
BusinessService businessService = workflowService.getBusinessService( | ||
waterConnectionRequest.getWaterConnection().getTenantId(), waterConnectionRequest.getRequestInfo(), | ||
|
@@ -342,7 +343,9 @@ private List<WaterConnection> updateWaterConnectionForModifyFlow(WaterConnection | |
String previousApplicationStatus = workflowService.getApplicationStatus(waterConnectionRequest.getRequestInfo(), | ||
waterConnectionRequest.getWaterConnection().getApplicationNo(), | ||
waterConnectionRequest.getWaterConnection().getTenantId(), config.getModifyWSBusinessServiceName()); | ||
enrichmentService.enrichUpdateWaterConnection(waterConnectionRequest); | ||
if (auditDetails != null) { | ||
enrichmentService.enrichUpdateWaterConnection(auditDetails, waterConnectionRequest); | ||
} | ||
actionValidator.validateUpdateRequest(waterConnectionRequest, businessService, previousApplicationStatus); | ||
userService.updateUser(waterConnectionRequest, searchResult); | ||
waterConnectionValidator.validateUpdate(waterConnectionRequest, searchResult, WCConstants.MODIFY_CONNECTION); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid reusing the same
AuditDetails
instance across demandsThe current implementation modifies a single
auditDetail
instance for all demands. This can lead to unintended side effects, as all demands will share the sameAuditDetails
object. To ensure each demand has its own unique audit details, create a newAuditDetails
instance inside the loop for each demand.Apply this diff to create a new
AuditDetails
for each demand:📝 Committable suggestion
🛠️ Refactor suggestion
Consider copying the entire
currAuditDetails
Instead of selectively copying
createdTime
andcreatedBy
, you might want to copy all relevant audit details to preserve the full audit trail. This ensures consistency and completeness of audit information.Apply this diff to copy the audit details: