Search in sources :

Example 1 with CommentResponseCollection

use of org.wso2.carbon.bpmn.rest.model.runtime.CommentResponseCollection in project carbon-business-process by wso2.

the class HistoricProcessInstanceService method getComments.

@GET
@Path("/{processInstanceId}/comments")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getComments(@PathParam("processInstanceId") String processInstanceId) {
    TaskService taskService = BPMNOSGIService.getTaskService();
    HistoricProcessInstance instance = getHistoricProcessInstanceFromRequest(processInstanceId);
    List<CommentResponse> commentResponseList = new RestResponseFactory().createRestCommentList(taskService.getProcessInstanceComments(instance.getId()), uriInfo.getBaseUri().toString());
    CommentResponseCollection commentResponseCollection = new CommentResponseCollection();
    commentResponseCollection.setCommentResponseList(commentResponseList);
    return Response.ok().entity(commentResponseCollection).build();
}
Also used : CommentResponse(org.wso2.carbon.bpmn.rest.model.runtime.CommentResponse) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) CommentResponseCollection(org.wso2.carbon.bpmn.rest.model.runtime.CommentResponseCollection)

Example 2 with CommentResponseCollection

use of org.wso2.carbon.bpmn.rest.model.runtime.CommentResponseCollection in project carbon-business-process by wso2.

the class WorkflowTaskService method getComments.

@GET
@Path("/{taskId}/comments")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getComments(@PathParam("taskId") String taskId) {
    HistoricTaskInstance task = getHistoricTaskFromRequest(taskId);
    TaskService taskService = BPMNOSGIService.getTaskService();
    List<CommentResponse> commentResponseList = new RestResponseFactory().createRestCommentList(taskService.getTaskComments(task.getId()), uriInfo.getBaseUri().toString());
    CommentResponseCollection commentResponseCollection = new CommentResponseCollection();
    commentResponseCollection.setCommentResponseList(commentResponseList);
    return Response.ok().entity(commentResponseCollection).build();
}
Also used : HistoricTaskInstance(org.activiti.engine.history.HistoricTaskInstance) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) BaseTaskService(org.wso2.carbon.bpmn.rest.service.base.BaseTaskService)

Aggregations

RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)2 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1 HistoricTaskInstance (org.activiti.engine.history.HistoricTaskInstance)1 CommentResponse (org.wso2.carbon.bpmn.rest.model.runtime.CommentResponse)1 CommentResponseCollection (org.wso2.carbon.bpmn.rest.model.runtime.CommentResponseCollection)1 BaseTaskService (org.wso2.carbon.bpmn.rest.service.base.BaseTaskService)1