Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazwarhili committed Sep 19, 2024
2 parents 31fb678 + 41ec5c2 commit 00ee3ac
Show file tree
Hide file tree
Showing 63 changed files with 726 additions and 137 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-parent-ws</artifactId>
<version>19</version>
<version>20</version>
<relativePath/>
</parent>

Expand Down Expand Up @@ -44,7 +44,7 @@
</developers>

<properties>
<gridsuite-dependencies.version>31</gridsuite-dependencies.version>
<gridsuite-dependencies.version>33</gridsuite-dependencies.version>
<db-util.version>1.0.5</db-util.version>
<log4j2-mock-version>0.0.2</log4j2-mock-version>
<testcontainers.version>1.16.2</testcontainers.version>
Expand Down Expand Up @@ -287,7 +287,7 @@
</dependency>
<dependency>
<groupId>org.wiremock</groupId>
<artifactId>wiremock</artifactId>
<artifactId>wiremock-jetty12</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public ResponseEntity<Map<UUID, UUID>> duplicateModifications(@Parameter(descrip
return ResponseEntity.ok().body(networkModificationService.duplicateModifications(sourceModificationUuids));
}

@PutMapping(value = "/network-modifications", produces = MediaType.APPLICATION_JSON_VALUE)
@PutMapping(value = "/network-modifications", produces = MediaType.APPLICATION_JSON_VALUE, params = "stashed")
@Operation(summary = "stash or unstash network modifications")
@ApiResponse(responseCode = "200", description = "The network modifications were stashed")
public ResponseEntity<Void> stashNetworkModifications(
Expand All @@ -242,6 +242,16 @@ public ResponseEntity<Void> stashNetworkModifications(
return ResponseEntity.ok().build();
}

@PutMapping(value = "/network-modifications", produces = MediaType.APPLICATION_JSON_VALUE, params = "activated")
@Operation(summary = "activate or deactivate network modifications")
@ApiResponse(responseCode = "200", description = "The activation status related to the network modification was successfully updated")
public ResponseEntity<Void> updateNetworkModificationsActivationStatus(
@Parameter(description = "Network modification UUIDs") @RequestParam("uuids") List<UUID> networkModificationUuids,
@Parameter(description = "activate or deactivate network modifications") @RequestParam(name = "activated") Boolean activated) {
networkModificationService.updateNetworkModificationActivation(networkModificationUuids, activated);
return ResponseEntity.ok().build();
}

@PutMapping(value = "/groups/{groupUuid}/duplications", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "Duplicate all modifications in a group and append them at the end of another modifications group")
@ApiResponse(responseCode = "200", description = "The modifications have been duplicated")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package org.gridsuite.modification.server.dto;
import com.powsybl.iidm.network.extensions.ConnectablePosition;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
Expand Down Expand Up @@ -35,9 +36,39 @@ public class BranchModificationInfos extends BasicEquipmentModificationInfos {
@Schema(description = "Current limits Side 2")
private CurrentLimitsModificationInfos currentLimits2;

@Schema(description = "Voltage level id modification 1")
private AttributeModification<String> voltageLevelId1;

@Schema(description = "Voltage level id modification 2")
private AttributeModification<String> voltageLevelId2;

@Schema(description = "Bus id modification 1")
private AttributeModification<String> busOrBusbarSectionId1;

@Schema(description = "Bus id modification 2")
private AttributeModification<String> busOrBusbarSectionId2;

@Schema(description = "Connection Name 1")
private AttributeModification<String> connectionName1;

@Schema(description = "Connection Name 2")
private AttributeModification<String> connectionName2;

@Schema(description = "Connection Direction 1")
private AttributeModification<ConnectablePosition.Direction> connectionDirection1;

@Schema(description = "Connection Direction 2")
private AttributeModification<ConnectablePosition.Direction> connectionDirection2;

@Schema(description = "Connection Position 1")
private AttributeModification<Integer> connectionPosition1;

@Schema(description = "Connection Position 2")
private AttributeModification<Integer> connectionPosition2;

@Schema(description = "Connected 1")
private AttributeModification<Boolean> connected1;
private AttributeModification<Boolean> terminal1Connected;

@Schema(description = "Connected 2")
private AttributeModification<Boolean> connected2;
private AttributeModification<Boolean> terminal2Connected;
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,17 @@ public class ModificationInfos {
@Schema(description = "Message values")
private String messageValues;

@Schema(description = "Modification activated")
@Builder.Default
private Boolean activated = true;

// Only for metadata
public static ModificationInfos fromEntity(@NonNull ModificationEntity entity) {
ModificationInfos modificationInfos = ModificationInfos.builder()
.uuid(entity.getId())
.date(entity.getDate())
.stashed(entity.getStashed())
.activated(entity.getActivated())
.messageType(entity.getMessageType())
.messageValues(entity.getMessageValues())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public CompositeModificationEntity(@NonNull CompositeModificationInfos composite
public CompositeModificationInfos toModificationInfos() {
List<ModificationInfos> modificationsInfos = modifications.stream().map(ModificationEntity::toModificationInfos).toList();
return CompositeModificationInfos.builder()
.activated(getActivated())
.date(getDate())
.uuid(getId())
.stashed(getStashed())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public GroovyScriptInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.script(getScript());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,15 @@ public class ModificationEntity {
@Column(name = "message_values")
private String messageValues;

public ModificationEntity(UUID id, String type, Instant date, Boolean stashed, String messageType, String messageValues) {
@Column(name = "activated")
private Boolean activated = true;

public ModificationEntity(UUID id, String type, Instant date, Boolean stashed, Boolean activated, String messageType, String messageValues) {
this.id = id;
this.type = type;
this.date = date;
this.stashed = stashed;
this.activated = activated;
this.messageType = messageType;
this.messageValues = messageValues;
}
Expand All @@ -82,6 +86,7 @@ protected ModificationEntity(ModificationInfos modificationInfos) {
this.date = Instant.now().truncatedTo(ChronoUnit.MICROS);
// Do not put this stashed status in assignAttributes, it's not part of a network modification as such.
this.stashed = modificationInfos.getStashed();
this.activated = modificationInfos.getActivated();

assignAttributes(modificationInfos);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public TabularCreationInfos toModificationInfos() {
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.activated(getActivated())
.creationType(creationType)
.creations(creationsInfos)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public TabularModificationInfos toModificationInfos() {
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.activated(getActivated())
.modificationType(modificationType)
.modifications(modificationsInfos)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public BatteryCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// injection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private void assignAttributes(ConverterStationCreationInfos converterStationCrea
public ConverterStationCreationInfos toConverterStationInfos() {
return ConverterStationCreationInfos.builder()
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// Injection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public GeneratorCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// injection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public LineCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// branch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public LoadCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// injection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public ShuntCompensatorCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// Injection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public SubstationCreationInfos toSubstationCreationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.country(getCountry())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public TwoWindingsTransformerCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
// branch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.substationId(getSubstationId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public VscCreationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.activePowerSetpoint(getActivePowerSetpoint())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public ByFilterDeletionInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.filters(getFilters().stream()
.map(filter -> new FilterInfos(filter.getFilterId(), filter.getName()))
.collect(Collectors.toList()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public EquipmentDeletionInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentType(getEquipmentType());
if (equipmentInfos != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public BatteryModificationInfos toModificationInfos() {
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.activated(getActivated())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Loading

0 comments on commit 00ee3ac

Please sign in to comment.