From 7651ddf1cbb6e68b384686d49d8b7b4eade5a091 Mon Sep 17 00:00:00 2001 From: BOUHOURS Antoine Date: Tue, 7 Nov 2023 14:36:21 +0100 Subject: [PATCH] Merge branch 'refactor-line-transformer-entities' of https://github.com/gridsuite/filter-server into organize-by-filter Signed-off-by: BOUHOURS Antoine --- .../repositories/proxies/AbstractFilterRepositoryProxy.java | 3 ++- .../IdentifierListFilterRepositoryProxy.java | 3 ++- .../proxies/scriptfilter/ScriptFilterRepositoryProxy.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gridsuite/filter/server/repositories/proxies/AbstractFilterRepositoryProxy.java b/src/main/java/org/gridsuite/filter/server/repositories/proxies/AbstractFilterRepositoryProxy.java index 820c47b3..49c57a92 100644 --- a/src/main/java/org/gridsuite/filter/server/repositories/proxies/AbstractFilterRepositoryProxy.java +++ b/src/main/java/org/gridsuite/filter/server/repositories/proxies/AbstractFilterRepositoryProxy.java @@ -143,9 +143,10 @@ public void buildGenericFilter(AbstractGenericFilterEntity.AbstractGenericFilter public void buildInjectionFilter(AbstractInjectionFilterEntity.AbstractInjectionFilterEntityBuilder builder, CriteriaFilter dto) { buildGenericFilter(builder, dto); - if (!(dto.getEquipmentFilterForm() instanceof AbstractInjectionFilter injectionFilter)) { + if (!(dto.getEquipmentFilterForm() instanceof AbstractInjectionFilter)) { throw new PowsyblException(WRONG_FILTER_TYPE); } + AbstractInjectionFilter injectionFilter = (AbstractInjectionFilter) dto.getEquipmentFilterForm(); builder.substationName(injectionFilter.getSubstationName()) .countries(AbstractFilterRepositoryProxy.cloneIfNotEmptyOrNull(injectionFilter.getCountries())) .substationFreeProperties(convert(injectionFilter.getFreeProperties())) diff --git a/src/main/java/org/gridsuite/filter/server/repositories/proxies/identifierlistfilter/IdentifierListFilterRepositoryProxy.java b/src/main/java/org/gridsuite/filter/server/repositories/proxies/identifierlistfilter/IdentifierListFilterRepositoryProxy.java index d99a2f56..5c09e061 100644 --- a/src/main/java/org/gridsuite/filter/server/repositories/proxies/identifierlistfilter/IdentifierListFilterRepositoryProxy.java +++ b/src/main/java/org/gridsuite/filter/server/repositories/proxies/identifierlistfilter/IdentifierListFilterRepositoryProxy.java @@ -53,7 +53,8 @@ public AbstractFilter toDto(IdentifierListFilterEntity filterEntity) { @Override public IdentifierListFilterEntity fromDto(AbstractFilter dto) { - if (dto instanceof IdentifierListFilter filter) { + if (dto instanceof IdentifierListFilter) { + var filter = (IdentifierListFilter) dto; var identifierListFilterEntityBuilder = IdentifierListFilterEntity.builder() .equipmentType(filter.getEquipmentType()) .filterEquipmentEntityList(filter.getFilterEquipmentsAttributes() diff --git a/src/main/java/org/gridsuite/filter/server/repositories/proxies/scriptfilter/ScriptFilterRepositoryProxy.java b/src/main/java/org/gridsuite/filter/server/repositories/proxies/scriptfilter/ScriptFilterRepositoryProxy.java index 72969c4e..0de3049f 100644 --- a/src/main/java/org/gridsuite/filter/server/repositories/proxies/scriptfilter/ScriptFilterRepositoryProxy.java +++ b/src/main/java/org/gridsuite/filter/server/repositories/proxies/scriptfilter/ScriptFilterRepositoryProxy.java @@ -55,7 +55,8 @@ public AbstractFilter toDto(ScriptFilterEntity entity) { @Override public ScriptFilterEntity fromDto(AbstractFilter dto) { - if (dto instanceof ScriptFilter filter) { + if (dto instanceof ScriptFilter) { + var filter = (ScriptFilter) dto; var scriptBuilderEntity = ScriptFilterEntity.builder() .script(filter.getScript()); buildAbstractFilter(scriptBuilderEntity, filter);