From a07711f840b859499d28f6476bd951764fc4226e Mon Sep 17 00:00:00 2001 From: BOUHOURS Antoine Date: Tue, 19 Dec 2023 16:13:27 +0100 Subject: [PATCH] Review comment Signed-off-by: BOUHOURS Antoine --- .../server/modifications/EquipmentDeletion.java | 2 +- .../server/modifications/ModificationUtils.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gridsuite/modification/server/modifications/EquipmentDeletion.java b/src/main/java/org/gridsuite/modification/server/modifications/EquipmentDeletion.java index 8301f2c59..ead12eaa3 100644 --- a/src/main/java/org/gridsuite/modification/server/modifications/EquipmentDeletion.java +++ b/src/main/java/org/gridsuite/modification/server/modifications/EquipmentDeletion.java @@ -34,7 +34,7 @@ public EquipmentDeletion(EquipmentDeletionInfos modificationInfos) { @Override public void apply(Network network, Reporter subReporter) { - Identifiable identifiable = ModificationUtils.getInstance().getEquipmentByIdentifiableType(network, modificationInfos.getEquipmentType().name(), modificationInfos.getEquipmentId()); + Identifiable identifiable = ModificationUtils.getInstance().getEquipmentByIdentifiableType(network, modificationInfos.getEquipmentType(), modificationInfos.getEquipmentId()); if (identifiable == null) { throw new NetworkModificationException(EQUIPMENT_NOT_FOUND, "Equipment with id=" + modificationInfos.getEquipmentId() + " not found or of bad type"); } diff --git a/src/main/java/org/gridsuite/modification/server/modifications/ModificationUtils.java b/src/main/java/org/gridsuite/modification/server/modifications/ModificationUtils.java index f9de96006..d18520a90 100644 --- a/src/main/java/org/gridsuite/modification/server/modifications/ModificationUtils.java +++ b/src/main/java/org/gridsuite/modification/server/modifications/ModificationUtils.java @@ -501,7 +501,7 @@ static Report buildModificationReport(T oldValue, T newValue, String fieldNa public Terminal getTerminalFromIdentifiable(Network network, String equipmentId, String type, String voltageLevelId) { if (network != null && equipmentId != null && type != null && voltageLevelId != null) { - Identifiable identifiable = getEquipmentByIdentifiableType(network, type, equipmentId); + Identifiable identifiable = getEquipmentByIdentifiableType(network, IdentifiableType.valueOf(type), equipmentId); if (identifiable == null) { throw new NetworkModificationException(EQUIPMENT_NOT_FOUND, "Equipment with id=" + equipmentId + " not found with type " + type); @@ -552,12 +552,12 @@ public void disconnectBranch(BranchCreationInfos modificationInfos, Branch br } } - public Identifiable getEquipmentByIdentifiableType(Network network, String type, String equipmentId) { + public Identifiable getEquipmentByIdentifiableType(Network network, IdentifiableType type, String equipmentId) { if (type == null || equipmentId == null) { return null; } - switch (IdentifiableType.valueOf(type)) { + switch (type) { case HVDC_LINE: return network.getHvdcLine(equipmentId); case LINE: