Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #434 from pablolmiranda/batch-fetch-for-correlatio…
Browse files Browse the repository at this point in the history
…nIDs

Adds a batch API to fetch workflows based on a correlation id list
  • Loading branch information
pctreddy authored Feb 26, 2018
2 parents a37bb10 + 72d2649 commit db7dbdd
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -117,6 +118,21 @@ public List<Workflow> getWorkflows(@PathParam("name") String name, @PathParam("c
@QueryParam("includeTasks") @DefaultValue("false") boolean includeTasks) throws Exception {
return service.getWorkflowInstances(name, correlationId, includeClosed, includeTasks);
}

@POST
@Path("/{name}/correlated")
@ApiOperation("Lists workflows for the given correlation id list")
@Consumes(MediaType.WILDCARD)
public Map<String, List<Workflow>> getWorkflows(@PathParam("name") String name,
@QueryParam("includeClosed") @DefaultValue("false") boolean includeClosed,
@QueryParam("includeTasks") @DefaultValue("false") boolean includeTasks, List<String> correlationIds) throws Exception {
Map<String, List<Workflow>> workflows = new HashMap<>();
for(String correlationId : correlationIds) {
List<Workflow> ws = service.getWorkflowInstances(name, correlationId, includeClosed, includeTasks);
workflows.put(correlationId, ws);
}
return workflows;
}

@GET
@Path("/{workflowId}")
Expand Down

0 comments on commit db7dbdd

Please sign in to comment.