Skip to content

Commit

Permalink
Fix properties report (#321)
Browse files Browse the repository at this point in the history
Signed-off-by: TOURI ANIS <[email protected]>
  • Loading branch information
anistouri authored Sep 8, 2023
1 parent a8e9318 commit e6864c8
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.gridsuite.modification.server.dto.SubstationCreationInfos;

import java.util.Map;
import java.util.Optional;

public class SubstationCreation extends AbstractModification {

Expand Down Expand Up @@ -47,12 +48,15 @@ public void apply(Network network, Reporter subReporter) {
.reportElementaryCreation(subReporter, modificationInfos.getSubstationCountry(), "Country");
}
// properties
modificationInfos.getProperties().forEach((key, value) -> subReporter.report(Report.builder()
.withKey("propertyAdded")
.withDefaultMessage(" Property ${name} added with value ${value}")
.withValue("name", key)
.withValue("value", value)
.withSeverity(TypedValue.INFO_SEVERITY)
.build()));
Optional.ofNullable(modificationInfos.getProperties())
.filter(propertie -> !properties.isEmpty())
.ifPresent(propertie -> properties.forEach((key, value) -> subReporter.report(Report.builder()
.withKey("propertyAdded")
.withDefaultMessage(" Property ${name} added with value ${value}")
.withValue("name", key)
.withValue("value", value)
.withSeverity(TypedValue.INFO_SEVERITY)
.build())));

}
}

0 comments on commit e6864c8

Please sign in to comment.