From 8ab7307bfd827e31fd6e453f7185814fdd01c391 Mon Sep 17 00:00:00 2001 From: Antoine Bouhours Date: Wed, 13 Nov 2024 16:28:36 +0100 Subject: [PATCH] Remove workaround for import parameters (#156) Signed-off-by: BOUHOURS Antoine --- .../conversion/server/NetworkConversionService.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/powsybl/network/conversion/server/NetworkConversionService.java b/src/main/java/com/powsybl/network/conversion/server/NetworkConversionService.java index 5f546ef..de6aa69 100644 --- a/src/main/java/com/powsybl/network/conversion/server/NetworkConversionService.java +++ b/src/main/java/com/powsybl/network/conversion/server/NetworkConversionService.java @@ -69,8 +69,6 @@ public class NetworkConversionService { private static final Logger LOGGER = LoggerFactory.getLogger(NetworkConversionService.class); - // Temporary fix to override default import parameter from Powsybl while merge is not implemented in the network-store - public static final Map IMPORT_PARAMETERS_DEFAULT_VALUE_OVERRIDE = Map.of("iidm.import.cgmes.cgm-with-subnetworks", false); private static final Set EXCLUDED_TYPES_FOR_INDEXING = Set.of(IdentifiableType.SWITCH); private RestTemplate caseServerRest; @@ -141,7 +139,7 @@ Map getDefaultImportParameters(CaseInfos caseInfos) { importer.getParameters() .stream() .forEach(parameter -> defaultValues.put(parameter.getName(), - parameter.getDefaultValue() != null ? IMPORT_PARAMETERS_DEFAULT_VALUE_OVERRIDE.getOrDefault(parameter.getName(), parameter.getDefaultValue()).toString() : "")); + parameter.getDefaultValue() != null ? parameter.getDefaultValue().toString() : "")); return defaultValues; } @@ -164,9 +162,6 @@ Consumer> consumeCaseImportStart() { changedImportParameters.forEach((k, v) -> allImportParameters.put(k, v.toString())); CaseInfos caseInfos = getCaseInfos(caseUuid); getDefaultImportParameters(caseInfos).forEach(allImportParameters::putIfAbsent); - IMPORT_PARAMETERS_DEFAULT_VALUE_OVERRIDE.entrySet().stream() - .filter(entry -> allImportParameters.containsKey(entry.getKey())) - .forEach(entry -> changedImportParameters.putIfAbsent(entry.getKey(), entry.getValue())); try { NetworkInfos networkInfos = importCase(caseUuid, variantId, reportUuid, caseInfos.getFormat(), changedImportParameters); @@ -356,9 +351,7 @@ ImportExportFormatMeta getCaseImportParameters(UUID caseUuid) { List paramsMeta = importer.getParameters() .stream() .filter(pp -> pp.getScope().equals(ParameterScope.FUNCTIONAL)) - .map(pp -> new ParamMeta(pp.getName(), pp.getType(), pp.getDescription(), - IMPORT_PARAMETERS_DEFAULT_VALUE_OVERRIDE.getOrDefault(pp.getName(), pp.getDefaultValue()), - pp.getPossibleValues())) + .map(pp -> new ParamMeta(pp.getName(), pp.getType(), pp.getDescription(), pp.getDefaultValue(), pp.getPossibleValues())) .collect(Collectors.toList()); return new ImportExportFormatMeta(caseInfos.getFormat(), paramsMeta); }