@@ -74,29 +74,47 @@ public void apply(Network network, ReportNode subReportNode) {
74
74
CreateVoltageLevelSections modification = new CreateVoltageLevelSectionsBuilder ()
75
75
.withReferenceBusbarSectionId (busbarSection .getId ())
76
76
.withCreateTheBusbarSectionsAfterTheReferenceBusbarSection (modificationInfos .isAfterBusbarSectionId ())
77
- .withAllBusbars (false )
77
+ .withAllBusbars (modificationInfos . isAllBusbars () )
78
78
.withLeftSwitchKind (modificationInfos .getLeftSwitchKind () != null ? SwitchKind .valueOf (modificationInfos .getLeftSwitchKind ()) : SwitchKind .DISCONNECTOR )
79
79
.withRightSwitchKind (modificationInfos .getRightSwitchKind () != null ? SwitchKind .valueOf (modificationInfos .getRightSwitchKind ()) : SwitchKind .DISCONNECTOR )
80
80
.withSwitchPrefixId (voltageLevel .getId ())
81
81
.withBusbarSectionPrefixId (voltageLevel .getId ())
82
82
.build ();
83
83
modification .apply (network , true , subReportNode );
84
84
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 ();
90
117
}
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 ();
100
118
}
101
119
}
102
120
0 commit comments