Skip to content

Commit

Permalink
correction
Browse files Browse the repository at this point in the history
  • Loading branch information
basseche committed Dec 2, 2024
1 parent 4a863ab commit 85ab4dc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
6 changes: 1 addition & 5 deletions src/main/java/org/gridsuite/filter/server/FilterService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.gridsuite.filter.AbstractFilter;
import org.gridsuite.filter.FilterLoader;
import org.gridsuite.filter.IFilterAttributes;
import org.gridsuite.filter.criteriafilter.CriteriaFilter;
import org.gridsuite.filter.identifierlistfilter.FilterEquipments;
import org.gridsuite.filter.identifierlistfilter.IdentifiableAttributes;
import org.gridsuite.filter.server.dto.IdsByGroup;
Expand Down Expand Up @@ -164,10 +163,7 @@ public Map<UUID, UUID> duplicateFilters(List<UUID> filterUuids) {

private AbstractFilterRepositoryProxy<? extends AbstractFilterEntity,
? extends FilterRepository<? extends AbstractFilterEntity>> getRepository(AbstractFilter filter) {
if (!filter.getType().equals(FilterType.CRITERIA)) {
return filterRepositories.get(filter.getType().name());
}
return filterRepositories.get(((CriteriaFilter) filter).getEquipmentFilterForm().getEquipmentType().name());
return filterRepositories.get(filter.getType().name());
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.powsybl.network.store.iidm.impl.NetworkFactoryImpl;
import org.gridsuite.filter.AbstractFilter;
import org.gridsuite.filter.IFilterAttributes;
import org.gridsuite.filter.criteriafilter.*;
import org.gridsuite.filter.expertfilter.ExpertFilter;
import org.gridsuite.filter.expertfilter.expertrule.*;
import org.gridsuite.filter.identifierlistfilter.IdentifierListFilter;
Expand All @@ -32,7 +31,6 @@
import org.gridsuite.filter.server.utils.assertions.Assertions;
import org.gridsuite.filter.utils.EquipmentType;
import org.gridsuite.filter.utils.FilterType;
import org.gridsuite.filter.utils.RangeType;
import org.gridsuite.filter.utils.expertfilter.CombinatorType;
import org.gridsuite.filter.utils.expertfilter.FieldType;
import org.gridsuite.filter.utils.expertfilter.OperatorType;
Expand Down Expand Up @@ -1055,30 +1053,6 @@ public void testExpertFilterTwoWindingsTransformerWithInAndNotInOperator() throw
// Build a filter AND with only an IN operator
}

@Test
public void lineFilterIsEmpty() {
HvdcLineFilter hvdcFilter = HvdcLineFilter.builder()
.nominalVoltage(new NumericalFilter(RangeType.RANGE, 50., null))
.build();
assertFalse(hvdcFilter.isEmpty());
}

@Test
public void transformerFilterIsEmpty() {
TwoWindingsTransformerFilter transformerFilter =
TwoWindingsTransformerFilter.builder()
.equipmentID(null)
.equipmentName(null)
.substationName(null)
.countries(new TreeSet<>())
.freeProperties(Map.of("region", List.of("north")))
.nominalVoltage1(NumericalFilter.builder().type(RangeType.RANGE).value1(370.).value2(390.).build())
.nominalVoltage2(NumericalFilter.builder().type(RangeType.EQUALITY).value1(225.).build())
.build();

assertFalse(transformerFilter.isEmpty());
}

@Test
public void testExpertFilterLoadLinkToOtherFilterWithIsPartOfOperator() throws Exception {
// Create identifier list filter for loads
Expand Down

0 comments on commit 85ab4dc

Please sign in to comment.