Search in sources :

Example 1 with ListMetadataBlocksCommand

use of edu.harvard.iq.dataverse.engine.command.impl.ListMetadataBlocksCommand in project dataverse by IQSS.

the class Dataverses method listMetadataBlocks.

@GET
@Path("{identifier}/metadatablocks")
public Response listMetadataBlocks(@PathParam("identifier") String dvIdtf) {
    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 allowCors(ok(arr));
    } catch (WrappedResponse we) {
        return we.getResponse();
    }
}
Also used : MetadataBlock(edu.harvard.iq.dataverse.MetadataBlock) ListMetadataBlocksCommand(edu.harvard.iq.dataverse.engine.command.impl.ListMetadataBlocksCommand) JsonArrayBuilder(javax.json.JsonArrayBuilder) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

MetadataBlock (edu.harvard.iq.dataverse.MetadataBlock)1 ListMetadataBlocksCommand (edu.harvard.iq.dataverse.engine.command.impl.ListMetadataBlocksCommand)1 JsonArrayBuilder (javax.json.JsonArrayBuilder)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1