This repository was archived by the owner on Aug 1, 2025. It is now read-only.
forked from plantbreeding/brapi-Java-TestServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Germplasm Search Optimizations #49
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8316721
Prevent pagination from occurring while join fetching on germs
jloux-brapi cc5d9c6
Add SecurityUtils
jloux-brapi ec4055a
Add default sort to all SearchQueryBuilder queries on entity id.
jloux-brapi 773b307
SearchQueryBuilder and BrAPIRepositoryImpl overhaul for germ optimiza…
jloux-brapi 1b06e85
Fix paging response metadata bug, patch UUID issue
jloux-brapi 9ff25a5
Add error handling for bad pagination RQs to avoid giant queries and …
jloux-brapi 2526b1e
Add configurable default page size and max allowed page size
jloux-brapi 0f56f73
Fix bug where pedigree attribute was misspelled
jloux-brapi d148e5d
Remove erroneous imports from SearchRequest
jloux-brapi 55b1841
Revert erroneous JsonbConverter change
jloux-brapi 407242c
Swap ref to externalReferenceID w externalReferenceId
jloux-brapi b59ec3e
Revert changes around externalReferenceID and unused params
jloux-brapi 2de845c
Update comment, move default sort String to constructor
jloux-brapi 38cf473
Merge branch 'develop' into germ-search-opts
jloux-brapi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ | |
| import io.swagger.model.core.BatchDeletesListResponseResult; | ||
| import org.brapi.test.BrAPITestServer.auth.AuthDetails; | ||
| import org.brapi.test.BrAPITestServer.exceptions.BrAPIServerException; | ||
| import org.brapi.test.BrAPITestServer.exceptions.InvalidPagingException; | ||
| import org.brapi.test.BrAPITestServer.service.PagingUtility; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.http.HttpStatus; | ||
|
|
@@ -33,29 +33,14 @@ | |
|
|
||
| public class BrAPIController { | ||
| private static final Logger log = LoggerFactory.getLogger(ServerInfoApiController.class); | ||
|
|
||
| protected Metadata generateMetaDataTemplateForSearch(Integer originalRequestedPage, Integer newRequestedPage, | ||
| Integer originalRequestedPageSize, Integer newRequestedPageSize) throws BrAPIServerException { | ||
| Integer page = newRequestedPage; | ||
| Integer pageSize = newRequestedPageSize; | ||
|
|
||
| if (page == null) { | ||
| page = originalRequestedPage; | ||
| } | ||
| if (pageSize == null) { | ||
| pageSize = originalRequestedPageSize; | ||
| } | ||
|
|
||
| return generateMetaDataTemplate(page, pageSize); | ||
| } | ||
|
|
||
| protected Metadata generateMetaDataTemplate(SearchRequest request) throws BrAPIServerException { | ||
| return generateMetaDataTemplate(request.getPage(), request.getPageSize()); | ||
| } | ||
|
|
||
| protected Metadata generateMetaDataTemplate(String pageToken, Integer pageSize) { | ||
| if (pageSize == null) { | ||
| pageSize = 1000; | ||
| pageSize = PagingUtility.getDefaultPageSize(); | ||
| } | ||
|
|
||
| Metadata metaData = generateEmptyMetadataToken(); | ||
|
|
@@ -65,14 +50,14 @@ protected Metadata generateMetaDataTemplate(String pageToken, Integer pageSize) | |
| } | ||
|
|
||
| protected Metadata generateMetaDataTemplate(Integer page, Integer pageSize) throws BrAPIServerException { | ||
| validatePaging(page, pageSize); | ||
| PagingUtility.validatePaging(page, pageSize); | ||
|
|
||
| // defaults | ||
| if (page == null) { | ||
| page = 0; | ||
| } | ||
| if (pageSize == null) { | ||
| pageSize = 1000; | ||
| pageSize = PagingUtility.getDefaultPageSize(); | ||
| } | ||
|
|
||
| Metadata metaData = generateEmptyMetadata(); | ||
|
|
@@ -81,16 +66,6 @@ protected Metadata generateMetaDataTemplate(Integer page, Integer pageSize) thro | |
| return metaData; | ||
| } | ||
|
|
||
| private void validatePaging(Integer page, Integer pageSize) throws BrAPIServerException { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to |
||
| boolean pageValid = (page == null) || (page >= 0); | ||
| if (!pageValid) | ||
| throw new InvalidPagingException("page"); | ||
| boolean pageSizeValid = (pageSize == null) || (pageSize >= 1); | ||
| if (!pageSizeValid) | ||
| throw new InvalidPagingException("pageSize"); | ||
|
|
||
| } | ||
|
|
||
| protected Metadata generateEmptyMetadata() { | ||
| Metadata metaData = new Metadata(); | ||
| metaData.setDatafiles(new ArrayList<>()); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,12 @@ | |
| import io.swagger.model.SearchRequest; | ||
| import io.swagger.model.core.BatchDeleteTypes; | ||
| import jakarta.validation.Valid; | ||
| import org.brapi.test.BrAPITestServer.exceptions.BrAPIServerException; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface BrAPIComponent<T, R extends SearchRequest> { | ||
| List<T> findEntities(@Valid R request, Metadata metadata); | ||
| List<T> findEntities(@Valid R request, Metadata metadata) throws BrAPIServerException; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these |
||
| BatchDeleteTypes getBatchDeleteType(); | ||
| List<String> collectDbIds(List<T> entities); | ||
| void deleteBatchDeleteData(List<String> dbIds); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unused.