Skip to content

Commit 91f1028

Browse files
author
BOUTIER Charly
committed
withMessageTemplate update
Signed-off-by: BOUTIER Charly <[email protected]>
1 parent 0671772 commit 91f1028

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright (c) 2025, RTE (http://www.rte-france.com)
3+
* This Source Code Form is subject to the terms of the Mozilla Public
4+
* License, v. 2.0. If a copy of the MPL was not distributed with this
5+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
6+
* SPDX-License-Identifier: MPL-2.0
7+
*/
8+
package org.gridsuite.securityanalysis.server.report;
9+
10+
import com.google.auto.service.AutoService;
11+
import com.powsybl.commons.report.ReportResourceBundle;
12+
13+
/**
14+
* @author Charly Boutier {@literal <charly.boutier at rte-france.com>}
15+
*/
16+
@AutoService(ReportResourceBundle.class)
17+
public final class SecurityAnalysisServerReportResourceBundle implements ReportResourceBundle {
18+
19+
public static final String BASE_NAME = "org.gridsuite.securityanalysis.server.reports";
20+
21+
public String getBaseName() {
22+
return BASE_NAME;
23+
}
24+
}

src/main/java/org/gridsuite/securityanalysis/server/service/SecurityAnalysisWorkerService.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,13 @@ private static void logContingencyEquipmentsNotFound(SecurityAnalysisRunContext
228228
}
229229

230230
ReportNode elementsNotFoundSubReporter = runContext.getReportNode().newReportNode()
231-
.withMessageTemplate("notFoundEquipments", "Equipments not found")
231+
.withMessageTemplate("notFoundEquipments")
232232
.add();
233233

234234
contingencyInfosList.forEach(contingencyInfos -> {
235235
String elementsIds = String.join(", ", contingencyInfos.getNotFoundElements());
236236
elementsNotFoundSubReporter.newReportNode()
237-
.withMessageTemplate("contingencyEquipmentNotFound",
238-
"Cannot find the following equipments ${elementsIds} in contingency ${contingencyId}")
237+
.withMessageTemplate("contingencyEquipmentNotFound")
239238
.withUntypedValue("elementsIds", elementsIds)
240239
.withUntypedValue("contingencyId", contingencyInfos.getId())
241240
.withSeverity(TypedValue.WARN_SEVERITY)
@@ -252,14 +251,13 @@ private void logContingencyEquipmentsNotConnected(SecurityAnalysisRunContext run
252251
}
253252

254253
ReportNode elementsNotConnectedSubReporter = runContext.getReportNode().newReportNode()
255-
.withMessageTemplate("notConnectedEquipments", "Equipments not connected")
254+
.withMessageTemplate("notConnectedEquipments")
256255
.add();
257256

258257
contingencyInfosList.forEach(contingencyInfos -> {
259258
String elementsIds = String.join(", ", contingencyInfos.getNotConnectedElements());
260259
elementsNotConnectedSubReporter.newReportNode()
261-
.withMessageTemplate("contingencyEquipmentNotConnected",
262-
"The following equipments ${elementsIds} in contingency ${contingencyId} are not connected")
260+
.withMessageTemplate("contingencyEquipmentNotConnected")
263261
.withUntypedValue("elementsIds", elementsIds)
264262
.withUntypedValue("contingencyId", contingencyInfos.getId())
265263
.withSeverity(TypedValue.WARN_SEVERITY)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
notFoundEquipments = Equipments not found
2+
contingencyEquipmentNotFound = Cannot find the following equipments ${elementsIds} in contingency ${contingencyId}
3+
notConnectedEquipments = Equipments not connected
4+
contingencyEquipmentNotConnected = The following equipments ${elementsIds} in contingency ${contingencyId} are not connected
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)