@@ -89,7 +89,7 @@ public UUID runShortCircuit(UUID studyUuid, UUID nodeUuid, Optional<String> busI
89
89
HttpHeaders headers = new HttpHeaders ();
90
90
headers .set (HEADER_USER_ID , userId );
91
91
headers .setAccept (List .of (MediaType .TEXT_PLAIN ));
92
- return UUID . fromString ( restTemplate .postForObject (path , new HttpEntity <>(headers ), String .class ) );
92
+ return restTemplate .postForObject (path , new HttpEntity <>(headers ), UUID .class );
93
93
}
94
94
95
95
private String getShortCircuitAnalysisResultResourcePath (UUID nodeUuid , ShortcircuitAnalysisType type ) {
@@ -281,18 +281,16 @@ public List<String> getEnumValues(String enumName, UUID resultUuid) {
281
281
}
282
282
283
283
public UUID createParameters (@ Nullable final String parametersInfos ) {
284
- final URI uri = UriComponentsBuilder .fromUriString (shortCircuitServerBaseUri )
285
- .pathSegment (SHORT_CIRCUIT_API_VERSION , "parameters" )
286
- .build ()
287
- .toUri ();
284
+ final UriComponentsBuilder uri = UriComponentsBuilder .fromUriString (shortCircuitServerBaseUri )
285
+ .pathSegment (SHORT_CIRCUIT_API_VERSION , "parameters" );
288
286
try {
289
287
HttpHeaders headers = new HttpHeaders ();
290
288
headers .setAccept (List .of (MediaType .TEXT_PLAIN ));
291
289
if (StringUtils .isBlank (parametersInfos )) {
292
- return UUID . fromString ( restTemplate .postForObject (uri , new HttpEntity <>(headers ), String .class ) );
290
+ return restTemplate .postForObject (uri . pathSegment ( "default" ). build (). toUri () , new HttpEntity <>(headers ), UUID .class );
293
291
} else {
294
292
headers .setContentType (MediaType .APPLICATION_JSON );
295
- return UUID . fromString ( restTemplate .postForObject (uri , new HttpEntity <>(parametersInfos , headers ), String .class ) );
293
+ return restTemplate .postForObject (uri . build (). toUri () , new HttpEntity <>(parametersInfos , headers ), UUID .class );
296
294
}
297
295
} catch (final HttpStatusCodeException e ) {
298
296
throw handleHttpError (e , CREATE_SHORTCIRCUIT_PARAMETERS_FAILED );
@@ -329,11 +327,11 @@ public UUID duplicateParameters(UUID parametersUuid) {
329
327
try {
330
328
HttpHeaders headers = new HttpHeaders ();
331
329
headers .setAccept (List .of (MediaType .TEXT_PLAIN ));
332
- return UUID . fromString ( restTemplate .postForObject (UriComponentsBuilder .fromUriString (shortCircuitServerBaseUri )
330
+ return restTemplate .postForObject (UriComponentsBuilder .fromUriString (shortCircuitServerBaseUri )
333
331
.pathSegment (SHORT_CIRCUIT_API_VERSION , "parameters" )
334
332
.queryParam ("duplicateFrom" , parametersUuid )
335
- .buildAndExpand ()
336
- .toUri (), new HttpEntity <>(headers ), String .class ) );
333
+ .build ()
334
+ .toUri (), new HttpEntity <>(headers ), UUID .class );
337
335
} catch (final HttpStatusCodeException e ) {
338
336
throw handleHttpError (e , CREATE_SHORTCIRCUIT_PARAMETERS_FAILED );
339
337
}
0 commit comments