use of org.opencastproject.workflow.impl.WorkflowServiceImpl in project opencast by opencast.
the class WorkflowRestService method getOperationHandlers.
@GET
@Path("handlers.json")
@SuppressWarnings("unchecked")
@RestQuery(name = "handlers", description = "List all registered workflow operation handlers (implementations).", returnDescription = "A JSON representation of the registered workflow operation handlers.", reponses = { @RestResponse(responseCode = SC_OK, description = "A JSON representation of the registered workflow operation handlers") })
public Response getOperationHandlers() {
JSONArray jsonArray = new JSONArray();
for (HandlerRegistration reg : ((WorkflowServiceImpl) service).getRegisteredHandlers()) {
WorkflowOperationHandler handler = reg.getHandler();
JSONObject jsonHandler = new JSONObject();
jsonHandler.put("id", handler.getId());
jsonHandler.put("description", handler.getDescription());
JSONObject jsonConfigOptions = new JSONObject();
for (Entry<String, String> configEntry : handler.getConfigurationOptions().entrySet()) {
jsonConfigOptions.put(configEntry.getKey(), configEntry.getValue());
}
jsonHandler.put("options", jsonConfigOptions);
jsonArray.add(jsonHandler);
}
return Response.ok(jsonArray.toJSONString()).header("Content-Type", MediaType.APPLICATION_JSON).build();
}
Aggregations