diff --git a/src/main/java/org/gridsuite/modification/server/NetworkModificationController.java b/src/main/java/org/gridsuite/modification/server/NetworkModificationController.java index cbd654b4f..7742c6811 100644 --- a/src/main/java/org/gridsuite/modification/server/NetworkModificationController.java +++ b/src/main/java/org/gridsuite/modification/server/NetworkModificationController.java @@ -227,7 +227,7 @@ public ResponseEntity> 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 stashNetworkModifications( @@ -242,6 +242,16 @@ public ResponseEntity 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 updateNetworkModificationsActivationStatus( + @Parameter(description = "Network modification UUIDs") @RequestParam("uuids") List 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") diff --git a/src/main/java/org/gridsuite/modification/server/dto/ModificationInfos.java b/src/main/java/org/gridsuite/modification/server/dto/ModificationInfos.java index 4e02d8c3e..d2178532c 100644 --- a/src/main/java/org/gridsuite/modification/server/dto/ModificationInfos.java +++ b/src/main/java/org/gridsuite/modification/server/dto/ModificationInfos.java @@ -100,12 +100,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(); diff --git a/src/main/java/org/gridsuite/modification/server/entities/CompositeModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/CompositeModificationEntity.java index 92ffd839c..dba7c14d5 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/CompositeModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/CompositeModificationEntity.java @@ -44,6 +44,7 @@ public CompositeModificationEntity(@NonNull CompositeModificationInfos composite public CompositeModificationInfos toModificationInfos() { List modificationsInfos = modifications.stream().map(ModificationEntity::toModificationInfos).toList(); return CompositeModificationInfos.builder() + .activated(getActivated()) .date(getDate()) .uuid(getId()) .stashed(getStashed()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/GroovyScriptEntity.java b/src/main/java/org/gridsuite/modification/server/entities/GroovyScriptEntity.java index 367d6d6fc..4e6a4b248 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/GroovyScriptEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/GroovyScriptEntity.java @@ -52,6 +52,7 @@ public GroovyScriptInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .script(getScript()); } } diff --git a/src/main/java/org/gridsuite/modification/server/entities/ModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/ModificationEntity.java index 8cb630068..e6bdb5e20 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/ModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/ModificationEntity.java @@ -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; } @@ -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); } diff --git a/src/main/java/org/gridsuite/modification/server/entities/TabularCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/TabularCreationEntity.java index 16d6e3212..2af5cc1c6 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/TabularCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/TabularCreationEntity.java @@ -55,6 +55,7 @@ public TabularCreationInfos toModificationInfos() { .date(getDate()) .uuid(getId()) .stashed(getStashed()) + .activated(getActivated()) .creationType(creationType) .creations(creationsInfos) .build(); diff --git a/src/main/java/org/gridsuite/modification/server/entities/TabularModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/TabularModificationEntity.java index 80ef6cdd2..32198d70a 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/TabularModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/TabularModificationEntity.java @@ -48,6 +48,7 @@ public TabularModificationInfos toModificationInfos() { .date(getDate()) .uuid(getId()) .stashed(getStashed()) + .activated(getActivated()) .modificationType(modificationType) .modifications(modificationsInfos) .build(); diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java index 2ceb1b7b6..b0bb1836d 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/BatteryCreationEntity.java @@ -112,6 +112,7 @@ public BatteryCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // injection diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java index 46e788e1f..276cbcf3c 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ConverterStationCreationEntity.java @@ -84,6 +84,7 @@ private void assignAttributes(ConverterStationCreationInfos converterStationCrea public ConverterStationCreationInfos toConverterStationInfos() { return ConverterStationCreationInfos.builder() .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // Injection diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java index aaa723f2e..4e0089379 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/GeneratorCreationEntity.java @@ -167,6 +167,7 @@ public GeneratorCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // injection diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java index e614fd1f7..e0985449f 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LineCreationEntity.java @@ -67,6 +67,7 @@ public LineCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // branch diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LoadCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LoadCreationEntity.java index ef8ffb98b..fe6d5ea75 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LoadCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/LoadCreationEntity.java @@ -63,6 +63,7 @@ public LoadCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // injection diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ShuntCompensatorCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ShuntCompensatorCreationEntity.java index 5d0df0eb7..cdbc1567a 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ShuntCompensatorCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/ShuntCompensatorCreationEntity.java @@ -72,6 +72,7 @@ public ShuntCompensatorCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // Injection diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/SubstationCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/SubstationCreationEntity.java index 2c72c2ce3..b00dbe464 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/SubstationCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/SubstationCreationEntity.java @@ -60,6 +60,7 @@ public SubstationCreationInfos toSubstationCreationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) .country(getCountry()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/TwoWindingsTransformerCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/TwoWindingsTransformerCreationEntity.java index 47d830ecc..9cedcf6c5 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/TwoWindingsTransformerCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/TwoWindingsTransformerCreationEntity.java @@ -181,6 +181,7 @@ public TwoWindingsTransformerCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) // branch 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 d3c22c203..f707e1834 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 @@ -96,6 +96,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) .substationId(getSubstationId()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VscCreationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VscCreationEntity.java index b940581e3..b53436969 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VscCreationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/creation/VscCreationEntity.java @@ -111,6 +111,7 @@ public VscCreationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(getEquipmentName()) .activePowerSetpoint(getActivePowerSetpoint()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java index 8f9093db7..60c95c65a 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/ByFilterDeletionEntity.java @@ -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())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/EquipmentDeletionEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/EquipmentDeletionEntity.java index 83416632c..b1196bb0d 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/EquipmentDeletionEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/deletion/EquipmentDeletionEntity.java @@ -60,6 +60,7 @@ public EquipmentDeletionInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentType(getEquipmentType()); if (equipmentInfos != null) { diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java index f4d9b0ff9..bcdd6eb3a 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/BatteryModificationEntity.java @@ -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())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ByFormulaModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ByFormulaModificationEntity.java index 1cbe597ee..384ff94d2 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ByFormulaModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ByFormulaModificationEntity.java @@ -65,6 +65,7 @@ public ByFormulaModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .identifiableType(getIdentifiableType()) .formulaInfosList(getFormulaEntities().stream() .map(FormulaEntity::toFormulaInfos) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java index e05b7e3b2..56bf7fd79 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ConverterStationModificationEntity.java @@ -114,6 +114,7 @@ public ConverterStationModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .lossFactor(toAttributeModification(getLossFactor())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteAttachingLineEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteAttachingLineEntity.java index efc036d63..c2978e241 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteAttachingLineEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteAttachingLineEntity.java @@ -62,6 +62,7 @@ public DeleteAttachingLineInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .lineToAttachTo1Id(getLineToAttachTo1Id()) .lineToAttachTo2Id(getLineToAttachTo2Id()) .attachedLineId(getAttachedLineId()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteVoltageLevelOnLineEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteVoltageLevelOnLineEntity.java index a2a1e1433..af4947aed 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteVoltageLevelOnLineEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/DeleteVoltageLevelOnLineEntity.java @@ -60,6 +60,7 @@ public DeleteVoltageLevelOnLineInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .lineToAttachTo1Id(getLineToAttachTo1Id()) .lineToAttachTo2Id(getLineToAttachTo2Id()) .replacingLine1Id(getReplacingLine1Id()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GenerationDispatchEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GenerationDispatchEntity.java index 9c1a37273..11d31c7f9 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GenerationDispatchEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GenerationDispatchEntity.java @@ -165,6 +165,7 @@ public GenerationDispatchInfos toModificationInfos() { .date(getDate()) .uuid(getId()) .stashed(getStashed()) + .activated(getActivated()) .lossCoefficient(getLossCoefficient()) .defaultOutageRate(getDefaultOutageRate()) .generatorsWithoutOutage(toGeneratorsFilters(generatorsWithoutOutage)) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java index cd67428f5..c25d665a1 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorModificationEntity.java @@ -269,6 +269,7 @@ public GeneratorModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorScalingEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorScalingEntity.java index 6cf5f9b13..019f4dcc5 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorScalingEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/GeneratorScalingEntity.java @@ -36,6 +36,7 @@ public GeneratorScalingInfos toModificationInfos() { .date(getDate()) .uuid(getId()) .stashed(getStashed()) + .activated(getActivated()) .variationType(getVariationType()) .variations(getVariations().stream() .map(ScalingVariationEntity::toScalingVariationInfos) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineAttachToVoltageLevelEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineAttachToVoltageLevelEntity.java index cc020dff1..4d5ff0057 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineAttachToVoltageLevelEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineAttachToVoltageLevelEntity.java @@ -108,6 +108,7 @@ public LineAttachToVoltageLevelInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .lineToAttachToId(getLineToAttachToId()) .percent(getPercent()) .attachmentPointId(getAttachmentPointId()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineModificationEntity.java index 1e2f6f3fb..da4d92024 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineModificationEntity.java @@ -85,6 +85,7 @@ public LineModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .voltageLevelId1(toAttributeModification(getVoltageLevelId1())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineSplitWithVoltageLevelEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineSplitWithVoltageLevelEntity.java index aed711dec..d6b5b35dd 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineSplitWithVoltageLevelEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LineSplitWithVoltageLevelEntity.java @@ -90,6 +90,7 @@ public LineSplitWithVoltageLevelInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .lineToSplitId(getLineToSplitId()) .percent(getPercent()) .mayNewVoltageLevelInfos(mayVoltageLevelCreation == null ? null : mayVoltageLevelCreation.toVoltageLevelCreationInfos()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LinesAttachToSplitLinesEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LinesAttachToSplitLinesEntity.java index da10735cf..cc96f4b6b 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LinesAttachToSplitLinesEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LinesAttachToSplitLinesEntity.java @@ -87,6 +87,7 @@ private LinesAttachToSplitLinesInfos.LinesAttachToSplitLinesInfosBuilder toLines .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .lineToAttachTo1Id(getLineToAttachTo1Id()) .lineToAttachTo2Id(getLineToAttachTo2Id()) .attachedLineId(getAttachedLineId()) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadModificationEntity.java index e1f36eaa1..1e7169825 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadModificationEntity.java @@ -81,6 +81,7 @@ public LoadModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadScalingEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadScalingEntity.java index 6e10551f1..a441f1cb7 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadScalingEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/LoadScalingEntity.java @@ -37,6 +37,7 @@ public LoadScalingInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .variationType(getVariationType()) .variations(getVariations().stream() .map(ScalingVariationEntity::toScalingVariationInfos) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/OperatingStatusModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/OperatingStatusModificationEntity.java index 65b294fbd..5d9678cd6 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/OperatingStatusModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/OperatingStatusModificationEntity.java @@ -54,6 +54,7 @@ public OperatingStatusModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .action(getAction()) .energizedVoltageLevelId(getEnergizedVoltageLevelId()); diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ShuntCompensatorModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ShuntCompensatorModificationEntity.java index 4854b0bd6..47315d4c2 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ShuntCompensatorModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/ShuntCompensatorModificationEntity.java @@ -104,6 +104,7 @@ public ShuntCompensatorModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/SubstationModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/SubstationModificationEntity.java index cd563eba2..88bef118f 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/SubstationModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/SubstationModificationEntity.java @@ -55,6 +55,7 @@ public SubstationModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .country(AttributeModification.toAttributeModification(getCountry(), getCountryOp())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/TwoWindingsTransformerModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/TwoWindingsTransformerModificationEntity.java index a4dad38dc..95e106e2f 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/TwoWindingsTransformerModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/TwoWindingsTransformerModificationEntity.java @@ -352,6 +352,7 @@ public TwoWindingsTransformerModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .voltageLevelId1(toAttributeModification(getVoltageLevelId1())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageInitModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageInitModificationEntity.java index 0e489860b..0868673ff 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageInitModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageInitModificationEntity.java @@ -180,6 +180,7 @@ public VoltageInitModificationInfos toModificationInfos() { .date(getDate()) .uuid(getId()) .stashed(getStashed()) + .activated(getActivated()) .generators(toGeneratorsModification(generators)) .transformers(toTransformersModification(transformers)) .staticVarCompensators(toStaticVarCompensatorsModification(staticVarCompensators)) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageLevelModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageLevelModificationEntity.java index 11542ab1c..1c3c3094d 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageLevelModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VoltageLevelModificationEntity.java @@ -101,6 +101,7 @@ public VoltageLevelModificationInfos toModificationInfos() { .equipmentId(getEquipmentId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .nominalV(toAttributeModification(getNominalV())) .lowVoltageLimit(toAttributeModification(getLowVoltageLimit())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VscModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VscModificationEntity.java index 81a33f5f0..907c99285 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VscModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/VscModificationEntity.java @@ -147,6 +147,7 @@ private void assignAttributes(@NonNull VscModificationInfos vscModificationInfos .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp())) .nominalV(toAttributeModification(getNominalV())) diff --git a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/attribute/EquipmentAttributeModificationEntity.java b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/attribute/EquipmentAttributeModificationEntity.java index 548fba5e2..c1e59f59b 100644 --- a/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/attribute/EquipmentAttributeModificationEntity.java +++ b/src/main/java/org/gridsuite/modification/server/entities/equipment/modification/attribute/EquipmentAttributeModificationEntity.java @@ -70,6 +70,7 @@ public EquipmentAttributeModificationInfos toModificationInfos() { .uuid(getId()) .date(getDate()) .stashed(getStashed()) + .activated(getActivated()) .equipmentId(getEquipmentId()) .equipmentAttributeName(getAttributeName()) .equipmentAttributeValue(getAttributeValue()) diff --git a/src/main/java/org/gridsuite/modification/server/modifications/NetworkModificationApplicator.java b/src/main/java/org/gridsuite/modification/server/modifications/NetworkModificationApplicator.java index 5b50d029e..b5c04dbfe 100644 --- a/src/main/java/org/gridsuite/modification/server/modifications/NetworkModificationApplicator.java +++ b/src/main/java/org/gridsuite/modification/server/modifications/NetworkModificationApplicator.java @@ -166,6 +166,7 @@ private ApplicationStatus apply(List modificationInfosList, N reportNode = ReportNode.NO_OP; } ApplicationStatus groupApplicationStatus = modificationInfosList.stream() + .filter(ModificationInfos::getActivated) .map(m -> apply(m, network, reportNode)) .reduce(ApplicationStatus::max) .orElse(ApplicationStatus.ALL_OK); diff --git a/src/main/java/org/gridsuite/modification/server/repositories/ModificationRepository.java b/src/main/java/org/gridsuite/modification/server/repositories/ModificationRepository.java index ed3df2aed..0fcc0a061 100644 --- a/src/main/java/org/gridsuite/modification/server/repositories/ModificationRepository.java +++ b/src/main/java/org/gridsuite/modification/server/repositories/ModificationRepository.java @@ -29,7 +29,7 @@ public interface ModificationRepository extends JpaRepository findAllBaseByGroupId(UUID uuid); @Query(value = "SELECT new ModificationEntity(m.id, m.type) FROM ModificationEntity m WHERE m.id IN (?1)") diff --git a/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java b/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java index b3b6c47a8..b7a02ed30 100644 --- a/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java +++ b/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java @@ -241,6 +241,7 @@ public TabularModificationInfos loadTabularModificationSubEntities(ModificationE .uuid(tabularModificationEntity.getId()) .date(tabularModificationEntity.getDate()) .stashed(tabularModificationEntity.getStashed()) + .activated(tabularModificationEntity.getActivated()) .modificationType(tabularModificationEntity.getModificationType()) .modifications(orderedGeneratorModifications.stream().map(GeneratorModificationEntity::toModificationInfos).map(m -> (ModificationInfos) m).toList()) .build(); @@ -409,6 +410,16 @@ public void restoreNetworkModifications(@NonNull List modificationUuids) { } } + @Transactional + public void updateNetworkModificationsActivation(@NonNull List modificationUuids, boolean activated) { + for (UUID modificationUuid : modificationUuids) { + ModificationEntity modificationEntity = this.modificationRepository + .findById(modificationUuid) + .orElseThrow(() -> new NetworkModificationException(MODIFICATION_NOT_FOUND, String.format(MODIFICATION_NOT_FOUND_MESSAGE, modificationUuid))); + modificationEntity.setActivated(activated); + } + } + @Transactional public void updateModification(@NonNull UUID modificationUuid, @NonNull ModificationInfos modificationInfos) { this.modificationRepository diff --git a/src/main/java/org/gridsuite/modification/server/service/NetworkModificationService.java b/src/main/java/org/gridsuite/modification/server/service/NetworkModificationService.java index d32b2a3b8..b4d59cf76 100644 --- a/src/main/java/org/gridsuite/modification/server/service/NetworkModificationService.java +++ b/src/main/java/org/gridsuite/modification/server/service/NetworkModificationService.java @@ -112,6 +112,11 @@ public void updateNetworkModification(@NonNull UUID modificationUuid, @NonNull M networkModificationRepository.updateModification(modificationUuid, modificationInfos); } + @Transactional + public void updateNetworkModificationActivation(@NonNull List modificationUuids, boolean activated) { + networkModificationRepository.updateNetworkModificationsActivation(modificationUuids, activated); + } + @Transactional public void stashNetworkModifications(@NonNull List modificationUuids) { networkModificationRepository.stashNetworkModifications(modificationUuids); diff --git a/src/main/resources/db/changelog/changesets/changelog_20240829T071248Z.xml b/src/main/resources/db/changelog/changesets/changelog_20240829T071248Z.xml new file mode 100644 index 000000000..d960b38ce --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20240829T071248Z.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 119fcf59e..32b8d57e2 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -303,6 +303,9 @@ databaseChangeLog: - include: file: changesets/changelog_20240703T170634Z.xml relativeToChangelogFile: true + - include: + file: changesets/changelog_20240829T071248Z.xml + relativeToChangelogFile: true - include: file: changesets/changelog_20240904T211456Z.xml relativeToChangelogFile: true \ No newline at end of file diff --git a/src/test/java/org/gridsuite/modification/server/ModificationControllerTest.java b/src/test/java/org/gridsuite/modification/server/ModificationControllerTest.java index b2028a7af..9cef9cf90 100644 --- a/src/test/java/org/gridsuite/modification/server/ModificationControllerTest.java +++ b/src/test/java/org/gridsuite/modification/server/ModificationControllerTest.java @@ -63,6 +63,7 @@ import static org.gridsuite.modification.server.utils.TestUtils.assertLogMessage; import static org.gridsuite.modification.server.utils.assertions.Assertions.assertThat; import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.when; @@ -337,6 +338,36 @@ public void testStashNetworkModifications() throws Exception { assertEquals(true, modificationRepository.getModificationInfo(UUID.fromString(uuidString)).getStashed()); } + @Test + public void testDisableNetworkModifications() throws Exception { + MvcResult mvcResult; + EquipmentAttributeModificationInfos switchStatusModificationInfos = EquipmentAttributeModificationInfos.builder() + .equipmentType(IdentifiableType.SWITCH) + .equipmentAttributeName("open") + .equipmentAttributeValue(true) + .equipmentId("v1b1") + .stashed(false) + .activated(true) + .build(); + String switchStatusModificationInfosJson = objectWriter.writeValueAsString(switchStatusModificationInfos); + + mvcResult = mockMvc.perform(post(URI_NETWORK_MODIF).content(switchStatusModificationInfosJson).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andReturn(); + assertApplicationStatusOK(mvcResult); + testElementModificationImpact(mapper, mvcResult.getResponse().getContentAsString(), IdentifiableType.SWITCH, "v1b1", Set.of("s1")); + + List modifications = modificationRepository.getModifications(TEST_GROUP_ID, true, true); + assertEquals(1, modifications.size()); + assertEquals(true, modifications.get(0).getActivated()); + + String uuidString = modifications.get(0).getUuid().toString(); + mockMvc.perform(put(URI_NETWORK_MODIF_BASE) + .queryParam("groupUuid", TEST_GROUP_ID.toString()) + .queryParam("uuids", uuidString) + .queryParam("activated", "false")) + .andExpect(status().isOk()); + assertEquals(false, modificationRepository.getModifications(TEST_GROUP_ID, true, true).get(0).getActivated()); + } + @Test public void testDeleteModification() throws Exception { MvcResult mvcResult; diff --git a/src/test/java/org/gridsuite/modification/server/modifications/AbstractNetworkModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/AbstractNetworkModificationTest.java index 10b87cf23..762887f07 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/AbstractNetworkModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/AbstractNetworkModificationTest.java @@ -48,7 +48,6 @@ import java.util.UUID; import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; -import static org.gridsuite.modification.server.utils.assertions.Assertions.*; import static org.gridsuite.modification.server.utils.assertions.Assertions.assertThat; import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; @@ -155,6 +154,32 @@ public void testCreate() throws Exception { testCreationModificationMessage(createdModificationWithOnlyMetadata); } + @Test + public void testCreateDisabledModification() throws Exception { + MvcResult mvcResult; + Optional networkModificationResult; + ModificationInfos modificationToCreate = buildModification(); + modificationToCreate.setActivated(false); + String modificationToCreateJson = mapper.writeValueAsString(modificationToCreate); + + mvcResult = mockMvc.perform(post(getNetworkModificationUri()).content(modificationToCreateJson).contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()).andReturn(); + networkModificationResult = mapper.readValue(mvcResult.getResponse().getContentAsString(), new TypeReference<>() { }); + assertTrue(networkModificationResult.isPresent()); + assertEquals(0, networkModificationResult.get().getNetworkImpacts().size()); + assertNotEquals(NetworkModificationResult.ApplicationStatus.WITH_ERRORS, networkModificationResult.get().getApplicationStatus()); + ModificationInfos createdModification = modificationRepository.getModifications(TEST_GROUP_ID, false, true).get(0); + + assertThat(createdModification).recursivelyEquals(modificationToCreate); + testNetworkModificationsCount(TEST_GROUP_ID, 1); + // when modification is not active, element created by the modifications should NOT be present in network + assertAfterNetworkModificationDeletion(); + + ModificationInfos createdModificationWithOnlyMetadata = modificationRepository.getModifications(TEST_GROUP_ID, true, true).get(0); + testCreationModificationMessage(createdModificationWithOnlyMetadata); + assertEquals(false, createdModificationWithOnlyMetadata.getActivated()); + } + @Test public void testRead() throws Exception { MvcResult mvcResult; diff --git a/src/test/java/org/gridsuite/modification/server/modifications/EquipmentAttributeModificationTest.java b/src/test/java/org/gridsuite/modification/server/modifications/EquipmentAttributeModificationTest.java index 12a20da28..d39010881 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/EquipmentAttributeModificationTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/EquipmentAttributeModificationTest.java @@ -51,7 +51,7 @@ public void testEquipmentAttributeModificationInfos() throws Exception { .equipmentAttributeValue("equipmentAttributeValue") .equipmentType(IdentifiableType.VOLTAGE_LEVEL) .build(); - assertEquals(String.format("EquipmentAttributeModificationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=%s, type=EQUIPMENT_ATTRIBUTE_MODIFICATION, date=2021-02-19T00:00:00Z, stashed=false, messageType=null, messageValues=null), equipmentId=equipmentId, properties=null), equipmentAttributeName=equipmentAttributeName, equipmentAttributeValue=equipmentAttributeValue, equipmentType=VOLTAGE_LEVEL)", modificationUuid), modificationInfos.toString()); + assertEquals(String.format("EquipmentAttributeModificationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=%s, type=EQUIPMENT_ATTRIBUTE_MODIFICATION, date=2021-02-19T00:00:00Z, stashed=false, messageType=null, messageValues=null, activated=true), equipmentId=equipmentId, properties=null), equipmentAttributeName=equipmentAttributeName, equipmentAttributeValue=equipmentAttributeValue, equipmentType=VOLTAGE_LEVEL)", modificationUuid), modificationInfos.toString()); EquipmentAttributeModificationInfos switchStatusModificationInfos = EquipmentAttributeModificationInfos.builder() .stashed(false) diff --git a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorScalingTest.java b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorScalingTest.java index ba9bd601f..6b33c21b4 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/GeneratorScalingTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/GeneratorScalingTest.java @@ -140,7 +140,7 @@ public void testCreate() throws Exception { wireMockUtils.verifyGetRequest(stubId, PATH, handleQueryParams(filters.stream().map(AbstractFilter::getId).collect(Collectors.toList())), false); assertEquals( - String.format("ScalingInfos(super=ModificationInfos(uuid=null, type=GENERATOR_SCALING, date=null, stashed=false, messageType=null, messageValues=null), variations=[ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter1)], variationMode=PROPORTIONAL_TO_PMAX, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter2)], variationMode=REGULAR_DISTRIBUTION, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter3)], variationMode=STACKING_UP, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter4)], variationMode=VENTILATION, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter1), FilterInfos(id=%s, name=filter5)], variationMode=PROPORTIONAL, variationValue=50.0, reactiveVariationMode=null)], variationType=DELTA_P)", + String.format("ScalingInfos(super=ModificationInfos(uuid=null, type=GENERATOR_SCALING, date=null, stashed=false, messageType=null, messageValues=null, activated=true), variations=[ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter1)], variationMode=PROPORTIONAL_TO_PMAX, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter2)], variationMode=REGULAR_DISTRIBUTION, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter3)], variationMode=STACKING_UP, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter4)], variationMode=VENTILATION, variationValue=50.0, reactiveVariationMode=null), ScalingVariationInfos(id=null, filters=[FilterInfos(id=%s, name=filter1), FilterInfos(id=%s, name=filter5)], variationMode=PROPORTIONAL, variationValue=50.0, reactiveVariationMode=null)], variationType=DELTA_P)", FILTER_ID_1, FILTER_ID_2, FILTER_ID_3, FILTER_ID_4, FILTER_ID_1, FILTER_ID_5), buildModification().toString() ); diff --git a/src/test/java/org/gridsuite/modification/server/modifications/LineCreationInNodeBreakerTest.java b/src/test/java/org/gridsuite/modification/server/modifications/LineCreationInNodeBreakerTest.java index 3eaca987e..4e2b59e9c 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/LineCreationInNodeBreakerTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/LineCreationInNodeBreakerTest.java @@ -227,7 +227,7 @@ public void testCreateLineWithBothCurrentLimits() throws Exception { testNetworkModificationsCount(getGroupId(), 1); assertEquals( - "LineCreationInfos(super=BranchCreationInfos(super=EquipmentCreationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=null, type=LINE_CREATION, date=null, stashed=false, messageType=null, messageValues=null), equipmentId=idLineEdited, properties=null), equipmentName=nameLineEdited), r=110.0, x=110.0, voltageLevelId1=v2, voltageLevelId2=v1, busOrBusbarSectionId1=1A, busOrBusbarSectionId2=1.1, currentLimits1=CurrentLimitsInfos(permanentLimit=200.0, temporaryLimits=[CurrentTemporaryLimitCreationInfos(name=IT10, value=200.0, acceptableDuration=600)]), currentLimits2=CurrentLimitsInfos(permanentLimit=100.0, temporaryLimits=[CurrentTemporaryLimitCreationInfos(name=IT20, value=600.0, acceptableDuration=1200)]), connectionName1=cn1LineEdited, connectionDirection1=BOTTOM, connectionName2=cn2LineEdited, connectionDirection2=TOP, connectionPosition1=0, connectionPosition2=0, connected1=true, connected2=false), g1=15.0, b1=15.0, g2=25.0, b2=25.0)", + "LineCreationInfos(super=BranchCreationInfos(super=EquipmentCreationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=null, type=LINE_CREATION, date=null, stashed=false, messageType=null, messageValues=null, activated=true), equipmentId=idLineEdited, properties=null), equipmentName=nameLineEdited), r=110.0, x=110.0, voltageLevelId1=v2, voltageLevelId2=v1, busOrBusbarSectionId1=1A, busOrBusbarSectionId2=1.1, currentLimits1=CurrentLimitsInfos(permanentLimit=200.0, temporaryLimits=[CurrentTemporaryLimitCreationInfos(name=IT10, value=200.0, acceptableDuration=600)]), currentLimits2=CurrentLimitsInfos(permanentLimit=100.0, temporaryLimits=[CurrentTemporaryLimitCreationInfos(name=IT20, value=600.0, acceptableDuration=1200)]), connectionName1=cn1LineEdited, connectionDirection1=BOTTOM, connectionName2=cn2LineEdited, connectionDirection2=TOP, connectionPosition1=0, connectionPosition2=0, connected1=true, connected2=false), g1=15.0, b1=15.0, g2=25.0, b2=25.0)", lineCreation.toString() ); } diff --git a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerCreationNodeBreakerTest.java b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerCreationNodeBreakerTest.java index 313518a8e..c96fa21e2 100644 --- a/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerCreationNodeBreakerTest.java +++ b/src/test/java/org/gridsuite/modification/server/modifications/TwoWindingsTransformerCreationNodeBreakerTest.java @@ -344,7 +344,7 @@ public void testCreateTwoWindingsTransformerWithRatioTapChangerInNodeBreaker() t testCreateTwoWindingsTransformerInNodeBreaker(twoWindingsTransformerCreationInfos2, 2); assertEquals( - "TwoWindingsTransformerCreationInfos(super=BranchCreationInfos(super=EquipmentCreationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=null, type=TWO_WINDINGS_TRANSFORMER_CREATION, date=null, stashed=false, messageType=null, messageValues=null), equipmentId=id2wt1WithRatioTapChanger2, properties=null), equipmentName=2wtName), r=400.0, x=300.0, voltageLevelId1=v1, voltageLevelId2=v4, busOrBusbarSectionId1=1.1, busOrBusbarSectionId2=1.A, currentLimits1=null, currentLimits2=null, connectionName1=null, connectionDirection1=TOP, connectionName2=null, connectionDirection2=TOP, connectionPosition1=null, connectionPosition2=null, connected1=true, connected2=true), g=100.0, b=200.0, ratedU1=1000.0, ratedU2=1010.0, ratedS=null, ratioTapChanger=RatioTapChangerCreationInfos(super=TapChangerCreationInfos(lowTapPosition=0, tapPosition=1, regulating=true, targetDeadband=null, regulatingTerminalId=v1load, regulatingTerminalType=LOAD, regulatingTerminalVlId=v1, steps=[TapChangerStepCreationInfos(index=0, rho=1.0, r=39.78473, x=39.784725, g=0.0, b=0.0, alpha=0.0), TapChangerStepCreationInfos(index=0, rho=1.0, r=39.78474, x=39.784726, g=0.0, b=0.0, alpha=0.0), TapChangerStepCreationInfos(index=0, rho=1.0, r=39.78475, x=39.784727, g=0.0, b=0.0, alpha=0.0)]), loadTapChangingCapabilities=true, targetV=220.0), phaseTapChanger=null)", + "TwoWindingsTransformerCreationInfos(super=BranchCreationInfos(super=EquipmentCreationInfos(super=EquipmentModificationInfos(super=ModificationInfos(uuid=null, type=TWO_WINDINGS_TRANSFORMER_CREATION, date=null, stashed=false, messageType=null, messageValues=null, activated=true), equipmentId=id2wt1WithRatioTapChanger2, properties=null), equipmentName=2wtName), r=400.0, x=300.0, voltageLevelId1=v1, voltageLevelId2=v4, busOrBusbarSectionId1=1.1, busOrBusbarSectionId2=1.A, currentLimits1=null, currentLimits2=null, connectionName1=null, connectionDirection1=TOP, connectionName2=null, connectionDirection2=TOP, connectionPosition1=null, connectionPosition2=null, connected1=true, connected2=true), g=100.0, b=200.0, ratedU1=1000.0, ratedU2=1010.0, ratedS=null, ratioTapChanger=RatioTapChangerCreationInfos(super=TapChangerCreationInfos(lowTapPosition=0, tapPosition=1, regulating=true, targetDeadband=null, regulatingTerminalId=v1load, regulatingTerminalType=LOAD, regulatingTerminalVlId=v1, steps=[TapChangerStepCreationInfos(index=0, rho=1.0, r=39.78473, x=39.784725, g=0.0, b=0.0, alpha=0.0), TapChangerStepCreationInfos(index=0, rho=1.0, r=39.78474, x=39.784726, g=0.0, b=0.0, alpha=0.0), TapChangerStepCreationInfos(index=0, rho=1.0, r=39.78475, x=39.784727, g=0.0, b=0.0, alpha=0.0)]), loadTapChangingCapabilities=true, targetV=220.0), phaseTapChanger=null)", twoWindingsTransformerCreationInfos2.toString() );