use of io.automatiko.engine.addons.process.management.model.ProcessDTO in project automatiko-engine by automatiko-io.
the class ProcessInstanceManagementResource method get.
@APIResponses(value = { @APIResponse(responseCode = "200", description = "List of available processes", content = @Content(mediaType = "application/json")) })
@Operation(summary = "Lists available public processes in the service")
@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public List<ProcessDTO> get(@Context UriInfo uriInfo, @Parameter(description = "Pagination - page to start on", required = false) @QueryParam(value = "page") @DefaultValue("1") int page, @Parameter(description = "Pagination - number of items to return", required = false) @QueryParam(value = "size") @DefaultValue("10") int size, @Parameter(description = "User identifier as alternative autroization info", required = false, hidden = true) @QueryParam("user") final String user, @Parameter(description = "Groups as alternative autroization info", required = false, hidden = true) @QueryParam("group") final List<String> groups) {
List<ProcessDTO> collected = new ArrayList<ProcessDTO>();
try {
identitySupplier.buildIdentityProvider(user, groups);
for (String id : processData.keySet()) {
Process<?> process = processData.get(id);
if (!WorkflowProcess.PUBLIC_VISIBILITY.equals(((WorkflowProcess) ((AbstractProcess<?>) process).process()).getVisibility())) {
continue;
}
String pathprefix = "";
if (process.version() != null) {
pathprefix = "v" + process.version().replaceAll("\\.", "_") + "/";
}
collected.add(new ProcessDTO(id, process.version(), process.name(), (String) ((AbstractProcess<?>) process).process().getMetaData().get("Documentation"), uriInfo.getBaseUri().toString() + pathprefix + ((AbstractProcess<?>) process).process().getId() + "/image", process.instances().size()));
}
return collected;
} finally {
IdentityProvider.set(null);
}
}
Aggregations