use of dk.dbc.search.solrdocstore.response.WorkRetrieveResponse in project solr-document-store by DBCDK.
the class DocumentRetrieveBean method getWorkDocumentsWithHoldingsItems.
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Path("work/{ workid }")
@Timed
public Response getWorkDocumentsWithHoldingsItems(@Context UriInfo uriInfo, @PathParam("workid") String workId, @DefaultValue("false") @QueryParam("includeHoldingsItemsIndexKeys") boolean includeHoldingsItemsIndexKeys) throws Exception {
log.debug("Fetching manifestations for work {}, includeHIIK: {}", workId, includeHoldingsItemsIndexKeys);
try (LogWith logWith = track(null)) {
List<DocumentRetrieveResponse> responses = getDocumentsForWork(workId, includeHoldingsItemsIndexKeys);
if (responses == null || responses.isEmpty()) {
return Response.status(Response.Status.NOT_FOUND).header("X-DBC-Status", "200").entity("Work not found").build();
}
final WorkRetrieveResponse res = new WorkRetrieveResponse(workId, responses);
return Response.ok(res).build();
} catch (Exception ex) {
log.error("Error retrieving documents for work {}: {}", workId, ex.getMessage());
log.debug("Error retrieving documents for work {}: {}", workId, ex);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Error retrieving documents for work").build();
}
}
Aggregations