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 19, 2023
1 parent 7c1476d commit a07711f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ static <T> 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);
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a07711f

Please sign in to comment.