@Test public void shouldReturnOkWhenGetWorkflowDefinitions() throws Exception { Map<String, WorkFlow> map = new HashMap<>(); map.put(EXITS_WORKFLOW_ID, new WorkFlow().setIdentifier(EXITS_WORKFLOW_ID)); when(processManagement.getWorkflowDefinitions()).thenReturn(map); given() .contentType(ContentType.JSON) .headers(GlobalDataRest.X_REQUEST_ID, ID, GlobalDataRest.X_TENANT_ID, TENANT_ID) .when().get(WORKFLOWS_URI).then() .statusCode(Status.OK.getStatusCode()).assertThat() .body(containsString(EXITS_WORKFLOW_ID)); }
@Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) public Response getWorkflowDefinitions() { try { List<WorkFlow> workflowDefinitions = new ArrayList<>(processManagement.getWorkflowDefinitions().values()); RequestResponseOK<WorkFlow> response = new RequestResponseOK<>(); response.addAllResults(workflowDefinitions) .setHits(workflowDefinitions.size(), 0, workflowDefinitions.size(), workflowDefinitions.size()) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (Exception e) { LOGGER.error("Error while retrieving workflow definitions : ", e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(VitamCodeHelper.toVitamError(VitamCode.WORKFLOW_DEFINITION_ERROR, e.getLocalizedMessage())) .build(); } }
ProcessManagementResource extends ApplicationStatusResource { @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) public Response getWorkflowDefinitions() { try { List<WorkFlow> workflowDefinitions = new ArrayList<>(processManagement.getWorkflowDefinitions().values()); RequestResponseOK<WorkFlow> response = new RequestResponseOK<>(); response.addAllResults(workflowDefinitions) .setHits(workflowDefinitions.size(), 0, workflowDefinitions.size(), workflowDefinitions.size()) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (Exception e) { LOGGER.error("Error while retrieving workflow definitions : ", e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(VitamCodeHelper.toVitamError(VitamCode.WORKFLOW_DEFINITION_ERROR, e.getLocalizedMessage())) .build(); } } }
ProcessManagementResource extends ApplicationStatusResource { @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) public Response getWorkflowDefinitions() { try { List<WorkFlow> workflowDefinitions = new ArrayList<>(processManagement.getWorkflowDefinitions().values()); RequestResponseOK<WorkFlow> response = new RequestResponseOK<>(); response.addAllResults(workflowDefinitions) .setHits(workflowDefinitions.size(), 0, workflowDefinitions.size(), workflowDefinitions.size()) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (Exception e) { LOGGER.error("Error while retrieving workflow definitions : ", e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(VitamCodeHelper.toVitamError(VitamCode.WORKFLOW_DEFINITION_ERROR, e.getLocalizedMessage())) .build(); } } ProcessManagementResource(ServerConfiguration configuration, ProcessDistributor processDistributor);   ProcessManagementResource(ProcessManagement pManagement, ServerConfiguration configuration); }
ProcessManagementResource extends ApplicationStatusResource { @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) public Response getWorkflowDefinitions() { try { List<WorkFlow> workflowDefinitions = new ArrayList<>(processManagement.getWorkflowDefinitions().values()); RequestResponseOK<WorkFlow> response = new RequestResponseOK<>(); response.addAllResults(workflowDefinitions) .setHits(workflowDefinitions.size(), 0, workflowDefinitions.size(), workflowDefinitions.size()) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (Exception e) { LOGGER.error("Error while retrieving workflow definitions : ", e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(VitamCodeHelper.toVitamError(VitamCode.WORKFLOW_DEFINITION_ERROR, e.getLocalizedMessage())) .build(); } } ProcessManagementResource(ServerConfiguration configuration, ProcessDistributor processDistributor);   ProcessManagementResource(ProcessManagement pManagement, ServerConfiguration configuration); ProcessLifeCycle getProcessLifeCycle(); @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDefinitions(); @Path("workflows/{workfowId}") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDetails(@PathParam("workfowId") String workfowId); @Path("operations/{id}") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response executeWorkFlow(@Context HttpHeaders headers, @PathParam("id") String id, ProcessingEntry process); @Path("operations/{id}") @GET @Produces(MediaType.APPLICATION_JSON) Response getOperationProcessExecutionDetails(@PathParam("id") String id); @Path("operations/{id}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateWorkFlowStatus(@Context HttpHeaders headers, @PathParam("id") String id); @Path("operations/{id}") @DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response cancelOperationProcessExecution(@PathParam("id") String id); @Path("operations/{id}") @HEAD @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response getWorkFlowState(@PathParam("id") String id); @GET @Path("/operations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response findProcessWorkflow(ProcessQuery query); @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response forcePause(ProcessPause info); @Path("/removeforcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response removeForcePause(ProcessPause info); }
ProcessManagementResource extends ApplicationStatusResource { @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) public Response getWorkflowDefinitions() { try { List<WorkFlow> workflowDefinitions = new ArrayList<>(processManagement.getWorkflowDefinitions().values()); RequestResponseOK<WorkFlow> response = new RequestResponseOK<>(); response.addAllResults(workflowDefinitions) .setHits(workflowDefinitions.size(), 0, workflowDefinitions.size(), workflowDefinitions.size()) .setHttpCode(Status.OK.getStatusCode()); return Response.status(Status.OK).entity(response).build(); } catch (Exception e) { LOGGER.error("Error while retrieving workflow definitions : ", e); return Response.status(Status.INTERNAL_SERVER_ERROR) .entity(VitamCodeHelper.toVitamError(VitamCode.WORKFLOW_DEFINITION_ERROR, e.getLocalizedMessage())) .build(); } } ProcessManagementResource(ServerConfiguration configuration, ProcessDistributor processDistributor);   ProcessManagementResource(ProcessManagement pManagement, ServerConfiguration configuration); ProcessLifeCycle getProcessLifeCycle(); @Path("workflows") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDefinitions(); @Path("workflows/{workfowId}") @GET @Produces(MediaType.APPLICATION_JSON) Response getWorkflowDetails(@PathParam("workfowId") String workfowId); @Path("operations/{id}") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response executeWorkFlow(@Context HttpHeaders headers, @PathParam("id") String id, ProcessingEntry process); @Path("operations/{id}") @GET @Produces(MediaType.APPLICATION_JSON) Response getOperationProcessExecutionDetails(@PathParam("id") String id); @Path("operations/{id}") @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response updateWorkFlowStatus(@Context HttpHeaders headers, @PathParam("id") String id); @Path("operations/{id}") @DELETE @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response cancelOperationProcessExecution(@PathParam("id") String id); @Path("operations/{id}") @HEAD @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response getWorkFlowState(@PathParam("id") String id); @GET @Path("/operations") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response findProcessWorkflow(ProcessQuery query); @Path("/forcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response forcePause(ProcessPause info); @Path("/removeforcepause") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response removeForcePause(ProcessPause info);  }