Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 4836f33

Browse files
committed
Simplify resultingNodes logic, fix connectedNode typo
1 parent ab35a5d commit 4836f33

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/main/java/org/brapi/test/BrAPITestServer/service/germ/PedigreeService.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,12 @@ public List<PedigreeNodeEntity> getPedigreeNodes(List<String> germplasmDbIds) {
195195

196196
public List<PedigreeNodeEntity> findOrCreatePedigreeNodesFromGermplasmIds(List<String> germplasmDbIds) throws BrAPIServerException {
197197

198-
List<PedigreeNodeEntity> dbNodes = getPedigreeNodes(germplasmDbIds);
198+
// First, grab nodes from the DB that match the germplasmDbIds passed through.
199+
List<PedigreeNodeEntity> resultingNodes = getPedigreeNodes(germplasmDbIds);
199200

200-
List<PedigreeNodeEntity> resultingNodes = new ArrayList<>(dbNodes);
201-
202-
// Find out which germIds were not found in the DB. Use a set for improved performance on the contains check.
201+
// Next, find out which germIds were not found in the DB. Use a set for improved performance on the contains check.
203202
// TODO: Check if the germEntity is already populated by getPedigreeNodes, and if this block results in more DB transactions.
204-
Set<String> germIdsOfFoundNodes = dbNodes.stream()
203+
Set<String> germIdsOfFoundNodes = resultingNodes.stream()
205204
.map(PedigreeNodeEntity::getGermplasm)
206205
.map(BrAPIBaseEntity::getId)
207206
.collect(Collectors.toSet());
@@ -758,7 +757,7 @@ private void updateChildEdges(List<String> germIdsWithProgenyNodes,
758757

759758
SearchQueryBuilder<PedigreeEdgeEntity> search = new SearchQueryBuilder<PedigreeEdgeEntity>(PedigreeEdgeEntity.class);
760759

761-
search.appendList(germIdsWithProgenyNodes, "conncetedNode.germplasm.id");
760+
search.appendList(germIdsWithProgenyNodes, "connected.germplasm.id");
762761
search.appendEnum(PedigreeEdgeEntity.EdgeType.parent, "edgeType");
763762
List<PedigreeEdgeEntity> existingProgenyEdges = pedigreeEdgeRepository.findAllBySearch(search);
764763

0 commit comments

Comments
 (0)