[BI-1606] Allow germplasm records to be in multiple lists#224
Merged
[BI-1606] Allow germplasm records to be in multiple lists#224
Conversation
730ff3d to
e6f7952
Compare
timparsons
requested changes
Dec 13, 2022
Comment on lines
+228
to
+240
| private boolean hasListExternalReference(BrAPIListDetails listData) { | ||
| return listData.getExternalReferences().stream() | ||
| .anyMatch(e -> referenceSource.concat("/lists").equals(e.getReferenceSource())); | ||
| } | ||
|
|
||
| private boolean hasListExternalReference(BrAPIListNewRequest importList) { | ||
| return importList.getExternalReferences().stream() | ||
| .anyMatch(e -> referenceSource.concat("/lists").equals(e.getReferenceSource())); | ||
| } |
Member
There was a problem hiding this comment.
I think you could consolidate these methods together to accept List<ExternalReference> as a parameter (just check that the list isn't null before streaming over it)
davedrp
approved these changes
Dec 15, 2022
d2c9200 to
50f5b33
Compare
3276f4b to
c738f53
Compare
c738f53 to
3b912a7
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Description
Story: BI-1606
Instead of using the list name(which may or may not be unique in the future) as the key for the mapping described in the card, a UUID is created for new lists and stored as an entry in the list's external references.
Updated Germplasm#constructBrAPIList to add a new external reference with referenceSource set to <BRAPI_BASE_URL>/lists and referenceId set to a randomly generated UUID.
Updated Germplasm#constructBrAPIGermplasm(Program, BreedingMethodEntity, User, boolean, String, Supplier) to accept an argument of UUID germplasmListId
Updated Germplasm#constructBrAPIGermplasm(BreedingMethodEntity, User) to accept an argument of UUID germplasmListId
Updated the code in Germplasm#constructBrAPIGermplasm(BreedingMethodEntity, User) that currently sets GERMPLASM_IMPORT_ENTRY_NUMBER as follows
a. Created a Map<String, String> and add an entry where:
b. Set the map in the additionalInfo of the germplasm with a key of listEntryNumbers
Updated BrAPIGermplasmService#processData
a. Method now accepts an argument of UUID germplasmListId
b. updated the logic to set the entry number to either look in the map of import entry numbers for the specific germplasmListId or, for germplasm already created in the old format, look in additionalInfo.importEntryNumber
Updated the sorting of germplasm in BrAPIGermplasmService#exportGermplasmList to fetch the entry number for the list name that’s either within the map of list entry numbers or stored in additionalInfo.importEntryNumber.
Updated GermplasmProcessor#process to get the ID for the import list and pass it to Germplasm#constructBrAPIGermplasm.
Dependencies
biweb develop branch
Testing
Import germplasm with user-supplied entry numbers.
Go to the Germpasm Lists tab and use the dev tools console to inspect the list object in the response and verify there is an external reference entry for /lists and note the UUID stored as the refernceID.
Then view all imported germplasm and use the dev tools console to inspect the germplasm objects in the response from bi-api. Verify the additionalInfo field "listEntryNumbers" exists and the value is a Map with the imported list ID from step 2 as the key and entry number as value.
Import germplasm without user-supplied entry numbers and repeat process above.
Download the imported germplasm and verify the exported file records match what is stored.
Download a list of previously imported germplasm that store entry number values in additionalInfo.imortEntryNumber and verify the exported file records match what is stored.
Checklist: