@Test public void executeFindTasksQuery() { Marshaller marshaller = MarshallerFactory.getMarshaller(XSTREAM, this.getClass().getClassLoader()); Map<String, Object> params = new HashMap<>(); params.put("param", "value"); String payload = marshaller.marshall(params); List<TaskData> expectedResult = new ArrayList<>(); expectedResult.add(TaskData.builder() .taskId(1L) .name("SomeTask") .build()); when(runtimeServiceBase.executeFindTasksQuery(eq(params))).thenReturn(expectedResult); String rawResult = resource.executeTasksQuery(httpHeaders, payload).getEntity().toString(); TaskDataList unMarshalledResult = marshaller.unmarshall(rawResult, TaskDataList.class); assertEquals(expectedResult, unMarshalledResult.getItems()); }
@ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = { @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON), @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload) { final Variant v = getVariant(headers); final Header conversationIdHeader = buildConversationIdHeader("", context, headers); try { String contentType = getContentType(headers); @SuppressWarnings("unchecked") final Map<String, Object> queryParameters = marshallerHelper.unmarshal(payload, contentType, Map.class); final LocalDateTime queryTime = LocalDateTime.now(); final List<TaskData> taskDataList = runtimeServiceBase.executeFindTasksQuery(queryParameters); final TaskDataList result = new TaskDataList(taskDataList); result.setQueryTime(queryTime); return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { LOGGER.error("Unexpected error finding tasks {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }
TaskAssigningRuntimeResource { @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = { @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON), @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload) { final Variant v = getVariant(headers); final Header conversationIdHeader = buildConversationIdHeader("", context, headers); try { String contentType = getContentType(headers); @SuppressWarnings("unchecked") final Map<String, Object> queryParameters = marshallerHelper.unmarshal(payload, contentType, Map.class); final LocalDateTime queryTime = LocalDateTime.now(); final List<TaskData> taskDataList = runtimeServiceBase.executeFindTasksQuery(queryParameters); final TaskDataList result = new TaskDataList(taskDataList); result.setQueryTime(queryTime); return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { LOGGER.error("Unexpected error finding tasks {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } } }
TaskAssigningRuntimeResource { @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = { @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON), @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload) { final Variant v = getVariant(headers); final Header conversationIdHeader = buildConversationIdHeader("", context, headers); try { String contentType = getContentType(headers); @SuppressWarnings("unchecked") final Map<String, Object> queryParameters = marshallerHelper.unmarshal(payload, contentType, Map.class); final LocalDateTime queryTime = LocalDateTime.now(); final List<TaskData> taskDataList = runtimeServiceBase.executeFindTasksQuery(queryParameters); final TaskDataList result = new TaskDataList(taskDataList); result.setQueryTime(queryTime); return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { LOGGER.error("Unexpected error finding tasks {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } } TaskAssigningRuntimeResource(TaskAssigningRuntimeServiceBase runtimeServiceBase,
                                        KieServerRegistry context); }
TaskAssigningRuntimeResource { @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = { @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON), @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload) { final Variant v = getVariant(headers); final Header conversationIdHeader = buildConversationIdHeader("", context, headers); try { String contentType = getContentType(headers); @SuppressWarnings("unchecked") final Map<String, Object> queryParameters = marshallerHelper.unmarshal(payload, contentType, Map.class); final LocalDateTime queryTime = LocalDateTime.now(); final List<TaskData> taskDataList = runtimeServiceBase.executeFindTasksQuery(queryParameters); final TaskDataList result = new TaskDataList(taskDataList); result.setQueryTime(queryTime); return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { LOGGER.error("Unexpected error finding tasks {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } } TaskAssigningRuntimeResource(TaskAssigningRuntimeServiceBase runtimeServiceBase,
                                        KieServerRegistry context); @ApiOperation(value = "Executes a planning into the processes runtime.", notes = "This operation is intended for the task assigning integration implementation, third parties should avoid using it.", response = PlanningExecutionResult.class) @POST @Path(TASK_ASSIGNING_EXECUTE_PLANNING_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) Response executePlanning(@javax.ws.rs.core.Context HttpHeaders headers,
                                    @ApiParam(value = "identifier of the user to execute the planning on behalf of", required = true) @QueryParam("user") String userId,
                                    @ApiParam(value = "planning definition represented as PlanningItemList", required = true) String payload); @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers,
                                      @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = {
                                              @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON),
                                              @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload); }
TaskAssigningRuntimeResource { @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers, @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = { @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON), @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload) { final Variant v = getVariant(headers); final Header conversationIdHeader = buildConversationIdHeader("", context, headers); try { String contentType = getContentType(headers); @SuppressWarnings("unchecked") final Map<String, Object> queryParameters = marshallerHelper.unmarshal(payload, contentType, Map.class); final LocalDateTime queryTime = LocalDateTime.now(); final List<TaskData> taskDataList = runtimeServiceBase.executeFindTasksQuery(queryParameters); final TaskDataList result = new TaskDataList(taskDataList); result.setQueryTime(queryTime); return createCorrectVariant(result, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { LOGGER.error("Unexpected error finding tasks {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } } TaskAssigningRuntimeResource(TaskAssigningRuntimeServiceBase runtimeServiceBase,
                                        KieServerRegistry context); @ApiOperation(value = "Executes a planning into the processes runtime.", notes = "This operation is intended for the task assigning integration implementation, third parties should avoid using it.", response = PlanningExecutionResult.class) @POST @Path(TASK_ASSIGNING_EXECUTE_PLANNING_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) Response executePlanning(@javax.ws.rs.core.Context HttpHeaders headers,
                                    @ApiParam(value = "identifier of the user to execute the planning on behalf of", required = true) @QueryParam("user") String userId,
                                    @ApiParam(value = "planning definition represented as PlanningItemList", required = true) String payload); @ApiOperation(value = "Executes the task assigning integration query for returning the tasks information as a TaskDataList.", notes = "This operation is mainly intended for the tasks assigning integration implementation, third parties are recommended to use the queries described in the task assigning getting started guide.", response = TaskDataList.class) @POST @Path(TASK_ASSIGNING_QUERIES_TASK_DATA_URI) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) Response executeTasksQuery(@javax.ws.rs.core.Context HttpHeaders headers,
                                      @ApiParam(value = "map with the query parameters", required = true, examples = @Example(value = {
                                              @ExampleProperty(mediaType = MediaType.APPLICATION_JSON, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_JSON),
                                              @ExampleProperty(mediaType = MediaType.APPLICATION_XML, value = TASKS_QUERY_PARAMS_MAP_EXAMPLE_XML)})) String payload);  }