@@ -74,29 +74,47 @@ public void apply(Network network, ReportNode subReportNode) {
7474 CreateVoltageLevelSections modification = new CreateVoltageLevelSectionsBuilder ()
7575 .withReferenceBusbarSectionId (busbarSection .getId ())
7676 .withCreateTheBusbarSectionsAfterTheReferenceBusbarSection (modificationInfos .isAfterBusbarSectionId ())
77- .withAllBusbars (false )
77+ .withAllBusbars (modificationInfos . isAllBusbars () )
7878 .withLeftSwitchKind (modificationInfos .getLeftSwitchKind () != null ? SwitchKind .valueOf (modificationInfos .getLeftSwitchKind ()) : SwitchKind .DISCONNECTOR )
7979 .withRightSwitchKind (modificationInfos .getRightSwitchKind () != null ? SwitchKind .valueOf (modificationInfos .getRightSwitchKind ()) : SwitchKind .DISCONNECTOR )
8080 .withSwitchPrefixId (voltageLevel .getId ())
8181 .withBusbarSectionPrefixId (voltageLevel .getId ())
8282 .build ();
8383 modification .apply (network , true , subReportNode );
8484
85- BusbarSection newBusbarSection = null ;
86- for (BusbarSection bbs : voltageLevel .getNodeBreakerView ().getBusbarSections ()) {
87- if (!busBarIds .contains (bbs .getId ())) {
88- newBusbarSection = bbs ;
89- break ;
85+ if (modificationInfos .isAllBusbars ()) {
86+ List <BusbarSection > newBusbarSections = new ArrayList <>();
87+ for (BusbarSection bbs : voltageLevel .getNodeBreakerView ().getBusbarSections ()) {
88+ if (!busBarIds .contains (bbs .getId ())) {
89+ newBusbarSections .add (bbs );
90+ }
91+ }
92+ for (BusbarSection section : newBusbarSections ) {
93+ subReportNode .newReportNode ()
94+ .withMessageTemplate ("network.modification.voltageLevel.sectionCreation" )
95+ .withUntypedValue ("sectionId" , section .getId ())
96+ .withUntypedValue ("busbarIndex" , section .getExtension (BusbarSectionPosition .class ).getBusbarIndex ())
97+ .withUntypedValue ("sectionIndex" , section .getExtension (BusbarSectionPosition .class ).getSectionIndex ())
98+ .withSeverity (TypedValue .INFO_SEVERITY )
99+ .add ();
100+ }
101+ } else {
102+ BusbarSection newBusbarSection = null ;
103+ for (BusbarSection bbs : voltageLevel .getNodeBreakerView ().getBusbarSections ()) {
104+ if (!busBarIds .contains (bbs .getId ())) {
105+ newBusbarSection = bbs ;
106+ break ;
107+ }
108+ }
109+ if (newBusbarSection != null ) {
110+ subReportNode .newReportNode ()
111+ .withMessageTemplate ("network.modification.voltageLevel.sectionCreation" )
112+ .withUntypedValue ("sectionId" , newBusbarSection .getId ())
113+ .withUntypedValue ("busbarIndex" , newBusbarSection .getExtension (BusbarSectionPosition .class ).getBusbarIndex ())
114+ .withUntypedValue ("sectionIndex" , newBusbarSection .getExtension (BusbarSectionPosition .class ).getSectionIndex ())
115+ .withSeverity (TypedValue .INFO_SEVERITY )
116+ .add ();
90117 }
91- }
92- if (newBusbarSection != null ) {
93- subReportNode .newReportNode ()
94- .withMessageTemplate ("network.modification.voltageLevel.sectionCreation" )
95- .withUntypedValue ("sectionId" , newBusbarSection .getId ())
96- .withUntypedValue ("busbarIndex" , newBusbarSection .getExtension (BusbarSectionPosition .class ).getBusbarIndex ())
97- .withUntypedValue ("sectionIndex" , newBusbarSection .getExtension (BusbarSectionPosition .class ).getSectionIndex ())
98- .withSeverity (TypedValue .INFO_SEVERITY )
99- .add ();
100118 }
101119 }
102120
0 commit comments