Skip to content

Commit 73bdaaa

Browse files
authored
do not log the remove regulation logs when no regulating equipments (#508)
Signed-off-by: Etienne LESOT <[email protected]>
1 parent 9f21110 commit 73bdaaa

File tree

1 file changed

+12
-10
lines changed
  • network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl

1 file changed

+12
-10
lines changed

network-store-iidm-impl/src/main/java/com/powsybl/network/store/iidm/impl/TerminalImpl.java

+12-10
Original file line numberDiff line numberDiff line change
@@ -702,16 +702,18 @@ public void removeAsRegulatingPoint() {
702702
}
703703

704704
});
705-
String regulatingEquiments = getAttributes().getRegulatingEquipments().stream()
706-
.map(RegulatingEquipmentIdentifier::getEquipmentId).collect(Collectors.joining(", "));
707-
connectable.getNetwork().getReportNodeContext().getReportNode().newReportNode()
708-
.withMessageTemplate("regulatedTerminalDeleted", "${identifiableId} has been deleted and it was regulated. " +
709-
"The following regulating equipments have their regulation set to Local : [${regulatingEquipments}] ")
710-
.withUntypedValue("identifiableId", connectable.getId())
711-
.withUntypedValue("regulatingEquipments", regulatingEquiments)
712-
.withSeverity(TypedValue.INFO_SEVERITY)
713-
.add();
714-
getAttributes().getRegulatingEquipments().clear();
705+
if (!getAttributes().getRegulatingEquipments().isEmpty()) {
706+
String regulatingEquiments = getAttributes().getRegulatingEquipments().stream()
707+
.map(RegulatingEquipmentIdentifier::getEquipmentId).collect(Collectors.joining(", "));
708+
connectable.getNetwork().getReportNodeContext().getReportNode().newReportNode()
709+
.withMessageTemplate("regulatedTerminalDeleted", "${identifiableId} has been deleted and it was regulated. " +
710+
"The following regulating equipments have their regulation set to Local : [${regulatingEquipments}] ")
711+
.withUntypedValue("identifiableId", connectable.getId())
712+
.withUntypedValue("regulatingEquipments", regulatingEquiments)
713+
.withSeverity(TypedValue.INFO_SEVERITY)
714+
.add();
715+
getAttributes().getRegulatingEquipments().clear();
716+
}
715717
}
716718

717719
public ReferrerManager<Terminal> getReferrerManager() {

0 commit comments

Comments
 (0)