Skip to content

Commit

Permalink
add check on null value of rccpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazwarhili committed Nov 19, 2024
1 parent 40f52c0 commit 6147888
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

import org.gridsuite.modification.server.entities.equipment.modification.ReactiveCapabilityCurveModificationEmbeddable;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
* @author jamal kheyyad <jamal.kheyyad at rte-france.com>
Expand All @@ -20,15 +18,19 @@ private DTOUtils() {
}

public static List<ReactiveCapabilityCurveModificationInfos> convertToReactiveCapabilityCurveModificationInfos(List<ReactiveCapabilityCurveModificationEmbeddable> rCCpoints) {
return Optional.ofNullable(rCCpoints)
.orElse(Collections.emptyList()).stream().map(value -> value == null
if (rCCpoints == null || rCCpoints.isEmpty()) {
return null;
}
return rCCpoints.stream()
.map(value -> value == null
? new ReactiveCapabilityCurveModificationInfos(null, null, null, null, null, null)
: new ReactiveCapabilityCurveModificationInfos(
value.getMinQ(),
value.getOldMinQ(),
value.getMaxQ(),
value.getOldMaxQ(),
value.getP(),
value.getOldP())).toList();
value.getOldP()))
.toList();
}
}

0 comments on commit 6147888

Please sign in to comment.