Skip to content

Commit

Permalink
Remove workaround for import parameters (#156)
Browse files Browse the repository at this point in the history
Signed-off-by: BOUHOURS Antoine <antoine.bouhours@rte-france.com>
  • Loading branch information
antoinebhs authored Nov 13, 2024
1 parent 5b35324 commit 8ab7307
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Object> IMPORT_PARAMETERS_DEFAULT_VALUE_OVERRIDE = Map.of("iidm.import.cgmes.cgm-with-subnetworks", false);
private static final Set<IdentifiableType> EXCLUDED_TYPES_FOR_INDEXING = Set.of(IdentifiableType.SWITCH);
private RestTemplate caseServerRest;

Expand Down Expand Up @@ -141,7 +139,7 @@ Map<String, String> 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;
}

Expand All @@ -164,9 +162,6 @@ Consumer<Message<UUID>> 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);
Expand Down Expand Up @@ -356,9 +351,7 @@ ImportExportFormatMeta getCaseImportParameters(UUID caseUuid) {
List<ParamMeta> 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);
}
Expand Down

0 comments on commit 8ab7307

Please sign in to comment.