Skip to content

Conversation

@achour94
Copy link
Contributor

PR Summary

This pull request introduces support for a new ReportMode option in the reporting workflow, allowing reports to be either appended to or replaced. The changes involve updating the DTOs, service methods, and relevant tests to handle this new mode, while maintaining backward compatibility by defaulting to the append behavior.

Feature: Report mode support

  • Added a new ReportMode enum (APPEND, REPLACE) in org.gridsuite.modification.server.dto to specify how reports are handled.
  • Updated the ReportInfos DTO to include a reportMode field, a no-argument constructor, and a constructor that defaults reportMode to APPEND.

Service changes

  • Modified the ReportService.sendReport method to accept a ReportMode parameter, determining the endpoint used for report submission (replace for REPLACE, default for APPEND). Overloaded the method to maintain backward compatibility.
  • Updated the NetworkModificationApplicator to pass the reportMode from ReportInfos when sending reports.

Signed-off-by: achour94 <berrahmaachour@gmail.com>
@achour94 achour94 self-assigned this Nov 13, 2025
Signed-off-by: achour94 <berrahmaachour@gmail.com>
@TheMaskedTurtle TheMaskedTurtle self-requested a review November 17, 2025 08:19
…cation-report-when-building-variant

# Conflicts:
#	src/test/java/org/gridsuite/modification/server/service/BuildTest.java
@sonarqubecloud
Copy link

Copy link
Contributor

@dbraquart dbraquart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code: 1 remark
tests: in progress

Comment on lines +67 to +68
String endpoint = reportMode == ReportMode.REPLACE ? "replace" : "";
var path = UriComponentsBuilder.fromPath("{reportUuid}" + (endpoint.isEmpty() ? "" : "/" + endpoint))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
String endpoint = reportMode == ReportMode.REPLACE ? "replace" : "";
var path = UriComponentsBuilder.fromPath("{reportUuid}" + (endpoint.isEmpty() ? "" : "/" + endpoint))
var path = UriComponentsBuilder.fromPath("{reportUuid}{endpoint}")

public void sendReport(UUID reportUuid, ReportNode reportNode, ReportMode reportMode) {
String endpoint = reportMode == ReportMode.REPLACE ? "replace" : "";
var path = UriComponentsBuilder.fromPath("{reportUuid}" + (endpoint.isEmpty() ? "" : "/" + endpoint))
.buildAndExpand(reportUuid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.buildAndExpand(reportUuid)
.buildAndExpand(reportUuid, reportMode == ReportMode.REPLACE ? "/replace" : "")

simplier ? and maybe will remove the Sonar issue ?

Copy link
Contributor

@TheMaskedTurtle TheMaskedTurtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark as David otherwise it is fine for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants