Skip to content

Commit

Permalink
remove isWithSubstationCreation
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazwarhili committed Dec 9, 2024
1 parent 81bb52f commit ee48e64
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -95,6 +96,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
}

private VoltageLevelCreationInfos.VoltageLevelCreationInfosBuilder<?, ?> toVoltageLevelCreationInfosBuilder() {
SubstationCreationEntity substationCreationEntity = getSubstationCreation();
List<CouplingDeviceInfos> couplingDeviceInfos = couplingDevices.stream()
.map(cde -> new CouplingDeviceInfos(cde.getBusbarSectionId1(), cde.getBusbarSectionId2()))
.collect(Collectors.toList());
Expand All @@ -116,7 +118,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
.sectionCount(getSectionCount())
.switchKinds(getSwitchKinds())
.couplingDevices(couplingDeviceInfos)
.substationCreation(getSubstationCreation() != null ? getSubstationCreation().toSubstationCreationInfos() : null)
.substationCreation(substationCreationEntity != null ? substationCreationEntity.toSubstationCreationInfos() : null)
// properties
.properties(CollectionUtils.isEmpty(getProperties()) ? null :
getProperties().stream()
Expand All @@ -141,8 +143,9 @@ private void assignAttributes(VoltageLevelCreationInfos voltageLevelCreationInfo
this.sectionCount = voltageLevelCreationInfos.getSectionCount();
this.switchKinds = new ArrayList<>(voltageLevelCreationInfos.getSwitchKinds());
this.couplingDevices = toEmbeddableCouplingDevices(voltageLevelCreationInfos.getCouplingDevices());
this.substationCreation = voltageLevelCreationInfos.isWithSubstationCreation() ?
new SubstationCreationEntity(voltageLevelCreationInfos.getSubstationCreation()) : null;
this.substationCreation = Optional.ofNullable(voltageLevelCreationInfos.getSubstationCreation())
.map(SubstationCreationEntity::new)
.orElse(null);
}
}

0 comments on commit ee48e64

Please sign in to comment.