diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..e4d9ccc
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,19 @@
+name: CI
+
+on:
+ push:
+ branches:
+ - 'main'
+ pull_request:
+
+jobs:
+ build:
+ uses: powsybl/github-ci/.github/workflows/build-backend-app-generic.yml@aaae75875296657028f2805e7a3fbdb1418b8b95
+ with:
+ dockerImage: docker.io/gridsuite/dynamic-margin-calculation-server
+ dockerUsername: gridsuiteci
+ eventType: dynamic_margin_calculation_server_updated
+ secrets:
+ sonar-token: ${{ secrets.SONAR_TOKEN }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ repo-token: ${{ secrets.REPO_ACCESS_TOKEN }}
diff --git a/.github/workflows/patch.yml b/.github/workflows/patch.yml
new file mode 100644
index 0000000..f34ed80
--- /dev/null
+++ b/.github/workflows/patch.yml
@@ -0,0 +1,22 @@
+name: Patch
+
+on:
+ workflow_dispatch:
+ inputs:
+ releaseVersion:
+ description: version to patch (vX.X)
+ required: true
+
+jobs:
+ run-patch:
+ uses: powsybl/github-ci/.github/workflows/patch-backend-app-generic.yml@aaae75875296657028f2805e7a3fbdb1418b8b95
+ with:
+ githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
+ dockerImage: docker.io/gridsuite/dynamic-margin-calculation-server
+ dockerUsername: gridsuiteci
+ releaseVersion: ${{ github.event.inputs.releaseVersion }}
+ secrets:
+ VERSIONBUMP_GHAPP_PRIVATE_KEY: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}
+ sonar-token: ${{ secrets.SONAR_TOKEN }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..0ceaecb
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,25 @@
+name: Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ releaseVersion:
+ description: Release version (vX.X)
+ required: true
+ gitReference:
+ description: SHA of the commit from where to release or branch name
+ required: true
+
+jobs:
+ run-release:
+ uses: powsybl/github-ci/.github/workflows/release-backend-app-generic.yml@aaae75875296657028f2805e7a3fbdb1418b8b95
+ with:
+ githubappId: ${{ vars.GRIDSUITE_ACTIONS_APPID }}
+ dockerImage: docker.io/gridsuite/dynamic-margin-calculation-server
+ dockerUsername: gridsuiteci
+ releaseVersion: ${{ github.event.inputs.releaseVersion }}
+ gitReference: ${{ github.event.inputs.gitReference }}
+ secrets:
+ VERSIONBUMP_GHAPP_PRIVATE_KEY: ${{ secrets.VERSIONBUMP_GHAPP_PRIVATE_KEY }}
+ sonar-token: ${{ secrets.SONAR_TOKEN }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/lombok.config b/lombok.config
new file mode 100644
index 0000000..4fa8250
--- /dev/null
+++ b/lombok.config
@@ -0,0 +1 @@
+import target/configs/powsybl-build-tools.jar!powsybl-build-tools/lombok.config
diff --git a/pom.xml b/pom.xml
index 71b5ffa..2c84f7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,6 @@
+ 1.3.0
+
+ 1.28.0
+
powsybl/java-dynawo:3.0.0
org.gridsuite.dynamicmargincalculation.server
gridsuite
- 3.2.0
org.gridsuite:dynamic-margin-calculation-server
-
- 1.26.0-SNAPSHOT
@@ -89,21 +91,7 @@
-
- com.powsybl
- powsybl-computation-local
- 6.8.0-SNAPSHOT
-
-
- com.powsybl
- powsybl-computation
- 6.8.0-SNAPSHOT
-
-
- com.powsybl
- powsybl-iidm-api
- 6.8.0-SNAPSHOT
-
+
org.gridsuite
@@ -119,6 +107,11 @@
+
+ org.gridsuite
+ gridsuite-computation
+ ${gridsuite-computation.version}
+
org.springframework.boot
spring-boot-starter-web
@@ -128,13 +121,12 @@
spring-boot-starter-data-jpa
- org.springframework.cloud
- spring-cloud-stream
+ org.springframework.boot
+ spring-boot-starter-actuator
- io.awspring.cloud
- spring-cloud-aws-starter-s3
- ${spring-cloud-aws.version}
+ org.springframework.cloud
+ spring-cloud-stream
org.springdoc
@@ -161,15 +153,9 @@
com.powsybl
powsybl-dynawo-margin-calculation
- 2.9.0-SNAPSHOT
-
- org.springframework.boot
- spring-boot-starter-actuator
- runtime
-
org.springframework.cloud
spring-cloud-stream-binder-rabbit
diff --git a/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationApi.java b/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationApi.java
new file mode 100644
index 0000000..52a6b1c
--- /dev/null
+++ b/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationApi.java
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2025, 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 org.gridsuite.dynamicmargincalculation.server;
+
+/**
+ * @author Thang PHAM
+ */
+public final class DynamicMarginCalculationApi {
+
+ private DynamicMarginCalculationApi() {
+ }
+
+ public static final String API_VERSION = "v1";
+}
diff --git a/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationApplication.java b/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationApplication.java
new file mode 100644
index 0000000..be80086
--- /dev/null
+++ b/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationApplication.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2025, 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 org.gridsuite.dynamicmargincalculation.server;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author Thang PHAM
+ */
+@SuppressWarnings("checkstyle:HideUtilityClassConstructor")
+@SpringBootApplication
+public class DynamicMarginCalculationApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(DynamicMarginCalculationApplication.class, args);
+ }
+
+}
diff --git a/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationException.java b/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationException.java
new file mode 100644
index 0000000..ee635dc
--- /dev/null
+++ b/src/main/java/org/gridsuite/dynamicmargincalculation/server/DynamicMarginCalculationException.java
@@ -0,0 +1,27 @@
+/**
+ * Copyright (c) 2025, 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 org.gridsuite.dynamicmargincalculation.server;
+
+import lombok.Getter;
+
+/**
+ * @author Thang PHAM
+ */
+@Getter
+public class DynamicMarginCalculationException extends RuntimeException {
+
+ public enum Type {
+ RESULT_UUID_NOT_FOUND,
+ }
+
+ private final Type type;
+
+ public DynamicMarginCalculationException(Type type, String message) {
+ super(message);
+ this.type = type;
+ }
+}
diff --git a/src/main/java/org/gridsuite/dynamicmargincalculation/server/RestResponseEntityExceptionHandler.java b/src/main/java/org/gridsuite/dynamicmargincalculation/server/RestResponseEntityExceptionHandler.java
new file mode 100644
index 0000000..5269b7d
--- /dev/null
+++ b/src/main/java/org/gridsuite/dynamicmargincalculation/server/RestResponseEntityExceptionHandler.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2025, 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 org.gridsuite.dynamicmargincalculation.server;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+/**
+ * @author Thang PHAM
+ */
+@ControllerAdvice
+public class RestResponseEntityExceptionHandler {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(RestResponseEntityExceptionHandler.class);
+
+ @ExceptionHandler(DynamicMarginCalculationException.class)
+ protected ResponseEntity