Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
public final class BrAPIAdditionalInfoFields {
public static final String GERMPLASM_RAW_PEDIGREE = "rawPedigree";
public static final String GERMPLASM_PEDIGREE_BY_NAME = "pedigreeByName";
public static final String GERMPLASM_PEDIGREE_BY_UUID = "pedigreeByUUID";
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,29 @@ private Map<String,BrAPIGermplasm> processGermplasmForDisplay(List<BrAPIGermplas

String newPedigreeString = "";
String namePedigreeString = "";
String uuidPedigreeString = "";
List<String> parents = Arrays.asList(germplasm.getPedigree().split("/"));
if (parents.size() >= 1) {
if (programGermplasmByFullName.containsKey(parents.get(0))) {
newPedigreeString = programGermplasmByFullName.get(parents.get(0)).getAccessionNumber();
namePedigreeString = programGermplasmByFullName.get(parents.get(0)).getDefaultDisplayName();
uuidPedigreeString = programGermplasmByFullName.get(parents.get(0)).getExternalReferences().
stream().filter(ref -> ref.getReferenceSource().equals(referenceSource)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Did you mean to have the . on a separate line from the map and stream? I usually have seen it on the same line. If it's a style choice, feel free to keep it.

map(ref -> ref.getReferenceID()).findFirst().orElse("");
}
}
if (parents.size() == 2) {
if (programGermplasmByFullName.containsKey(parents.get(1))) {
newPedigreeString += "/" + programGermplasmByFullName.get(parents.get(1)).getAccessionNumber();
namePedigreeString += "/" + programGermplasmByFullName.get(parents.get(1)).getDefaultDisplayName();
uuidPedigreeString += "/" + programGermplasmByFullName.get(parents.get(1)).getExternalReferences().
stream().filter(ref -> ref.getReferenceSource().equals(referenceSource)).
map(ref -> ref.getReferenceID()).findFirst().orElse("");
}
}
//For use in individual germplasm display
additionalInfo.addProperty(BrAPIAdditionalInfoFields.GERMPLASM_PEDIGREE_BY_NAME, namePedigreeString);
additionalInfo.addProperty(BrAPIAdditionalInfoFields.GERMPLASM_PEDIGREE_BY_UUID, uuidPedigreeString);

germplasm.setPedigree(newPedigreeString);
}
Expand Down