Skip to content

Commit

Permalink
restore 4.11 JSON format for Dataverse contacts #5724
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Apr 9, 2019
1 parent a77610c commit 50c0de8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,13 @@ public static JsonObjectBuilder json(Dataverse dv, Boolean hideEmail) {
}

public static JsonArrayBuilder json(List<DataverseContact> dataverseContacts) {
JsonArrayBuilder bld = Json.createArrayBuilder();
for(DataverseContact dc : dataverseContacts) {
bld.add(dc.getContactEmail());
}

return bld;
return dataverseContacts.stream()
.map(dc -> jsonObjectBuilder()
.add("displayOrder", dc.getDisplayOrder())
.add("contactEmail", dc.getContactEmail())
).collect(toJsonArray());
}

public static JsonObjectBuilder json( DataverseTheme theme ) {
final NullSafeJsonBuilder baseObject = jsonObjectBuilder()
.add("id", theme.getId() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ public void testDataversePrinter() {
assertEquals("dv42", jsonObject.getString("alias"));
assertEquals("Dataverse 42", jsonObject.getString("name"));
assertEquals("42 Inc.", jsonObject.getString("affiliation"));
assertEquals("[email protected]", jsonObject.getJsonArray("dataverseContacts").getString(0));
assertEquals(0, jsonObject.getJsonArray("dataverseContacts").getJsonObject(0).getInt("displayOrder"));
assertEquals("[email protected]", jsonObject.getJsonArray("dataverseContacts").getJsonObject(0).getString("contactEmail"));
assertEquals(false, jsonObject.getBoolean("permissionRoot"));
assertEquals("Description for Dataverse 42.", jsonObject.getString("description"));
assertEquals("UNCATEGORIZED", jsonObject.getString("dataverseType"));
Expand Down

0 comments on commit 50c0de8

Please sign in to comment.