Skip to content

Commit 737e6ec

Browse files
committed
update csv columns for export
Signed-off-by: David BRAQUART <[email protected]>
1 parent 8c3855f commit 737e6ec

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

src/main/java/org/gridsuite/securityanalysis/server/dto/LimitViolationDTO.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,17 @@ private static String convertDoubleToLocale(Double value, String language) {
6060

6161
public List<String> toCsvRow(Map<String, String> translations, String language) {
6262
List<String> csvRow = new ArrayList<>();
63-
csvRow.add(this.getLocationId());
6463
csvRow.add(this.getLimitType() != null ? CsvExportUtils.translate(this.getLimitType().name(), translations) : "");
64+
csvRow.add(this.getLocationId()); // busId
6565
csvRow.add(CsvExportUtils.replaceNullWithEmptyString(CsvExportUtils.translate(this.getLimitName(), translations)));
66-
csvRow.add(convertDoubleToLocale(this.getLimit(), language));
67-
csvRow.add(convertDoubleToLocale(this.getValue(), language));
6866
csvRow.add(this.getLoading() == null ? "" : convertDoubleToLocale(this.getLoading(), language));
67+
csvRow.add(this.getPatlLoading() == null ? "" : convertDoubleToLocale(this.getPatlLoading(), language));
6968
csvRow.add(this.getAcceptableDuration() == Integer.MAX_VALUE ? null : Integer.toString(this.getAcceptableDuration()));
69+
csvRow.add(this.getUpcomingAcceptableDuration() == null || this.getUpcomingAcceptableDuration() == Integer.MAX_VALUE ? null : Integer.toString(this.getUpcomingAcceptableDuration()));
70+
csvRow.add(CsvExportUtils.replaceNullWithEmptyString(CsvExportUtils.translate(this.getNextLimitName(), translations)));
71+
csvRow.add(convertDoubleToLocale(this.getLimit(), language));
72+
csvRow.add(this.getPatlLimit() == null ? "" : convertDoubleToLocale(this.getPatlLimit(), language));
73+
csvRow.add(convertDoubleToLocale(this.getValue(), language));
7074
csvRow.add(this.getSide() != null ? CsvExportUtils.translate(this.getSide().name(), translations) : "");
7175
return csvRow;
7276
}

src/main/java/org/gridsuite/securityanalysis/server/dto/PreContingencyLimitViolationResultDTO.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import lombok.experimental.FieldNameConstants;
1515
import org.gridsuite.securityanalysis.server.entities.PreContingencyLimitViolationEntity;
1616

17+
import java.util.ArrayList;
1718
import java.util.List;
1819
import java.util.Map;
19-
import java.util.stream.Stream;
2020

2121
@Getter
2222
@AllArgsConstructor
@@ -41,12 +41,12 @@ public static PreContingencyLimitViolationResultDTO toDto(PreContingencyLimitVio
4141
}
4242

4343
public List<String> toCsvRow(Map<String, String> translations, String language) {
44-
List<String> csvRow = List.of();
45-
46-
if (this.getLimitViolation() != null) {
47-
return Stream.concat(csvRow.stream(), this.getLimitViolation().toCsvRow(translations, language).stream()).toList();
44+
if (this.getLimitViolation() == null) {
45+
return List.of();
4846
}
49-
47+
List<String> csvRow = new ArrayList<>();
48+
csvRow.add(this.getSubjectId());
49+
csvRow.addAll(this.getLimitViolation().toCsvRow(translations, language));
5050
return csvRow;
5151
}
5252
}

0 commit comments

Comments
 (0)