Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public List<Map<String, Object>> processListData(List<BrAPIGermplasm> germplasm,
for (BrAPIGermplasm germplasmEntry: germplasm) {
HashMap<String, Object> row = new HashMap<>();
row.put("GID", Integer.valueOf(germplasmEntry.getAccessionNumber()));
row.put("Name", germplasmEntry.getGermplasmName());
row.put("Germplasm Name", germplasmEntry.getGermplasmName());
row.put("Breeding Method", germplasmEntry.getAdditionalInfo().get(BrAPIAdditionalInfoFields.GERMPLASM_BREEDING_METHOD).getAsString());
String source = germplasmEntry.getSeedSource();
row.put("Source", source);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
public enum GermplasmFileColumns {

GID("GID", Column.ColumnDataType.INTEGER),
NAME("Name", Column.ColumnDataType.STRING),
NAME("Germplasm Name", Column.ColumnDataType.STRING),
BREEDING_METHOD("Breeding Method", Column.ColumnDataType.STRING),
SOURCE("Source", Column.ColumnDataType.STRING),
FEMALE_PARENT_GID("Female Parent GID", Column.ColumnDataType.INTEGER),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

update importer_mapping
set mapping = '[{"id": "f8d43c7e-a618-4c16-8829-3085f7202a67", "mapping": [{"id": "f384837e-ad8d-4dbe-b54e-87b57070bed1", "value": {"fileFieldName": "Germplasm Name"}, "objectId": "germplasmName"}, {"id": "39628d14-458b-429b-8e66-bb48e0445a83", "value": {"fileFieldName": "Breeding Method"}, "objectId": "breedingMethod"}, {"id": "f1ba63e1-f5e4-433f-a53e-1c2f3e2fa71f", "value": {"fileFieldName": "Source"}, "objectId": "germplasmSource"}, {"id": "f5892565-f888-4596-be82-ab8eeabf37ce", "value": {"fileFieldName": "External UID"}, "objectId": "externalUID"}, {"id": "65507e5d-2d66-4595-8763-e772fe25c870", "value": {"fileFieldName": "Entry No"}, "objectId": "entryNo"}, {"id": "3eae24c1-ca4a-48a2-96d0-3cf4630acd3a", "value": {"fileFieldName": "Female Parent GID"}, "objectId": "femaleParentDBID"}, {"id": "2dbd7262-93a1-44b0-86b7-f5fca290b965", "value": {"fileFieldName": "Male Parent GID"}, "objectId": "maleParentDBID"}, {"id": "6f7f1539-6e8f-4ede-b7d3-3423cc63abec", "value": {"fileFieldName": "Female Parent Entry No"}, "objectId": "femaleParentEntryNo"}, {"id": "25fe9954-bca7-42f1-818a-5f71e242fa1f", "value": {"fileFieldName": "Male Parent Entry No"}, "objectId": "maleParentEntryNo"}, {"id": "b910adfe-a474-47a0-8410-514578898436", "value": {"fileFieldName": "Synonyms"}, "objectId": "synonyms"}, {"id": "15836d5f-8194-40a8-a771-114eaae31eb4", "objectId": "germplasmPUI"}, {"id": "675b6af8-5a17-4146-a503-2e4e1a65d5fa", "objectId": "acquisitionDate"}, {"id": "69a3bd3c-cebc-435c-acdd-0be62dda25ed", "objectId": "countryOfOrigin"}, {"id": "8ab25267-20f2-450e-89ca-21634ff8fadb", "objectId": "collection"}, {"id": "ce1701e2-2f61-4250-8595-9536e3f5ddcf", "objectId": "AdditionalInfo"}, {"id": "3470e9df-a028-45b7-943f-198bc62b6dbe", "objectId": "ExternalReference"}], "objectId": "Germplasm"}]',
file = '[{"Germplasm Name": "BITest Pinot Noir", "Source": "Unknown", "Entry No": "1", "External UID": "", "Breeding Method": "UMM", "Male Parent GID": "", "Female Parent GID": "", "Male Parent Entry No": "", "Female Parent Entry No": "", "Synonyms": "test1;test2"}, {"Name": "BITest Pixie", "Source": "Winters Nursery", "Entry No": "2", "External UID": "", "Breeding Method": "CFV", "Male Parent GID": "", "Female Parent GID": "", "Male Parent Entry No": "", "Female Parent Entry No": "1", "Synonyms": "test1;test2"}, {"Name": "BITest BI002", "Source": "Ithaca Nursery", "Entry No": "7", "External UID": "12231321", "Breeding Method": "Biparental cross", "Male Parent GID": "", "Female Parent GID": "", "Male Parent Entry No": "", "Female Parent Entry No": "2", "Synonyms": "test1;test2"}, {"Name": "BITest BI003", "Source": "Ithaca Nursery", "Entry No": "8", "External UID": "", "Breeding Method": "BPC", "Male Parent GID": "", "Female Parent GID": "", "Male Parent Entry No": "7", "Female Parent Entry No": "2", "Synonyms": "test1;test2"}, {"Name": "BITest Pinot Noir", "Source": "Unknown", "Entry No": "3", "External UID": "", "Breeding Method": "UMM", "Male Parent GID": "", "Female Parent GID": "5fb01ea5-c212-4cfa-84e4-6d190379341f", "Male Parent Entry No": "", "Female Parent Entry No": "", "Synonyms": "test1;test2"}, {"Name": "BITest Pixie", "Source": "Winters Nursery", "Entry No": "4", "External UID": "", "Breeding Method": "CFV", "Male Parent GID": "640e8b58-1b1c-44a6-91a6-85b2b773376b", "Female Parent GID": "5fb01ea5-c212-4cfa-84e4-6d190379341f", "Male Parent Entry No": "", "Female Parent Entry No": "", "Synonyms": "test1;test2"}, {"Name": "BITest BI002", "Source": "Ithaca Nursery", "Entry No": "5", "External UID": "12231321", "Breeding Method": "Biparental cross", "Male Parent GID": "", "Female Parent GID": "5fb01ea5-c212-4cfa-84e4-6d190379341f", "Male Parent Entry No": "", "Female Parent Entry No": "2", "Synonyms": "test1;test2"}]'
where name = 'GermplasmTemplateMap';
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public void fullImportPreviewSuccess() {

// Check preview specific items
// Germplasm name (display name)
assertEquals(fileData.getString(i, "Name"), germplasm.get("germplasmName").getAsString());
assertEquals(fileData.getString(i, "Germplasm Name"), germplasm.get("germplasmName").getAsString());
JsonObject additionalInfo = germplasm.getAsJsonObject("additionalInfo");
// Created Date (not present)
assertFalse(additionalInfo.has(BrAPIAdditionalInfoFields.CREATED_DATE), "createdDate is present, but should not be");
Expand Down Expand Up @@ -229,7 +229,7 @@ public void fullImportCommitSuccess() {

// Check commit specific items
// Germplasm name (display name)
String expectedGermplasmName = String.format("%s [%s-%s]", fileData.getString(i, "Name"), validProgram.getKey(), germplasm.get("accessionNumber").getAsString());
String expectedGermplasmName = String.format("%s [%s-%s]", fileData.getString(i, "Germplasm Name"), validProgram.getKey(), germplasm.get("accessionNumber").getAsString());
assertEquals(expectedGermplasmName, germplasm.get("germplasmName").getAsString());
// Created Date
JsonObject additionalInfo = germplasm.getAsJsonObject("additionalInfo");
Expand Down Expand Up @@ -531,8 +531,8 @@ public void emptyRequiredFieldsError() {
assertEquals(1, errors.size(), "Not enough errors were returned");
JsonObject error = errors.get(0).getAsJsonObject();
assertEquals(422, error.get("httpStatusCode").getAsInt(), "Incorrect http status code");
assertEquals("Name", error.get("field").getAsString(), "Incorrect field name");
assertEquals(importService.getBlankRequiredFieldMsg("Name"), error.get("errorMessage").getAsString(), "Incorrect error message");
assertEquals("Germplasm Name", error.get("field").getAsString(), "Incorrect field name");
assertEquals(importService.getBlankRequiredFieldMsg("Germplasm Name"), error.get("errorMessage").getAsString(), "Incorrect error message");

JsonObject rowError2 = rowErrors.get(1).getAsJsonObject();
JsonArray errors2 = rowError2.getAsJsonArray("errors");
Expand Down Expand Up @@ -648,7 +648,7 @@ public void selfReferenceParentError() {
public void checkBasicResponse(JsonObject germplasm, Table fileData, Integer i) {

// Germplasm display name
assertEquals(fileData.getString(i, "Name"), germplasm.get("defaultDisplayName").getAsString(), "Wrong display name");
assertEquals(fileData.getString(i, "Germplasm Name"), germplasm.get("defaultDisplayName").getAsString(), "Wrong display name");
// Entry Number
gson.fromJson(germplasm.getAsJsonObject("additionalInfo").getAsJsonObject("listEntryNumbers"), Map.class).forEach((listId, entryNumber) -> assertEquals(fileData.getString(i, "Entry No"), entryNumber, "Wrong entry number"));
JsonObject additionalInfo = germplasm.getAsJsonObject("additionalInfo");
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/files/fileutil/file_all_null_rows.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID
Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID
Buzz-1,BPC,Middle Earth,1,16,,,,
Buzz-2,CFV,Middle Earth,10,,,,,
,,,,,,,,
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/files/fileutil/file_some_null_rows.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID
Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID
Buzz-1,BPC,Middle Earth,1,16,,,,
Buzz-2,CFV,Middle Earth,10,,,,,
yeah,,,,,,,,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,ANE,Wild,,,,,,,
,Germplasm 2,BAD,Wild,,,,,,,
,Germplasm 3,BAD1,Wild,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,1,2,3,1234,
,Germplasm 2,BCR,Wild,,,2,1,2,5678,
,Germplasm 3,BCR,Wild,,,3,2,3,9123,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Full Germplasm 1,ANE,Wild,,,,,,,
,Full Germplasm 2,ANE,Wild,,,,,,,
,Full Germplasm 3,ANE,Wild,,,,,,,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,1,,,,
,Germplasm 2,BCR,Wild,,,1,,,,
,Germplasm 3,BCR,Wild,,,3,,,,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,ANE,Wild,,,,,,,
,,ANE,Wild,,,,,,,
,Germplasm 3,ANE,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,,Wild,,,,,,,
,,,Wild,,,,,,,
,Germplasm 3,,,,,,,,,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,1000,,,,,,
,Germplasm 2,BCR,Cultivated,1001,,,,,,
,Germplasm 3,BCR,Kinda Wild,1002,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,,1,,,
,Germplasm 2,BCR,Cultivated,,,,2,,,
,Germplasm 3,BCR,Kinda Wild,,,,3,,,
2 changes: 1 addition & 1 deletion src/test/resources/files/germplasm_import/full_import.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Full Germplasm 1,ANE,Wild,1,2,2,,,1234,test1;test2
,Full Germplasm 2,ANE,Wild,2,,3,,,5678,test3;test2
,Full Germplasm 3,ANE,Wild,,,4,2,3,9123,test3;test4
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
GID,Name,BREEDING METHOD,SOURCE,fEmAlE pArEnT gId,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,BREEDING METHOD,SOURCE,fEmAlE pArEnT gId,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germ A,ANE,the shire,,,1,,,ABC-123,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,,Wild,,100,,,,,
,Germplasm 2,,Cultivated,,101,,,,,
,Germplasm 3,,Kinda Wild,,102,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,100,,,,,
,Germplasm 2,BCR,Cultivated,,101,,,,,
,Germplasm 3,BCR,Kinda Wild,,102,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,,,1,,
,Germplasm 2,BCR,Cultivated,,,,,2,,
,Germplasm 3,BCR,Kinda Wild,,,,,3,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,,,,,
,Germplasm 2,BCR,Cultivated,,,,,,,
,Germplasm 3,BCR,Kinda Wild,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,ANE,Wild,,,,,,
,Germplasm 2,ANE,Wild,,,,,,
,Germplasm 3,ANE,Wild,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,,,,,,,,
,Germplasm 2,,,,,,,,
,Germplasm 3,,,,,,,,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,0,2,,,,1234,
,Germplasm 2,BCR,Wild,0,3,,,,5678,
,Germplasm 3,BCR,Wild,0,3,,,,9123,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,,Wild,,,a,,,,
,Germplasm 2,,Wild,,,b,,,,
,Germplasm 3,,Wild,,,3,,,,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,1,1,1,1234,
,Germplasm 2,BCR,Wild,,,2,2,2,5678,
,Germplasm 3,BCR,Wild,,,3,3,3,9123,
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GID,Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
GID,Germplasm Name,Breeding Method,Source,Female Parent GID,Male Parent GID,Entry No,Female Parent Entry No,Male Parent Entry No,External UID,Synonyms
,Germplasm 1,BCR,Wild,,,1,,,,
,Germplasm 2,BCR,Wild,,,,,,,
,Germplasm 3,BCR,Wild,,,3,,,,
Expand Down