Skip to content

Commit

Permalink
Merge pull request #3472 from IQSS/3425-get-metadata-blocks-empty
Browse files Browse the repository at this point in the history
API for getting metadata blocks works again.
  • Loading branch information
kcondon authored Nov 29, 2016
2 parents 0cefe11 + f35b9e8 commit f739a75
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main/java/edu/harvard/iq/dataverse/api/Dataverses.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,16 @@ public Response deleteDataverse( @PathParam("identifier") String idtf ) {
@GET
@Path("{identifier}/metadatablocks")
public Response listMetadataBlocks( @PathParam("identifier") String dvIdtf ) {
return response( req ->ok(
execCommand( new ListMetadataBlocksCommand(req, findDataverseOrDie(dvIdtf)))
.stream().map(brief::json).collect( toJsonArray() )
));
try {
JsonArrayBuilder arr = Json.createArrayBuilder();
final List<MetadataBlock> blocks = execCommand( new ListMetadataBlocksCommand(createDataverseRequest(findUserOrDie()), findDataverseOrDie(dvIdtf)));
for ( MetadataBlock mdb : blocks) {
arr.add( brief.json(mdb) );
}
return ok(arr);
} catch (WrappedResponse we ){
return we.getResponse();
}
}

@POST
Expand Down

0 comments on commit f739a75

Please sign in to comment.