diff --git a/src/main/java/org/breedinginsight/brapi/v2/services/BrAPIGermplasmService.java b/src/main/java/org/breedinginsight/brapi/v2/services/BrAPIGermplasmService.java index 74fc8017d..468a6b5b3 100644 --- a/src/main/java/org/breedinginsight/brapi/v2/services/BrAPIGermplasmService.java +++ b/src/main/java/org/breedinginsight/brapi/v2/services/BrAPIGermplasmService.java @@ -85,7 +85,8 @@ public List> processListData(List germplasm, // Use the entry number in the list map if generated if(new UUID(0,0).compareTo(germplasmListId) == 0) { - row.put("Entry No", germplasmEntry.getAdditionalInfo().get(BrAPIAdditionalInfoFields.GERMPLASM_IMPORT_ENTRY_NUMBER).getAsInt()); + // Not downloading a real list, use GID (https://breedinginsight.atlassian.net/browse/BI-2266). + row.put("Entry No", Integer.valueOf(germplasmEntry.getAccessionNumber())); } else { row.put("Entry No", germplasmEntry.getAdditionalInfo() .getAsJsonObject(BrAPIAdditionalInfoFields.GERMPLASM_LIST_ENTRY_NUMBERS).get(germplasmListId.toString()).getAsInt()); @@ -153,6 +154,7 @@ public List getGermplasmByList(UUID programId, String listDbId) return germplasm; } else throw new ApiException(); } + public DownloadFile exportGermplasm(UUID programId, FileType fileExtension) throws IllegalArgumentException, ApiException, IOException { List columns = GermplasmFileColumns.getOrderedColumns(); diff --git a/src/test/java/org/breedinginsight/services/BrAPIGermplasmServiceUnitTest.java b/src/test/java/org/breedinginsight/services/BrAPIGermplasmServiceUnitTest.java index afa00df4e..8f906c169 100644 --- a/src/test/java/org/breedinginsight/services/BrAPIGermplasmServiceUnitTest.java +++ b/src/test/java/org/breedinginsight/services/BrAPIGermplasmServiceUnitTest.java @@ -169,6 +169,8 @@ public void getGermplasmListExport() { assertEquals(expectedColumnNames, resultTable.columnNames(), "Incorrect columns were exported"); assertEquals(2, resultTable.rowCount(), "Wrong number of rows were exported"); assertEquals("Germplasm A", resultTable.get(0, 1), "Incorrect data exported"); - assertEquals("2", resultTable.get(0, 6), "Incorrect data exported"); + // Check that "GID" column matches "Entry No" for both (https://breedinginsight.atlassian.net/browse/BI-2266). + assertEquals(resultTable.get(0,0), resultTable.get(0, 6), "Incorrect data exported"); + assertEquals(resultTable.get(1,0), resultTable.get(1, 6), "Incorrect data exported"); } }