Skip to content

Commit

Permalink
set stashed status for all modifications (#346)
Browse files Browse the repository at this point in the history
* fix: set correct value of stashed field

Signed-off-by: jamal-khey <[email protected]>
  • Loading branch information
jamal-khey authored Nov 6, 2023
1 parent 8d9fe7e commit e916316
Show file tree
Hide file tree
Showing 81 changed files with 181 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public GroovyScriptInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.script(getScript());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected ModificationEntity(ModificationInfos modificationInfos) {
}
//We need to limit the precision to avoid database precision storage limit issue (postgres has a precision of 6 digits while h2 can go to 9)
this.date = ZonedDateTime.now(ZoneOffset.UTC).truncatedTo(ChronoUnit.MICROS);

this.stashed = modificationInfos.getStashed();
assignAttributes(modificationInfos);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public BatteryCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ private void assignAttributes(ConverterStationCreationInfos converterStationCrea

public ConverterStationCreationInfos toConverterStationInfos() {
return ConverterStationCreationInfos.builder()
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.lossFactor(getLossFactor())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public GeneratorCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public LineCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.seriesResistance(getSeriesResistance())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public LoadCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public ShuntCompensatorCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.voltageLevelId(getVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public SubstationCreationInfos toSubstationCreationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.substationCountry(getCountry())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public TwoWindingsTransformerCreationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.seriesResistance(getSeriesResistance())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public VoltageLevelCreationInfos toModificationInfos() {
}

public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
return toVoltageLevelCreationInfosBuilder().build();
return toVoltageLevelCreationInfosBuilder()
.build();
}

private VoltageLevelCreationInfos.VoltageLevelCreationInfosBuilder<?, ?> toVoltageLevelCreationInfosBuilder() {
Expand All @@ -92,6 +93,7 @@ public VoltageLevelCreationInfos toVoltageLevelCreationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.substationId(getSubstationId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public VscCreationInfos toModificationInfos() {
private VscCreationInfos.VscCreationInfosBuilder<?, ?> toVscCreationInfosBuilder() {
ConverterStationCreationInfos converterStationCreationInfos1 = getConverterStation1() == null ? null : getConverterStation1().toConverterStationInfos();
ConverterStationCreationInfos converterStationCreationInfos2 = getConverterStation2() == null ? null : getConverterStation2().toConverterStationInfos();

return VscCreationInfos.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(getEquipmentName())
.activePower(getActivePower())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public EquipmentDeletionInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentType(getEquipmentType());
if (equipmentInfos != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public BatteryModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public BranchStatusModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.action(getAction())
.energizedVoltageLevelId(getEnergizedVoltageLevelId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public DeleteAttachingLineInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachTo1Id(getLineToAttachTo1Id())
.lineToAttachTo2Id(getLineToAttachTo2Id())
.attachedLineId(getAttachedLineId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public DeleteVoltageLevelOnLineInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachTo1Id(getLineToAttachTo1Id())
.lineToAttachTo2Id(getLineToAttachTo2Id())
.replacingLine1Id(getReplacingLine1Id())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public GenerationDispatchInfos toModificationInfos() {
return GenerationDispatchInfos.builder()
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.lossCoefficient(getLossCoefficient())
.defaultOutageRate(getDefaultOutageRate())
.generatorsWithoutOutage(toGeneratorsFilters(generatorsWithoutOutage))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ public GeneratorModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public GeneratorScalingInfos toModificationInfos() {
return GeneratorScalingInfos.builder()
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.variationType(getVariationType())
.variations(getVariations().stream()
.map(ScalingVariationEntity::toScalingVariationInfos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public LineAttachToVoltageLevelInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachToId(getLineToAttachToId())
.percent(getPercent())
.attachmentPointId(getAttachmentPointId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public LineModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.seriesResistance(toAttributeModification(getSeriesResistance()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public LineSplitWithVoltageLevelInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToSplitId(getLineToSplitId())
.percent(getPercent())
.mayNewVoltageLevelInfos(mayVoltageLevelCreation == null ? null : mayVoltageLevelCreation.toVoltageLevelCreationInfos())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ private LinesAttachToSplitLinesInfos.LinesAttachToSplitLinesInfosBuilder toLines
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.lineToAttachTo1Id(getLineToAttachTo1Id())
.lineToAttachTo2Id(getLineToAttachTo2Id())
.attachedLineId(getAttachedLineId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public LoadModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.voltageLevelId(AttributeModification.toAttributeModification(getVoltageLevelIdValue(), getVoltageLevelIdOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public LoadScalingInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.variationType(getVariationType())
.variations(getVariations().stream()
.map(ScalingVariationEntity::toScalingVariationInfos)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public ShuntCompensatorModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.voltageLevelId(getVoltageLevelId())
.equipmentId(getEquipmentId())
.equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public SubstationModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.substationCountry(AttributeModification.toAttributeModification(getSubstationCountryValue(), getSubstationCountryOp()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ public TwoWindingsTransformerModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentName(AttributeModification.toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.seriesResistance(AttributeModification.toAttributeModification(getSeriesResistance()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public VoltageInitModificationInfos toModificationInfos() {
return VoltageInitModificationInfos.builder()
.date(getDate())
.uuid(getId())
.stashed(getStashed())
.generators(toGeneratorsModification(generators))
.transformers(toTransformersModification(transformers))
.staticVarCompensators(toStaticVarCompensatorsModification(staticVarCompensators))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public VoltageLevelModificationInfos toModificationInfos() {
.uuid(getId())
.equipmentId(getEquipmentId())
.date(getDate())
.stashed(getStashed())
.equipmentName(toAttributeModification(getEquipmentNameValue(), getEquipmentNameOp()))
.nominalVoltage(toAttributeModification(getNominalVoltage()))
.lowVoltageLimit(toAttributeModification(getLowVoltageLimit()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public EquipmentAttributeModificationInfos toModificationInfos() {
.builder()
.uuid(getId())
.date(getDate())
.stashed(getStashed())
.equipmentId(getEquipmentId())
.equipmentAttributeName(getAttributeName())
.equipmentAttributeValue(getAttributeValue())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ public void testGetLineTypesCatalog() throws Exception {
public void testCreateVoltageInitModification() throws Exception {
// Create the modification
VoltageInitModificationInfos modificationsInfos1 = VoltageInitModificationInfos.builder()
.stashed(false)
.generators(List.of(
VoltageInitGeneratorModificationInfos.builder()
.generatorId("G1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery2")
.equipmentName("nameBattery2")
.voltageLevelId("v1")
Expand All @@ -64,6 +65,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery2Edited")
.equipmentName("nameBatteryModified")
.voltageLevelId("v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected Network createNetwork(UUID networkUuid) {
protected ModificationInfos buildModification() {
// create new battery in voltage level with node/breaker topology (in voltage level "v2" and busbar section "1B")
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery1")
.equipmentName("idBattery1")
.voltageLevelId("v2")
Expand All @@ -68,6 +69,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BatteryCreationInfos.builder()
.stashed(false)
.equipmentId("idBattery2Edited")
.equipmentName("nameBatteryModified")
.voltageLevelId("v1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BatteryModificationInfos.builder()
.stashed(false)
.equipmentId("v3Battery")
.equipmentName(new AttributeModification<>("newV1Battery", OperationType.SET))
.activePowerSetpoint(new AttributeModification<>(80.0, OperationType.SET))
Expand All @@ -58,6 +59,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BatteryModificationInfos.builder()
.stashed(false)
.equipmentId("idBatteryEdited")
.equipmentName(new AttributeModification<>("newV1BatteryEdited", OperationType.SET))
.activePowerSetpoint(new AttributeModification<>(81.0, OperationType.SET))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.energizedVoltageLevelId("vl1")
.action(BranchStatusModificationInfos.ActionType.ENERGISE_END_ONE).build();
Expand All @@ -55,6 +56,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId("line1")
.energizedVoltageLevelId("vl1_bis")
.action(BranchStatusModificationInfos.ActionType.TRIP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.energizedVoltageLevelId("vl2")
.action(BranchStatusModificationInfos.ActionType.ENERGISE_END_TWO).build();
Expand All @@ -55,6 +56,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId("line1")
.energizedVoltageLevelId("vl2_bis")
.action(BranchStatusModificationInfos.ActionType.TRIP).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.energizedVoltageLevelId("energizedVoltageLevelId")
.action(BranchStatusModificationInfos.ActionType.LOCKOUT).build();
Expand All @@ -59,6 +60,7 @@ protected ModificationInfos buildModification() {
@Override
protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(UPDATE_BRANCH_ID)
.energizedVoltageLevelId("energizedVoltageLevelId")
.action(BranchStatusModificationInfos.ActionType.SWITCH_ON).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ protected Network createNetwork(UUID networkUuid) {
@Override
protected ModificationInfos buildModification() {
return BranchStatusModificationInfos.builder()
.stashed(false)
.equipmentId(TARGET_LINE_ID)
.energizedVoltageLevelId("energizedVoltageLevelId")
.action(BranchStatusModificationInfos.ActionType.SWITCH_ON).build();
Expand All @@ -51,6 +52,7 @@ protected ModificationInfos buildModificationUpdate() {
return BranchStatusModificationInfos.builder()
.equipmentId("line1Edited")
.energizedVoltageLevelId("energizedVoltageLevelIdEdited")
.stashed(false)
.action(BranchStatusModificationInfos.ActionType.TRIP).build();
}

Expand Down
Loading

0 comments on commit e916316

Please sign in to comment.