From c15c97caa553d46a3043c54a7a053cc4b9e4fac1 Mon Sep 17 00:00:00 2001 From: EtienneLt <32468651+EtienneLt@users.noreply.github.com> Date: Mon, 27 Jan 2025 15:25:52 +0100 Subject: [PATCH 1/2] upgrade network-modification to v0.6.1 (#589) * upgrade network-modification to v0.6.0 Signed-off-by: Etienne LESOT * Upgrade to v0.6.1 and revert test change Signed-off-by: Etienne Homer --------- Signed-off-by: Etienne LESOT Signed-off-by: Etienne Homer Co-authored-by: Etienne Homer --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3e5f1edfb..9f4f01257 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ e --> 1.21.1 **/migration/**/* - 0.5.0 + 0.6.1 From d53f6ce2ce3148617b16b6f3fc217da5790dd15d Mon Sep 17 00:00:00 2001 From: Ghazoua Rehili Date: Mon, 27 Jan 2025 19:20:01 +0100 Subject: [PATCH 2/2] add the substation with voltageLevel creation (#569) Signed-off-by: Rehili Ghazwa --- .../creation/VoltageLevelCreationEntity.java | 21 +++++++++++++++---- .../changesets/changelog_20241204T222759Z.xml | 11 ++++++++++ .../db/changelog/db.changelog-master.yaml | 3 +++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/db/changelog/changesets/changelog_20241204T222759Z.xml diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VoltageLevelCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VoltageLevelCreationEntity.java index 06e1c06d4..0e510865f 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VoltageLevelCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VoltageLevelCreationEntity.java @@ -6,21 +6,20 @@ */ package org.gridsuite.modification.server.entities.equipment.creation; +import com.powsybl.iidm.network.SwitchKind; +import jakarta.persistence.*; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.NonNull; import org.gridsuite.modification.dto.CouplingDeviceInfos; import org.gridsuite.modification.dto.ModificationInfos; import org.gridsuite.modification.dto.VoltageLevelCreationInfos; - -import com.powsybl.iidm.network.SwitchKind; - -import jakarta.persistence.*; import org.gridsuite.modification.server.entities.equipment.modification.FreePropertyEntity; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -65,6 +64,15 @@ public class VoltageLevelCreationEntity extends EquipmentCreationEntity { @CollectionTable private List couplingDevices; + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) + @JoinColumn( + name = "substation_creation_id", + referencedColumnName = "id", + foreignKey = @ForeignKey( + name = "voltageLevel_substationCreation_fk" + )) + private SubstationCreationEntity substationCreation; + public VoltageLevelCreationEntity(VoltageLevelCreationInfos voltageLevelCreationInfos) { super(voltageLevelCreationInfos); assignAttributes(voltageLevelCreationInfos); @@ -88,6 +96,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() { } private VoltageLevelCreationInfos.VoltageLevelCreationInfosBuilder toVoltageLevelCreationInfosBuilder() { + SubstationCreationEntity substationCreationEntity = getSubstationCreation(); List couplingDeviceInfos = couplingDevices.stream() .map(cde -> new CouplingDeviceInfos(cde.getBusbarSectionId1(), cde.getBusbarSectionId2())) .collect(Collectors.toList()); @@ -109,6 +118,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() { .sectionCount(getSectionCount()) .switchKinds(getSwitchKinds()) .couplingDevices(couplingDeviceInfos) + .substationCreation(substationCreationEntity != null ? substationCreationEntity.toSubstationCreationInfos() : null) // properties .properties(CollectionUtils.isEmpty(getProperties()) ? null : getProperties().stream() @@ -133,6 +143,9 @@ private void assignAttributes(VoltageLevelCreationInfos voltageLevelCreationInfo this.sectionCount = voltageLevelCreationInfos.getSectionCount(); this.switchKinds = new ArrayList<>(voltageLevelCreationInfos.getSwitchKinds()); this.couplingDevices = toEmbeddableCouplingDevices(voltageLevelCreationInfos.getCouplingDevices()); + this.substationCreation = Optional.ofNullable(voltageLevelCreationInfos.getSubstationCreation()) + .map(SubstationCreationEntity::new) + .orElse(null); } } diff --git a/src/main/resources/db/changelog/changesets/changelog_20241204T222759Z.xml b/src/main/resources/db/changelog/changesets/changelog_20241204T222759Z.xml new file mode 100644 index 000000000..c245df334 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20241204T222759Z.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 7baf95ebb..67f4f50e2 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -329,4 +329,7 @@ databaseChangeLog: relativeToChangelogFile: true - include: file: changesets/changelog_20250114T150006Z.xml + relativeToChangelogFile: true + - include: + file: changesets/changelog_20241204T222759Z.xml relativeToChangelogFile: true \ No newline at end of file