@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response getWorkflows(@DefaultValue("false") @QueryParam("isJson") boolean isJson) {
AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
try {
Map<String, String> workflows = airavataRegistry.getWorkflows();
WorkflowList workflowList = new WorkflowList();
List<Workflow> workflowsModels = new ArrayList<Workflow>();
for (String workflowName : workflows.keySet()) {
Workflow workflow = new Workflow();
workflow.setWorkflowName(workflowName);
String workflowGraph = workflows.get(workflowName);
if (isJson && workflowGraph.startsWith("<")) {
workflowGraph = getJSONWorkflowGraph(workflowGraph);
}
workflow.setWorkflowGraph(workflowGraph);
workflowsModels.add(workflow);
}
workflowList.setWorkflowList(workflowsModels);
Response.ResponseBuilder builder = Response.status(Response.Status.OK);
builder.entity(workflowList);
return builder.build();
} catch (Throwable e) {
return WebAppUtil.reportInternalServerError(ResourcePathConstants.UserWFConstants.GET_WORKFLOWS, e);