@@ -196,8 +196,8 @@ private static Map<String, Set<String>> getNeighbours(List<Substation> substatio
196
196
for (Substation s : substations ) {
197
197
for (VoltageLevel vl : s .getVoltageLevels ()) {
198
198
for (Line line : vl .getConnectables (Line .class )) {
199
- Substation s1 = line .getTerminal1 ().getVoltageLevel ().getSubstation ();
200
- Substation s2 = line .getTerminal2 ().getVoltageLevel ().getSubstation ();
199
+ Substation s1 = line .getTerminal1 ().getVoltageLevel ().getSubstation (). orElseThrow (); // TODO
200
+ Substation s2 = line .getTerminal2 ().getVoltageLevel ().getSubstation (). orElseThrow (); // TODO
201
201
if (s1 != s ) {
202
202
neighbours .get (s .getId ()).add (s1 .getId ());
203
203
} else if (s2 != s ) {
@@ -248,8 +248,8 @@ boolean emptyOrEquals(String emptyable, String s) {
248
248
*/
249
249
private LineGeoData getLineGeoDataWithEndSubstations (Map <String , LineGeoData > linesGeoDataDb , Map <String , SubstationGeoData > substationGeoDataDb , Line line ) {
250
250
LineGeoData geoData = linesGeoDataDb .get (line .getId ());
251
- Substation sub1 = line .getTerminal1 ().getVoltageLevel ().getSubstation ();
252
- Substation sub2 = line .getTerminal2 ().getVoltageLevel ().getSubstation ();
251
+ Substation sub1 = line .getTerminal1 ().getVoltageLevel ().getSubstation (). orElseThrow (); // TODO
252
+ Substation sub2 = line .getTerminal2 ().getVoltageLevel ().getSubstation (). orElseThrow (); // TODO
253
253
SubstationGeoData substation1GeoData = substationGeoDataDb .get (sub1 .getId ());
254
254
SubstationGeoData substation2GeoData = substationGeoDataDb .get (sub2 .getId ());
255
255
@@ -314,12 +314,12 @@ List<LineGeoData> getLines(Network network, Set<Country> countries) {
314
314
315
315
List <Line > lines = network .getLineStream ()
316
316
.filter (line -> countries .isEmpty ()
317
- || line .getTerminal1 ().getVoltageLevel ().getSubstation ().getCountry ().map (countries ::contains ).isPresent ()
318
- || line .getTerminal2 ().getVoltageLevel ().getSubstation ().getCountry ().map (countries ::contains ).isPresent ())
317
+ || line .getTerminal1 ().getVoltageLevel ().getSubstation ().orElseThrow (). getCountry ().map (countries ::contains ).isPresent () // TODO
318
+ || line .getTerminal2 ().getVoltageLevel ().getSubstation ().orElseThrow (). getCountry ().map (countries ::contains ).isPresent ()) // TODO
319
319
.collect (Collectors .toList ());
320
320
// we also want the destination substation (so we add the neighbouring country)
321
321
Set <Country > countryAndNextTo =
322
- lines .stream ().flatMap (line -> line .getTerminals ().stream ().map (term -> term .getVoltageLevel ().getSubstation ().getNullableCountry ()).filter (Objects ::nonNull ))
322
+ lines .stream ().flatMap (line -> line .getTerminals ().stream ().map (term -> term .getVoltageLevel ().getSubstation ().orElseThrow (). getNullableCountry ()).filter (Objects ::nonNull )) // TODO
323
323
.collect (Collectors .toSet ());
324
324
Map <String , SubstationGeoData > substationGeoDataDb = getSubstationMap (network , countryAndNextTo );
325
325
List <LineGeoData > lineGeoData = lines .stream ().map (line -> getLineGeoDataWithEndSubstations (linesGeoDataDb , substationGeoDataDb , line ))
0 commit comments