Skip to content

Commit

Permalink
[ALS-4980] Update PicSureService to match contract with PIC-SURe API
Browse files Browse the repository at this point in the history
  • Loading branch information
Gcolon021 authored Sep 18, 2023
1 parent 3dc96b5 commit a43a209
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ private QueryStatus convertToQueryStatus(AsyncResult entity) {
@Path("/query/{resourceQueryId}/result")
@Produces(MediaType.TEXT_PLAIN_VALUE)
@Override
public Response queryResult(@PathParam("resourceQueryId") String queryId, QueryRequest resultRequest) {
AsyncResult result = queryService.getResultFor(queryId);
public Response queryResult(@PathParam("resourceQueryId") UUID queryId, QueryRequest resultRequest) {
AsyncResult result = queryService.getResultFor(queryId.toString());
if (result == null) {
// This happens sometimes when users immediately request the status for a query
// before it can be initialized. We wait a bit and try again before throwing an
Expand All @@ -237,7 +237,7 @@ public Response queryResult(@PathParam("resourceQueryId") String queryId, QueryR
return Response.status(500).build();
}

result = queryService.getResultFor(queryId);
result = queryService.getResultFor(queryId.toString());
if (result == null) {
return Response.status(404).build();
}
Expand All @@ -253,8 +253,8 @@ public Response queryResult(@PathParam("resourceQueryId") String queryId, QueryR
@POST
@Path("/query/{resourceQueryId}/status")
@Override
public QueryStatus queryStatus(@PathParam("resourceQueryId") String queryId, QueryRequest request) {
return convertToQueryStatus(queryService.getStatusFor(queryId));
public QueryStatus queryStatus(@PathParam("resourceQueryId") UUID queryId, QueryRequest request) {
return convertToQueryStatus(queryService.getStatusFor(queryId.toString()));
}

@POST
Expand Down Expand Up @@ -328,7 +328,7 @@ private Response _querySync(QueryRequest resultRequest) throws IOException {
QueryStatus status = query(resultRequest);
while (status.getResourceStatus().equalsIgnoreCase("RUNNING")
|| status.getResourceStatus().equalsIgnoreCase("PENDING")) {
status = queryStatus(status.getResourceResultId(), null);
status = queryStatus(UUID.fromString(status.getResourceResultId()), null);
}
log.info(status.toString());

Expand Down

0 comments on commit a43a209

Please sign in to comment.