Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First timepoint implementation #612

Merged
merged 68 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
854b650
feat: first implementation of timepoints
Sep 6, 2024
8b547f4
Merge remote-tracking branch 'origin/main' into timepoint-implementation
Sep 9, 2024
ede825a
fix: tests
Sep 9, 2024
4debb85
temporary commit
Sep 10, 2024
fe39ef8
feat: keep implementing timepoints
Sep 11, 2024
6202846
Merge remote-tracking branch 'origin/main' into timepoint-implementation
Sep 17, 2024
14d84a2
fix: some fixes before changing structure
Sep 17, 2024
c1a186f
fix: remove abstract timepoints links
Sep 17, 2024
ae83bf8
fix: compilable version + changelogs
Sep 17, 2024
702f984
fix: keep fixing issues
Sep 18, 2024
436fddc
fix: creating study and network-modification working
Sep 23, 2024
fbda22c
feat: keep implementing timepoints
Sep 23, 2024
1e8bfcc
feat: more and more functionnality working
Sep 23, 2024
7a7a85a
feat: keep fixing app
Sep 24, 2024
acfec1c
Merge remote-tracking branch 'origin/main' into timepoint-implementation
Sep 24, 2024
a31de48
fix: node building
Sep 24, 2024
0bd65ee
fix: other node creation
Sep 24, 2024
0aff56d
fix: copy/pasting node + modifications now applied on right variant
Sep 24, 2024
41ceeef
fix: duplication / move modifications
Sep 24, 2024
139168a
fix: get root reports now working
Sep 24, 2024
6e6426a
fix: study deletion
Sep 26, 2024
83bb335
fix: clean code + checkstyle
Sep 26, 2024
e2181f6
fix: keep cleaning code
Sep 26, 2024
682ddef
fix: formatting
Sep 26, 2024
8a8a2f7
fix: study deletion
Sep 27, 2024
fdc76d4
fix: tests
Oct 2, 2024
a13a4b6
fix: dynamic simulation tests
Oct 2, 2024
04248b9
fix: more tests
Oct 2, 2024
1fd2a67
fix: some more tests
Oct 2, 2024
9d6413b
fix: some more tests
Oct 3, 2024
6618d55
fix: some more tests
Oct 3, 2024
b9535fd
fix: last tests + checkstyle
Oct 7, 2024
2373fb3
Merge remote-tracking branch 'origin/main' into timepoint-implementation
Oct 8, 2024
da77d6b
Merge branch 'main' into timepoint-implementation
souissimai Oct 8, 2024
0cd52ef
fix: tests after merge
Oct 8, 2024
c2145fb
fix: checkstyle
Oct 9, 2024
cf10dc0
migrate data
souissimai Oct 9, 2024
8dc6919
Merge branch 'timepoint-implementation' of https://github.com/gridsui…
souissimai Oct 9, 2024
bf35340
fix : rename changelog
souissimai Oct 10, 2024
7dcd03b
fix: remove debug config
Oct 10, 2024
a8e792d
Merge branch 'timepoint-implementation' of https://github.com/gridsui…
Oct 10, 2024
9bd7c3f
clean changelog
souissimai Oct 10, 2024
41f65c2
Merge branch 'timepoint-implementation' of https://github.com/gridsui…
souissimai Oct 10, 2024
b93c1ec
fix migration script
souissimai Oct 21, 2024
13660f2
fix: rename timepoint to rootnetwork
Oct 22, 2024
a4b950c
conflicts
souissimai Oct 22, 2024
b53c5cc
Add a spring service 'RootNetworkNodeInfoService'
Oct 23, 2024
c2e955e
Merge branch 'main' of https://github.com/powsybl/powsybl-study-serve…
Oct 23, 2024
31b21a9
Now 'rootNekwork' creations done by the RootNetworkService
Oct 23, 2024
4c35971
Merge branch 'main' of https://github.com/powsybl/powsybl-study-serve…
Oct 24, 2024
2f57c05
Merge branch 'main' of https://github.com/powsybl/powsybl-study-serve…
Oct 24, 2024
50165fe
resolve conflicts: cleaning modificationsToExclude
souissimai Oct 25, 2024
7329282
resolve conflicts
souissimai Oct 25, 2024
f89c0b2
Use spring service 'RootNetworkNodeInfoService' to duplicate a node
Oct 28, 2024
b0bd18c
Use spring service 'RootNetworkNodeInfoService' to duplicate a node
Oct 28, 2024
4656d33
Merge branch 'timepoint-implementation' of https://github.com/gridsui…
souissimai Oct 28, 2024
847644b
remove patch
souissimai Oct 28, 2024
f7195d0
Pass 'rootNetworkUuid' as argument to 'completeNodeInfos' method
Oct 29, 2024
583203c
Merge branch 'main' of https://github.com/powsybl/powsybl-study-serve…
Oct 29, 2024
27c26b9
Add indexes and rename foreign keys
Nov 4, 2024
270b020
fix: test was a bit buggy
Nov 4, 2024
b49cad6
Merge branch 'timepoint-implementation' of https://github.com/gridsui…
Nov 4, 2024
41197c1
Merge branch 'timepoint-implementation' of https://github.com/powsybl…
Nov 4, 2024
fb6cdab
fix: getAllReportUuids was returning root uuids multiple times
Nov 4, 2024
d2d721b
Merge branch 'timepoint-implementation' of https://github.com/gridsui…
Nov 4, 2024
1a34901
Remove some Sonar issues
Nov 4, 2024
219d079
Merge branch 'timepoint-implementation' of https://github.com/powsybl…
Nov 4, 2024
7245d04
fix: add not nullable in rootNetworkNodeInfoEntity + fix tests
Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 47 additions & 47 deletions src/main/java/org/gridsuite/study/server/StudyController.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ public enum Type {
STATE_ESTIMATION_NOT_FOUND,
STATE_ESTIMATION_ERROR,
MAX_NODE_BUILDS_EXCEEDED,
ROOTNETWORK_NOT_FOUND
}

private final Type type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
@NoArgsConstructor
public class NodeReceiver {
private UUID nodeUuid;

private UUID rootNetworkUuid;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@
package org.gridsuite.study.server.networkmodificationtree;

import org.gridsuite.study.server.StudyException;
import org.gridsuite.study.server.dto.ComputationType;
import org.gridsuite.study.server.dto.NodeModificationInfos;
import org.gridsuite.study.server.networkmodificationtree.dto.AbstractNode;
import org.gridsuite.study.server.networkmodificationtree.dto.BuildStatus;
import org.gridsuite.study.server.networkmodificationtree.dto.NetworkModificationNode;
import org.gridsuite.study.server.networkmodificationtree.dto.NodeBuildStatus;
import org.gridsuite.study.server.networkmodificationtree.entities.AbstractNodeInfoEntity;
import org.gridsuite.study.server.networkmodificationtree.entities.NodeType;
import org.gridsuite.study.server.repository.networkmodificationtree.NodeInfoRepository;
import org.gridsuite.study.server.utils.PropertyUtils;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* @author Jacques Borsenberger <jacques.borsenberger at rte-france.com>
Expand All @@ -34,77 +25,8 @@ protected AbstractNodeRepositoryProxy(R nodeInfoRepository) {
this.nodeInfoRepository = nodeInfoRepository;
}

public abstract T toEntity(AbstractNode node);

public abstract U toDto(T node);

public String getVariantId(AbstractNode node) {
return null;
}

public UUID getModificationGroupUuid(AbstractNode node) {
return null;
}

public void updateComputationResultUuid(AbstractNode node, UUID resultUuid, ComputationType computationType) {
}

public void updateComputationReportUuid(AbstractNode node, UUID reportUuid, ComputationType computationType) {
}

public void setModificationReports(AbstractNode node, Map<UUID, UUID> reports) {
}

public void setComputationsReports(AbstractNode node, Map<String, UUID> reports) {
}

public NodeBuildStatus getNodeBuildStatus(AbstractNode node) {
return NodeBuildStatus.from(BuildStatus.NOT_BUILT);
}

/**
* @param node fetched network modification node
* @param computationType type of the fetched computation
* @return UUID of the computation of this type, done on this node
*/
public UUID getComputationResultUuid(AbstractNode node, ComputationType computationType) {
return null;
}

public Map<String, UUID> getComputationReports(AbstractNode node) {
return new HashMap<>();
}

public Map<UUID, UUID> getModificationReports(AbstractNode node) {
return new HashMap<>();
}

public UUID getReportUuid(AbstractNode node) {
return null;
}

public void handleExcludeModification(AbstractNode node, UUID modificationUuid, boolean active) {
}

public void removeModificationsToExclude(AbstractNode node, List<UUID> modificationUuid) {
}

public void updateNodeBuildStatus(AbstractNode node, NodeBuildStatus nodeBuildStatus, List<UUID> changedNodes) {
}

public void invalidateNodeBuildStatus(AbstractNode node, List<UUID> changedNodes) {
}

public void createNodeInfo(AbstractNode nodeInfo) {
if (nodeInfo.getType() == NodeType.NETWORK_MODIFICATION) {
NetworkModificationNode node = (NetworkModificationNode) nodeInfo;
if (node.getModificationReports() == null) {
node.setModificationReports(Map.of(node.getId(), UUID.randomUUID()));
}
}
nodeInfoRepository.save(toEntity(nodeInfo));
}

public void deleteByNodeId(UUID id) {
nodeInfoRepository.deleteById(id);
}
Expand All @@ -121,26 +43,8 @@ protected U completeNodeInfo(AbstractNodeInfoEntity nodeInfoEntity, U node) {
return node;
}

protected T completeEntityNodeInfo(AbstractNode node, T entity) {
entity.setIdNode(node.getId());
entity.setName(node.getName());
entity.setDescription(node.getDescription());
entity.setReadOnly(node.getReadOnly());
return entity;
}

public void updateNode(AbstractNode node, String... authorizedNullProperties) {
U persistedNode = getNode(node.getId());
/* using only DTO values not jpa Entity */
PropertyUtils.copyNonNullProperties(node, persistedNode, authorizedNullProperties);

T entity = toEntity(persistedNode);
entity.markNotNew();
nodeInfoRepository.save(entity);
}

public Map<UUID, U> getAll(Collection<UUID> ids) {
return nodeInfoRepository.findAllById(ids).stream().map(this::toDto).collect(Collectors.toMap(U::getId, Function.identity()));
public List<U> getAll(Collection<UUID> ids) {
return nodeInfoRepository.findAllById(ids).stream().map(this::toDto).toList();
}

public List<U> getAllInOrder(List<UUID> ids) {
Expand All @@ -153,75 +57,7 @@ public void deleteAll(Set<UUID> collect) {
nodeInfoRepository.deleteByIdNodeIn(collect);
}

public String getVariantId(UUID nodeUuid) {
return getVariantId(getNode(nodeUuid));
}

public UUID getModificationGroupUuid(UUID nodeUuid) {
return getModificationGroupUuid(getNode(nodeUuid));
}

public void updateComputationResultUuid(UUID nodeUuid, UUID computationResultUuid, ComputationType computationType) {
updateComputationResultUuid(getNode(nodeUuid), computationResultUuid, computationType);
}

public UUID getComputationResultUuid(UUID nodeUuid, ComputationType computationType) {
return getComputationResultUuid(getNode(nodeUuid), computationType);
}

public Map<String, UUID> getComputationReports(UUID nodeUuid) {
return getComputationReports(getNode(nodeUuid));
}

public Map<UUID, UUID> getModificationReports(UUID nodeUuid) {
return getModificationReports(getNode(nodeUuid));
}

public UUID getReportUuid(UUID nodeUuid) {
return getReportUuid(getNode(nodeUuid));
}

public void updateComputationReportUuid(UUID nodeUuid, UUID reportUuid, ComputationType computationType) {
updateComputationReportUuid(getNode(nodeUuid), reportUuid, computationType);
}

public void setModificationReports(UUID nodeUuid, Map<UUID, UUID> reports) {
setModificationReports(getNode(nodeUuid), reports);
}

public void setComputationsReports(UUID nodeUuid, Map<String, UUID> reports) {
setComputationsReports(getNode(nodeUuid), reports);
}

public void updateNodeBuildStatus(UUID nodeUuid, NodeBuildStatus nodeBuildStatus, List<UUID> changedNodes) {
updateNodeBuildStatus(getNode(nodeUuid), nodeBuildStatus, changedNodes);
}

public NodeBuildStatus getNodeBuildStatus(UUID nodeUuid) {
return getNodeBuildStatus(getNode(nodeUuid));
}

public void invalidateNodeBuildStatus(UUID nodeUuid, List<UUID> changedNodes) {
invalidateNodeBuildStatus(getNode(nodeUuid), changedNodes);
}

public void handleExcludeModification(UUID nodeUuid, UUID modificationUuid, boolean active) {
handleExcludeModification(getNode(nodeUuid), modificationUuid, active);
}

public void removeModificationsToExclude(UUID nodeUuid, List<UUID> modificationUuid) {
removeModificationsToExclude(getNode(nodeUuid), modificationUuid);
}

public Boolean isReadOnly(UUID nodeUuid) {
return getNode(nodeUuid).getReadOnly();
}

public NodeModificationInfos getNodeModificationInfos(AbstractNode node) {
return null;
}

public NodeModificationInfos getNodeModificationInfos(UUID nodeUuid) {
return getNodeModificationInfos(getNode(nodeUuid));
return nodeInfoRepository.findById(nodeUuid).orElseThrow(() -> new StudyException(StudyException.Type.NODE_NOT_FOUND)).getReadOnly();
}
}
Loading