Search in sources :

Example 1 with GetLatestAccessibleDatasetVersionCommand

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

the class Datasets method getDataset.

@GET
@Path("{id}")
public Response getDataset(@PathParam("id") String id) {
    return response(req -> {
        final Dataset retrieved = execCommand(new GetDatasetCommand(req, findDatasetOrDie(id)));
        final DatasetVersion latest = execCommand(new GetLatestAccessibleDatasetVersionCommand(req, retrieved));
        final JsonObjectBuilder jsonbuilder = json(retrieved);
        return allowCors(ok(jsonbuilder.add("latestVersion", (latest != null) ? json(latest) : null)));
    });
}
Also used : GetLatestAccessibleDatasetVersionCommand(edu.harvard.iq.dataverse.engine.command.impl.GetLatestAccessibleDatasetVersionCommand) Dataset(edu.harvard.iq.dataverse.Dataset) GetDatasetCommand(edu.harvard.iq.dataverse.engine.command.impl.GetDatasetCommand) DatasetVersion(edu.harvard.iq.dataverse.DatasetVersion) JsonObjectBuilder(javax.json.JsonObjectBuilder) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Aggregations

Dataset (edu.harvard.iq.dataverse.Dataset)1 DatasetVersion (edu.harvard.iq.dataverse.DatasetVersion)1 GetDatasetCommand (edu.harvard.iq.dataverse.engine.command.impl.GetDatasetCommand)1 GetLatestAccessibleDatasetVersionCommand (edu.harvard.iq.dataverse.engine.command.impl.GetLatestAccessibleDatasetVersionCommand)1 JsonObjectBuilder (javax.json.JsonObjectBuilder)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1