Skip to content

Commit

Permalink
Review comment
Browse files Browse the repository at this point in the history
Signed-off-by: BOUHOURS Antoine <[email protected]>
  • Loading branch information
antoinebhs committed Dec 20, 2023
1 parent 26db753 commit c1aa16d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package org.gridsuite.modification.server.modifications;

import com.powsybl.commons.PowsyblException;
import com.powsybl.commons.reporter.Report;
import com.powsybl.commons.reporter.Reporter;
import com.powsybl.commons.reporter.TypedValue;
Expand All @@ -15,6 +14,7 @@
import com.powsybl.iidm.modification.topology.RemoveVoltageLevel;
import com.powsybl.iidm.network.IdentifiableType;
import com.powsybl.iidm.network.Network;
import org.gridsuite.modification.server.NetworkModificationException;
import org.gridsuite.modification.server.dto.ByFilterDeletionInfos;
import org.gridsuite.modification.server.dto.FilterEquipments;
import org.gridsuite.modification.server.dto.FilterInfos;
Expand All @@ -40,7 +40,7 @@ public class ByFilterDeletion extends AbstractModification {

protected FilterService filterService;

private static final EnumSet<IdentifiableType> CONNECTABLE_EQUIPMENTS = EnumSet.of(
private static final EnumSet<IdentifiableType> CONNECTABLE_TYPES = EnumSet.of(
IdentifiableType.LINE,
IdentifiableType.TWO_WINDINGS_TRANSFORMER,
IdentifiableType.THREE_WINDINGS_TRANSFORMER,
Expand Down Expand Up @@ -94,14 +94,14 @@ public void apply(Network network, Reporter subReporter) {

private void applyFilterDeletion(Network network, Reporter subReporter, List<IdentifiableAttributes> identifiableAttributes) {
IdentifiableType identifiableType = modificationInfos.getEquipmentType();
if (CONNECTABLE_EQUIPMENTS.contains(identifiableType)) {
if (CONNECTABLE_TYPES.contains(identifiableType)) {
identifiableAttributes.forEach(identifiableAttribute -> new RemoveFeederBay(identifiableAttribute.getId()).apply(network, true, subReporter));
} else if (identifiableType == IdentifiableType.VOLTAGE_LEVEL) {
identifiableAttributes.forEach(identifiableAttribute -> new RemoveVoltageLevel(identifiableAttribute.getId()).apply(network, true, subReporter));
} else if (identifiableType == IdentifiableType.SUBSTATION) {
identifiableAttributes.forEach(identifiableAttribute -> new RemoveSubstationBuilder().withSubstationId(identifiableAttribute.getId()).build().apply(network, true, subReporter));
} else {
throw new PowsyblException("Unsupported equipment type");
throw NetworkModificationException.createEquipmentTypeUnknown(identifiableType.name());
}
}
}

0 comments on commit c1aa16d

Please sign in to comment.