Skip to content

Commit

Permalink
Client API fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robcalla committed Oct 15, 2018
1 parent 37efa35 commit 4e0eba0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Idra/src/main/java/it/eng/idra/api/ClientAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public Response getCataloguesInfo(@Context HttpServletRequest httpRequest) {
@Produces("application/json")
public Response getODMSCatalogues(
@QueryParam("withImage") @DefaultValue("true") boolean withImage,
@QueryParam("orderType") @DefaultValue("name") String orderType,
@QueryParam("orderType") @DefaultValue("asc") String orderType,
@QueryParam("orderBy") @DefaultValue("id") String orderBy,
@QueryParam("rows") @DefaultValue("10") String rows,
@QueryParam("offset") @DefaultValue("0") String offset,
Expand Down Expand Up @@ -968,15 +968,17 @@ public Response getSingleDataset(@Context HttpServletRequest httpRequest,@PathPa
public Response getDatasetByID(@Context HttpServletRequest httpRequest,@PathParam("id") String id) {

try {
DCATDataset result = MetadataCacheManager.getDatasetByID(id);
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.datasetType)).build();

try {
DCATDataset result = MetadataCacheManager.getDatasetByID(id);
return Response.status(Response.Status.OK).entity(GsonUtil.obj2Json(result, GsonUtil.datasetType)).build();
}catch (DatasetNotFoundException e) {
// TODO Auto-generated catch block
ErrorResponse err = new ErrorResponse(String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Dataset with id: "+id+" not found", String.valueOf(Response.Status.NOT_FOUND.getStatusCode()), "Dataset with id: "+id+" not found");
return Response.status(Response.Status.NOT_FOUND).entity(GsonUtil.obj2Json(err, GsonUtil.errorResponseSetType)).build();
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (DatasetNotFoundException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
} catch (IOException e) {
// TODO Auto-generated catch block
return handleErrorResponse500(e);
Expand Down

0 comments on commit 4e0eba0

Please sign in to comment.