Skip to content

Commit

Permalink
use of attributesGetter
Browse files Browse the repository at this point in the history
Signed-off-by: Mathieu DEHARBE <[email protected]>
  • Loading branch information
Mathieu-Deharbe committed Sep 10, 2024
1 parent 6938228 commit 42930a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ public void moveConnectable(String busId, boolean connected) {
throw new PowsyblException("Trying to move connectable " + attributes.getResource().getId()
+ " to bus " + busId + " of voltage level " + bus.getVoltageLevel().getId() + ", which is a node breaker voltage level");
}
//attributes.setConnectableBus(busId);
//attributes.setBus(connected ? busId : null);
//attributes.setVoltageLevelId(voltageLevel.getId());
//index.updateResource(getAbstractIdentifiable().getResource(), null);
getAbstractIdentifiable().updateResource(res -> {
attributes.setConnectableBus(busId);
attributes.setBus(connected ? busId : null);
attributes.setNode(null);
attributes.setVoltageLevelId(voltageLevel.getId());
attributesGetter.apply(res).setConnectableBus(busId);
attributesGetter.apply(res).setBus(connected ? busId : null);
attributesGetter.apply(res).setNode(null);
attributesGetter.apply(res).setVoltageLevelId(voltageLevel.getId());
});
voltageLevel.invalidateCalculatedBuses();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,11 @@ public void moveConnectable(int node, String voltageLevelId) {
throw new ValidationException(attributes.getResource(), "an equipment (" + terminal.getConnectable().getId()
+ ") is already connected to node " + node + " of voltage level " + voltageLevelId);
}
//attributes.setNode(node);
//attributes.setVoltageLevelId(voltageLevelId);
//index.updateResource(getAbstractIdentifiable().getResource(), null);
getAbstractIdentifiable().updateResource(res -> {
attributes.setConnectableBus(null);
attributes.setBus(null);
attributes.setNode(node);
attributes.setVoltageLevelId(voltageLevelId);
attributesGetter.apply(res).setConnectableBus(null);
attributesGetter.apply(res).setBus(null);
attributesGetter.apply(res).setNode(node);
attributesGetter.apply(res).setVoltageLevelId(voltageLevelId);
});
voltageLevel.invalidateCalculatedBuses();
}
Expand Down

0 comments on commit 42930a0

Please sign in to comment.