Upgrade network-modification v0.71.0 + generate bbs ids suggestions#782
Upgrade network-modification v0.71.0 + generate bbs ids suggestions#782etiennehomer merged 17 commits intomainfrom
Conversation
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
| @Parameter(description = "Voltage level id") @RequestParam("voltageLevelId") String voltageLevelId, | ||
| @Parameter(description = "Bus bar count") @RequestParam("busBarCount") Integer busBarCount, | ||
| @Parameter(description = "Section count") @RequestParam("sectionCount") Integer sectionCount, | ||
| @Parameter(description = "Switch kinds list") @RequestParam(name="switchKindList", defaultValue = "") Optional<List<SwitchKind>> switchKindList) { |
There was a problem hiding this comment.
Optional as @RequestParam ?
we can handle that wuth required = false + defaultValue
| @Parameter(description = "Bus bar count") @RequestParam("busBarCount") Integer busBarCount, | ||
| @Parameter(description = "Section count") @RequestParam("sectionCount") Integer sectionCount, | ||
| @Parameter(description = "Switch kinds list") @RequestParam(name="switchKindList", defaultValue = "") Optional<List<SwitchKind>> switchKindList) { | ||
| return ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON) |
There was a problem hiding this comment.
already declared via produces = MediaType.APPLICATION_JSON_VALUE
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
| NamingStrategy namingStrategy = new NamingStrategiesServiceLoader().findNamingStrategyByName(modificationApplicator.getNamingStrategy()).orElse(new DefaultNamingStrategy()); | ||
| for (int i = 1; i < busBarCount + 1; i++) { | ||
| for (int j = 1; j < sectionCount + 1; j++) { | ||
| bbsIds.add(namingStrategy.getBusbarId(voltageLevelId, switchKindList, i, j)); |
There was a problem hiding this comment.
switchKindList could be an empty string (defaultValue = "")
busBarCount and sectionCount are Integer => could be null, 0 or negative value
no validation before they are used in the loop => could throw NullPointerException
There was a problem hiding this comment.
The defaultValue = "" was wrong. I removed it
There was a problem hiding this comment.
maybe we can add @positive also to avoid negative values ?
There was a problem hiding this comment.
And maybe have a maximum for busBarCount and sectionCount
There was a problem hiding this comment.
It returns an empty list for negative values. Maybe it's ok...
|
|
||
| public List<String> getBusBarSectionsForNewCoupler(String voltageLevelId, Integer busBarCount, Integer sectionCount, List<SwitchKind> switchKindList) { | ||
| List<String> bbsIds = new ArrayList<>(); | ||
| NamingStrategy namingStrategy = new NamingStrategiesServiceLoader().findNamingStrategyByName(modificationApplicator.getNamingStrategy()).orElse(new DefaultNamingStrategy()); |
There was a problem hiding this comment.
should be injected via constructor to avoid the instantation on every call !
There was a problem hiding this comment.
Yes done in NetworkModificationApplicator. It's cleaner
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
Signed-off-by: Etienne Homer <etiennehomer@gmail.com>
|



PR Summary
Add an endpoint that generate bbs ids with the configured naming strategy