3636
3737import static org .gridsuite .computation .service .NotificationService .HEADER_USER_ID ;
3838import static org .gridsuite .computation .utils .FilterUtils .fromStringFiltersToDTO ;
39+ import static org .gridsuite .computation .utils .FilterUtils .fromStringGlobalFiltersToDTO ;
3940import static org .springframework .http .MediaType .*;
4041
4142/**
@@ -122,12 +123,19 @@ public ResponseEntity<UUID> runAndSave(@Parameter(description = "Network UUID")
122123 @ ApiResponses (value = {@ ApiResponse (responseCode = "200" , description = "The security analysis result" ),
123124 @ ApiResponse (responseCode = "404" , description = "Security analysis result has not been found" )})
124125 public ResponseEntity <List <PreContingencyLimitViolationResultDTO >> getNResult (@ Parameter (description = "Result UUID" ) @ PathVariable ("resultUuid" ) UUID resultUuid ,
126+ @ Parameter (description = "network Uuid" ) @ RequestParam (name = "networkUuid" , required = false ) UUID networkUuid ,
127+ @ Parameter (description = "variant Id" ) @ RequestParam (name = "variantId" , required = false ) String variantId ,
125128 @ Parameter (description = "Filters" ) @ RequestParam (name = "filters" , required = false ) String stringFilters ,
129+ @ Parameter (description = "Global Filters" ) @ RequestParam (name = "globalFilters" , required = false ) String globalFilters ,
126130 @ Parameter (description = "Pageable parameters for pagination and sorting" ) Sort sort ) {
127131 String decodedStringFilters = stringFilters != null ? URLDecoder .decode (stringFilters , StandardCharsets .UTF_8 ) : null ;
132+ String decodedStringGlobalFilters = globalFilters != null ? URLDecoder .decode (globalFilters , StandardCharsets .UTF_8 ) : null ;
128133 List <PreContingencyLimitViolationResultDTO > result = securityAnalysisResultService .findNResult (
129134 resultUuid ,
135+ networkUuid ,
136+ variantId ,
130137 fromStringFiltersToDTO (decodedStringFilters , securityAnalysisResultService .getObjectMapper ()),
138+ fromStringGlobalFiltersToDTO (decodedStringGlobalFilters , securityAnalysisResultService .getObjectMapper ()),
131139 sort );
132140
133141 return result != null
@@ -151,10 +159,14 @@ public ResponseEntity<byte[]> getNResultZippedCsv(@Parameter(description = "Resu
151159 @ ApiResponses (value = {@ ApiResponse (responseCode = "200" , description = "The security analysis result" ),
152160 @ ApiResponse (responseCode = "404" , description = "Security analysis result has not been found" )})
153161 public ResponseEntity <Page <ContingencyResultDTO >> getNmKContingenciesResult (@ Parameter (description = "Result UUID" ) @ PathVariable ("resultUuid" ) UUID resultUuid ,
154- @ Parameter (description = "Filters" ) @ RequestParam (name = "filters" , required = false ) String stringFilters ,
155- @ Parameter (description = "Pagination parameters" ) Pageable pageable ) {
162+ @ Parameter (description = "network Uuid" ) @ RequestParam (name = "networkUuid" , required = false ) UUID networkUuid ,
163+ @ Parameter (description = "variant Id" ) @ RequestParam (name = "variantId" , required = false ) String variantId ,
164+ @ Parameter (description = "Filters" ) @ RequestParam (name = "filters" , required = false ) String stringFilters ,
165+ @ Parameter (description = "Global Filters" ) @ RequestParam (name = "globalFilters" , required = false ) String globalFilters ,
166+ @ Parameter (description = "Pagination parameters" ) Pageable pageable ) {
156167 String decodedStringFilters = stringFilters != null ? URLDecoder .decode (stringFilters , StandardCharsets .UTF_8 ) : null ;
157- Page <ContingencyResultDTO > result = securityAnalysisResultService .findNmKContingenciesPaged (resultUuid , decodedStringFilters , pageable );
168+ String decodedStringGlobalFilters = globalFilters != null ? URLDecoder .decode (globalFilters , StandardCharsets .UTF_8 ) : null ;
169+ Page <ContingencyResultDTO > result = securityAnalysisResultService .findNmKContingenciesPaged (resultUuid , networkUuid , variantId , decodedStringFilters , decodedStringGlobalFilters , pageable );
158170
159171 return result != null
160172 ? ResponseEntity .ok ().contentType (MediaType .APPLICATION_JSON ).body (result )
@@ -177,10 +189,14 @@ public ResponseEntity<byte[]> getNmKContingenciesResultZippedCsv(@Parameter(desc
177189 @ ApiResponses (value = {@ ApiResponse (responseCode = "200" , description = "The security analysis result" ),
178190 @ ApiResponse (responseCode = "404" , description = "Security analysis result has not been found" )})
179191 public ResponseEntity <Page <SubjectLimitViolationResultDTO >> getNmKConstraintsResult (@ Parameter (description = "Result UUID" ) @ PathVariable ("resultUuid" ) UUID resultUuid ,
192+ @ Parameter (description = "network Uuid" ) @ RequestParam (name = "networkUuid" , required = false ) UUID networkUuid ,
193+ @ Parameter (description = "variant Id" ) @ RequestParam (name = "variantId" , required = false ) String variantId ,
180194 @ Parameter (description = "Filters" ) @ RequestParam (name = "filters" , required = false ) String stringFilters ,
195+ @ Parameter (description = "Global Filters" ) @ RequestParam (name = "globalFilters" , required = false ) String globalFilters ,
181196 @ Parameter (description = "Pagination parameters" ) Pageable pageable ) {
182197 String decodedStringFilters = stringFilters != null ? URLDecoder .decode (stringFilters , StandardCharsets .UTF_8 ) : null ;
183- Page <SubjectLimitViolationResultDTO > result = securityAnalysisResultService .findNmKConstraintsResultPaged (resultUuid , decodedStringFilters , pageable );
198+ String decodedStringGlobalFilters = globalFilters != null ? URLDecoder .decode (globalFilters , StandardCharsets .UTF_8 ) : null ;
199+ Page <SubjectLimitViolationResultDTO > result = securityAnalysisResultService .findNmKConstraintsResultPaged (resultUuid , networkUuid , variantId , decodedStringFilters , decodedStringGlobalFilters , pageable );
184200 return result != null
185201 ? ResponseEntity .ok ().contentType (MediaType .APPLICATION_JSON ).body (result )
186202 : ResponseEntity .notFound ().build ();
0 commit comments