Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize temporary and permanent limits db writings and db reading #82

Merged
merged 66 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
031bc5c
optimize temporary limits db writings and db reading
EtienneLt Nov 21, 2024
db4983e
replace array sql type by jackson text
EtienneLt Nov 22, 2024
0287fd3
fix
EtienneLt Nov 22, 2024
b3889a9
fix
EtienneLt Nov 22, 2024
778429a
disable sonar on migration package
EtienneLt Nov 22, 2024
d611ece
fix
EtienneLt Nov 22, 2024
4847027
log temporary limits insertion
EtienneLt Nov 28, 2024
d0319e5
refactor permanent limit too and clean
EtienneLt Nov 29, 2024
38ffe4c
exclude sonar duplication for migrations server
EtienneLt Nov 29, 2024
45bbcec
fix disable duplication on migrations
EtienneLt Nov 29, 2024
5a4efb2
Merge branch 'main' into optimize-temporarylimits-in-db
EtienneLt Nov 29, 2024
ba52b95
fix sonar
EtienneLt Nov 29, 2024
042ee22
review and fixes
EtienneLt Dec 3, 2024
bb527ff
fix sonar
EtienneLt Dec 5, 2024
07e71b7
add index
EtienneLt Dec 5, 2024
78bdf52
fix index
EtienneLt Dec 5, 2024
e434daa
change java migration to sql migration
EtienneLt Dec 6, 2024
4bd3ce4
refactor and annd transfer method when getting
EtienneLt Dec 12, 2024
577bdad
fix and migrate in java
EtienneLt Dec 13, 2024
7547a85
fix
EtienneLt Dec 13, 2024
3758ae5
Migration endpoint + java changeset (not working) + reorganize limits…
etiennehomer Dec 31, 2024
e033295
clean
etiennehomer Dec 31, 2024
ce59bb4
Merge branch 'main' into optimize-temporarylimits-in-db
EtienneLt Jan 6, 2025
8168f22
Build NetworkStoreRepository bean in migration class
etiennehomer Jan 7, 2025
e3ee705
exclude migration package from coverage
etiennehomer Jan 7, 2025
d7ef98c
move MigrationController + move sonar exclusion property
etiennehomer Jan 7, 2025
d430611
Clean MigrationController
etiennehomer Jan 7, 2025
eb0e117
Merge branch 'main' into optimize-temporarylimits-in-db
etiennehomer Jan 7, 2025
0e0947d
Fix sonar exclusion
etiennehomer Jan 7, 2025
8ef0f55
Fix sonar exclusion
etiennehomer Jan 7, 2025
0dca16c
Add test for migration + clean licence and author + put V211 methods …
etiennehomer Jan 8, 2025
22bb345
Sonar fixes + rename
etiennehomer Jan 9, 2025
fcacba6
End of migration test
etiennehomer Jan 9, 2025
e8809bd
improve logs + remove java changeset from changelog
etiennehomer Jan 9, 2025
9220880
Fix migration
etiennehomer Jan 9, 2025
465719d
No on the fly migration
etiennehomer Jan 9, 2025
8ed5c71
FIX
etiennehomer Jan 10, 2025
aefea20
Fix migration test
etiennehomer Jan 10, 2025
33821aa
Enrich test
etiennehomer Jan 10, 2025
53150ca
clean
etiennehomer Jan 10, 2025
f25eb73
Clean
etiennehomer Jan 10, 2025
4e82707
Rename tables
etiennehomer Jan 10, 2025
7a74234
Clean
etiennehomer Jan 10, 2025
bbfbf82
clean
etiennehomer Jan 10, 2025
e76302b
Clean
etiennehomer Jan 10, 2025
671aa1a
Do no exclude migration from coverage
etiennehomer Jan 13, 2025
a7d1017
Exclude migration again from coverage
etiennehomer Jan 13, 2025
5befc61
Refacto for minimum changes in PR
etiennehomer Jan 13, 2025
22c2cef
Refacto for minimum changes in PR 2
etiennehomer Jan 13, 2025
2efa9d0
Refacto for minimum changes in PR 3
etiennehomer Jan 13, 2025
06ff49c
Refacto for minimum changes in PR 4
etiennehomer Jan 13, 2025
217b588
Refacto for minimum changes in PR 5
etiennehomer Jan 13, 2025
c7b4603
Migrate by networkId and variantNum
etiennehomer Jan 13, 2025
e80880e
Clean
etiennehomer Jan 13, 2025
25338ea
CLean
etiennehomer Jan 13, 2025
4329dd7
CLean
etiennehomer Jan 13, 2025
2aa4960
Fix clone v211 limits + fix delete network + clean up
etiennehomer Jan 14, 2025
3562463
Remove comments
etiennehomer Jan 14, 2025
4136d90
Rename v211limits package
etiennehomer Jan 14, 2025
9809102
Improve migration logs
etiennehomer Jan 14, 2025
b066133
Merge branch 'main' into optimize-temporarylimits-in-db
etiennehomer Jan 15, 2025
0b61119
Clean
etiennehomer Jan 15, 2025
74178ef
Manage exceptions of execute()
etiennehomer Jan 15, 2025
f295e08
Fix sonar warnings
etiennehomer Jan 15, 2025
5c70460
Remove logger in catch
etiennehomer Jan 15, 2025
85cc31c
Clean
etiennehomer Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion network-store-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,36 @@
*/
public final class QueryCatalog {

static final String MINIMAL_VALUE_REQUIREMENT_ERROR = "Function should not be called without at least one value.";
public static final String MINIMAL_VALUE_REQUIREMENT_ERROR = "Function should not be called without at least one value.";

static final String VARIANT_ID_COLUMN = "variantId";
static final String UUID_COLUMN = "uuid";
static final String NETWORK_UUID_COLUMN = "networkUuid";
static final String VARIANT_NUM_COLUMN = "variantNum";
public static final String NETWORK_UUID_COLUMN = "networkUuid";
public static final String VARIANT_NUM_COLUMN = "variantNum";
static final String ID_COLUMN = "id";
static final String VOLTAGE_LEVEL_ID_COLUMN = "voltageLevelId";
static final String VOLTAGE_LEVEL_ID_1_COLUMN = "voltageLevelId1";
static final String VOLTAGE_LEVEL_ID_2_COLUMN = "voltageLevelId2";
static final String VOLTAGE_LEVEL_ID_3_COLUMN = "voltageLevelId3";
static final String NAME_COLUMN = "name";
static final String EQUIPMENT_TYPE_COLUMN = "equipmentType";
public static final String NAME_COLUMN = "name";
public static final String EQUIPMENT_TYPE_COLUMN = "equipmentType";
static final String REGULATING_EQUIPMENT_TYPE_COLUMN = "regulatingEquipmentType";
static final String REGULATED_EQUIPMENT_TYPE_COLUMN = "regulatedEquipmentType";
static final String EQUIPMENT_ID_COLUMN = "equipmentId";
public static final String EQUIPMENT_ID_COLUMN = "equipmentId";
static final String REGULATING_EQUIPMENT_ID = "regulatingEquipmentId";
static final String INDEX_COLUMN = "index";
static final String TAPCHANGER_TYPE_COLUMN = "tapChangerType";
static final String ALPHA_COLUMN = "alpha";
static final String OPERATIONAL_LIMITS_GROUP_ID_COLUMN = "operationalLimitsGroupId";
static final String SELECTED_OPERATIONAL_LIMITS_GROUP_ID_COLUMN = "selectedOperationalLimitsGroupId";
public static final String V211_TEMPORARY_LIMIT_TABLE = "v211temporarylimit";
public static final String V211_PERMANENT_LIMIT_TABLE = "v211permanentlimit";
static final String TEMPORARY_LIMITS_TABLE = "temporarylimits";
static final String TEMPORARY_LIMITS_COLUMN = "temporarylimits";
static final String PERMANENT_LIMITS_TABLE = "permanentlimits";
static final String PERMANENT_LIMITS_COLUMN = "permanentlimits";
static final String TAP_CHANGER_STEP_TABLE = "tapChangerStep";
static final String REGULATING_POINT_TABLE = "regulatingPoint";
static final String REGULATION_MODE = "regulationMode";
static final String SIDE_COLUMN = "side";
static final String LIMIT_TYPE_COLUMN = "limitType";
public static final String SIDE_COLUMN = "side";
static final String REGULATING = "regulating";

private QueryCatalog() {
Expand Down Expand Up @@ -285,11 +288,9 @@ public static String buildCloneNetworksQuery(Collection<String> columns) {

// Temporary Limits
public static String buildCloneTemporaryLimitsQuery() {
return "insert into temporarylimit(" + EQUIPMENT_ID_COLUMN + ", " + EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " + VARIANT_NUM_COLUMN + ", " + OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " + SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " + NAME_COLUMN +
", value_, acceptableDuration, fictitious) " + "select " + EQUIPMENT_ID_COLUMN + ", " +
EQUIPMENT_TYPE_COLUMN + ", ?, ?, " + OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " + SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " + NAME_COLUMN +
", value_, acceptableDuration, fictitious from temporarylimit where " + NETWORK_UUID_COLUMN +
return "insert into " + TEMPORARY_LIMITS_TABLE + "(" + EQUIPMENT_ID_COLUMN + ", " + EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " + VARIANT_NUM_COLUMN + ", " + TEMPORARY_LIMITS_COLUMN + ") " + "select " + EQUIPMENT_ID_COLUMN + ", " +
EQUIPMENT_TYPE_COLUMN + ", ?, ?, " + TEMPORARY_LIMITS_COLUMN + " from " + TEMPORARY_LIMITS_TABLE + " where " + NETWORK_UUID_COLUMN +
" = ? and " + VARIANT_NUM_COLUMN + " = ?";
}

Expand All @@ -298,11 +299,8 @@ public static String buildTemporaryLimitQuery(String columnNameForWhereClause) {
EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " +
SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " +
NAME_COLUMN + ", " +
"value_, acceptableDuration, fictitious " +
"from temporarylimit where " +
TEMPORARY_LIMITS_COLUMN +
" from " + TEMPORARY_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
columnNameForWhereClause + " = ?";
Expand All @@ -316,54 +314,49 @@ public static String buildTemporaryLimitWithInClauseQuery(String columnNameForIn
EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " +
SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " +
NAME_COLUMN + ", " +
"value_, acceptableDuration, fictitious " +
"from temporarylimit where " +
TEMPORARY_LIMITS_COLUMN +
" from " + TEMPORARY_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
columnNameForInClause + " in (" +
"?, ".repeat(numberOfValues - 1) + "?)";
}

public static String buildInsertTemporaryLimitsQuery() {
return "insert into temporarylimit(" +
return "insert into " + TEMPORARY_LIMITS_TABLE + "(" +
EQUIPMENT_ID_COLUMN + ", " + EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " + SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " +
NAME_COLUMN + ", value_, acceptableDuration, fictitious)" +
" values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
VARIANT_NUM_COLUMN + ", " + TEMPORARY_LIMITS_COLUMN + ") " +
" values (?, ?, ?, ?, ?)";
}

public static String buildDeleteTemporaryLimitsVariantEquipmentINQuery(int numberOfValues) {
if (numberOfValues < 1) {
throw new IllegalArgumentException(MINIMAL_VALUE_REQUIREMENT_ERROR);
}
return "delete from temporarylimit where " +
return "delete from " + TEMPORARY_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
EQUIPMENT_ID_COLUMN + " in (" +
"?, ".repeat(numberOfValues - 1) + "?)";
}

public static String buildDeleteTemporaryLimitsVariantQuery() {
return "delete from temporarylimit where " +
return "delete from " + TEMPORARY_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ?";
}

public static String buildDeleteTemporaryLimitsQuery() {
return "delete from temporarylimit where " +
return "delete from " + TEMPORARY_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ?";
}

// permanent Limits
// Permanent Limits
public static String buildClonePermanentLimitsQuery() {
return "insert into permanentlimit(" + EQUIPMENT_ID_COLUMN + ", " + EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " + VARIANT_NUM_COLUMN + ", " + OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " + SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", value_) " + "select " + EQUIPMENT_ID_COLUMN + ", " +
EQUIPMENT_TYPE_COLUMN + ", ?, ?, " + OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " + SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", value_ from permanentlimit where " + NETWORK_UUID_COLUMN +
return "insert into " + PERMANENT_LIMITS_TABLE + "(" + EQUIPMENT_ID_COLUMN + ", " + EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " + VARIANT_NUM_COLUMN + ", " + PERMANENT_LIMITS_COLUMN + ") " + "select " + EQUIPMENT_ID_COLUMN + ", " +
EQUIPMENT_TYPE_COLUMN + ", ?, ?, " + PERMANENT_LIMITS_COLUMN + " from " + PERMANENT_LIMITS_TABLE + " where " + NETWORK_UUID_COLUMN +
" = ? and " + VARIANT_NUM_COLUMN + " = ?";
}

Expand All @@ -372,10 +365,8 @@ public static String buildPermanentLimitQuery(String columnNameForWhereClause) {
EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " +
SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " +
"value_ " +
"from permanentlimit where " +
PERMANENT_LIMITS_COLUMN +
" from " + PERMANENT_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
columnNameForWhereClause + " = ?";
Expand All @@ -389,44 +380,41 @@ public static String buildPermanentLimitWithInClauseQuery(String columnNameForIn
EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " +
SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", " +
"value_ " +
"from permanentlimit where " +
PERMANENT_LIMITS_COLUMN +
" from " + PERMANENT_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
columnNameForInClause + " in (" +
"?, ".repeat(numberOfValues - 1) + "?)";
}

public static String buildInsertPermanentLimitsQuery() {
return "insert into permanentlimit(" +
return "insert into " + PERMANENT_LIMITS_TABLE + " (" +
EQUIPMENT_ID_COLUMN + ", " + EQUIPMENT_TYPE_COLUMN + ", " +
NETWORK_UUID_COLUMN + ", " +
VARIANT_NUM_COLUMN + ", " +
OPERATIONAL_LIMITS_GROUP_ID_COLUMN + ", " + SIDE_COLUMN + ", " + LIMIT_TYPE_COLUMN + ", value_)" +
" values (?, ?, ?, ?, ?, ?, ?, ?)";
VARIANT_NUM_COLUMN + ", " + PERMANENT_LIMITS_COLUMN + ") " +
" values (?, ?, ?, ?, ?)";
}

public static String buildDeletePermanentLimitsVariantEquipmentINQuery(int numberOfValues) {
if (numberOfValues < 1) {
throw new IllegalArgumentException(MINIMAL_VALUE_REQUIREMENT_ERROR);
}
return "delete from permanentlimit where " +
return "delete from " + PERMANENT_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ? and " +
EQUIPMENT_ID_COLUMN + " in (" +
"?, ".repeat(numberOfValues - 1) + "?)";
}

public static String buildDeletePermanentLimitsVariantQuery() {
return "delete from permanentlimit where " +
return "delete from " + PERMANENT_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ? and " +
VARIANT_NUM_COLUMN + " = ?";
}

public static String buildDeletePermanentLimitsQuery() {
return "delete from permanentlimit where " +
return "delete from " + PERMANENT_LIMITS_TABLE + " where " +
NETWORK_UUID_COLUMN + " = ?";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Schema(description = "limits attributes")
public class LimitsInfos {

@Schema(description = "List of permeant limits")
@Schema(description = "List of permanent limits")
private List<PermanentLimitAttributes> permanentLimits = new ArrayList<>();

@Schema(description = "List of temporary limits")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.network.store.server.json;

import com.powsybl.iidm.network.LimitType;
import com.powsybl.network.store.server.dto.PermanentLimitAttributes;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

/**
* @author Etienne Lesot <etienne.lesot at rte-france.com>
*/
@ToString
@Builder
@AllArgsConstructor
@Getter
public class PermanentLimitSqlData {

private String operationalLimitsGroupId;
private double value;
private Integer side;
private LimitType limitType;

public PermanentLimitSqlData() {
// empty constructor for Jackson
}

public static PermanentLimitSqlData of(PermanentLimitAttributes permanentLimitAttributes) {
return PermanentLimitSqlData.builder()
.operationalLimitsGroupId(permanentLimitAttributes.getOperationalLimitsGroupId())
.value(permanentLimitAttributes.getValue())
.side(permanentLimitAttributes.getSide())
.limitType(permanentLimitAttributes.getLimitType())
.build();
}

public PermanentLimitAttributes toPermanentLimitAttributes() {
return PermanentLimitAttributes.builder()
.operationalLimitsGroupId(operationalLimitsGroupId)
.value(value)
.side(side)
.limitType(limitType)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.network.store.server.json;

import com.powsybl.iidm.network.LimitType;
import com.powsybl.network.store.model.TemporaryLimitAttributes;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

/**
* @author Etienne Lesot <etienne.lesot at rte-france.com>
*/
@ToString
@Builder
@AllArgsConstructor
@Getter
public class TemporaryLimitSqlData {
private String operationalLimitsGroupId;
private Integer side;
private LimitType limitType;
private String name;
private double value;
private Integer acceptableDuration;
private boolean fictitious;

public TemporaryLimitSqlData() {
// empty constructor for Jackson
}

public static TemporaryLimitSqlData of(TemporaryLimitAttributes temporaryLimit) {
return TemporaryLimitSqlData.builder()
.operationalLimitsGroupId(temporaryLimit.getOperationalLimitsGroupId())
.side(temporaryLimit.getSide())
.limitType(temporaryLimit.getLimitType())
.name(temporaryLimit.getName())
.value(temporaryLimit.getValue())
.acceptableDuration(temporaryLimit.getAcceptableDuration())
.fictitious(temporaryLimit.isFictitious())
.build();
}

public TemporaryLimitAttributes toTemporaryLimitAttributes() {
return TemporaryLimitAttributes.builder()
.operationalLimitsGroupId(operationalLimitsGroupId)
.side(side)
.limitType(limitType)
.name(name)
.value(value)
.acceptableDuration(acceptableDuration)
.fictitious(fictitious)
.build();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.powsybl.network.store.server.migration;

import com.powsybl.network.store.model.*;
import com.powsybl.network.store.server.NetworkStoreRepository;
import com.powsybl.network.store.server.migration.v211limits.V211LimitsMigration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.*;

/**
* @author Etienne Homer <etienne.homer at rte-france.com>
*/
@RestController
@RequestMapping(value = "/" + NetworkStoreApi.VERSION + "/migration")
@Tag(name = "Network store migration")
public class MigrationController {

@Autowired
private NetworkStoreRepository repository;

@PutMapping(value = "/v211limits/{networkId}/{variantNum}")
@Operation(summary = "Migrate limits of a network")
@ApiResponses(@ApiResponse(responseCode = "200", description = "Successfully migrated limits from V2.11.0 to new model"))
public ResponseEntity<Void> migrateV211Limits(@Parameter(description = "Network ID", required = true) @PathVariable("networkId") UUID networkId,
@Parameter(description = "Variant num", required = true) @PathVariable("variantNum") int variantNum) {
V211LimitsMigration.migrateV211Limits(repository, networkId, variantNum);
return ResponseEntity.ok().build();
}
}
Loading
Loading