From fb8b04252dbd944bd68e39841aded1f8d5087a3d Mon Sep 17 00:00:00 2001 From: Nick <53413353+nickpalladino@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:11:52 -0400 Subject: [PATCH] Add accession number parameter --- .../brapi/v2/BrAPIPedigreeController.java | 15 +++++----- .../brapi/v2/dao/BrAPIPedigreeDAO.java | 30 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java index 1e6d673fe..1be0bfce2 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java +++ b/src/main/java/org/breedinginsight/brapi/v2/BrAPIPedigreeController.java @@ -95,13 +95,14 @@ public HttpResponse pedigreeGet(@PathVariable("progra try { List pedigree = pedigreeDAO.getPedigree( program.get(), - Optional.ofNullable(includeParents), - Optional.ofNullable(includeSiblings), - Optional.ofNullable(includeProgeny), - Optional.ofNullable(includeFullTree), - Optional.ofNullable(pedigreeDepth), - Optional.ofNullable(progenyDepth), - Optional.ofNullable(germplasmName)); + includeParents, + includeSiblings, + includeProgeny, + includeFullTree, + pedigreeDepth, + progenyDepth, + germplasmName, + accessionNumber); return HttpResponse.ok( new BrAPIPedigreeListResponse() diff --git a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java index a00957f2c..3a164c07d 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java +++ b/src/main/java/org/breedinginsight/brapi/v2/dao/BrAPIPedigreeDAO.java @@ -73,13 +73,14 @@ public BrAPIPedigreeDAO(ProgramDAO programDAO, BrAPIDAOUtil brAPIDAOUtil, */ public List getPedigree( Program program, - Optional includeParents, - Optional includeSiblings, - Optional includeProgeny, - Optional includeFullTree, - Optional pedigreeDepth, - Optional progenyDepth, - Optional germplasmName + Boolean includeParents, + Boolean includeSiblings, + Boolean includeProgeny, + Boolean includeFullTree, + Integer pedigreeDepth, + Integer progenyDepth, + String germplasmName, + String accessionNumber ) throws ApiException { PedigreeQueryParams pedigreeRequest = new PedigreeQueryParams(); @@ -94,13 +95,14 @@ public List getPedigree( pedigreeRequest.externalReferenceId(extRefId); pedigreeRequest.externalReferenceSource(extRefSrc); - includeParents.ifPresent(pedigreeRequest::includeParents); - includeSiblings.ifPresent(pedigreeRequest::includeSiblings); - includeProgeny.ifPresent(pedigreeRequest::includeProgeny); - includeFullTree.ifPresent(pedigreeRequest::includeFullTree); - pedigreeDepth.ifPresent(pedigreeRequest::pedigreeDepth); - progenyDepth.ifPresent(pedigreeRequest::progenyDepth); - germplasmName.ifPresent(pedigreeRequest::germplasmName); + if (includeParents != null) pedigreeRequest.includeParents(includeParents); + if (includeSiblings != null) pedigreeRequest.includeSiblings(includeSiblings); + if (includeProgeny != null) pedigreeRequest.includeProgeny(includeProgeny); + if (includeFullTree != null) pedigreeRequest.includeFullTree(includeFullTree); + if (pedigreeDepth != null) pedigreeRequest.pedigreeDepth(pedigreeDepth); + if (progenyDepth != null) pedigreeRequest.progenyDepth(progenyDepth); + if (germplasmName != null) pedigreeRequest.germplasmName(germplasmName); + if (accessionNumber != null) pedigreeRequest.accessionNumber(accessionNumber); // TODO: other parameters // TODO: write utility to do paging instead of hardcoding