Search in sources :

Example 6 with BPMNRestException

use of org.wso2.carbon.bpmn.rest.common.exception.BPMNRestException in project carbon-business-process by wso2.

the class ProcessInstanceService method createExecutionVariable.

@POST
@Path("/{processInstanceId}/variables")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response createExecutionVariable(@PathParam("processInstanceId") String processInstanceId, @Context HttpServletRequest httpServletRequest) {
    Execution execution = getExecutionInstanceFromRequest(processInstanceId);
    Response response;
    try {
        response = createExecutionVariable(execution, false, RestResponseFactory.VARIABLE_PROCESS, httpServletRequest);
    } catch (IOException | ServletException e) {
        throw new BPMNRestException("Exception occured during creating execution variable", e);
    }
    return response;
}
Also used : DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) Response(javax.ws.rs.core.Response) ProcessInstanceResponse(org.wso2.carbon.bpmn.rest.model.runtime.ProcessInstanceResponse) ServletException(javax.servlet.ServletException) Execution(org.activiti.engine.runtime.Execution) BPMNRestException(org.wso2.carbon.bpmn.rest.common.exception.BPMNRestException) IOException(java.io.IOException) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes)

Example 7 with BPMNRestException

use of org.wso2.carbon.bpmn.rest.common.exception.BPMNRestException in project carbon-business-process by wso2.

the class ProcessInstanceService method updateBinaryVariable.

@PUT
@Path("/{processInstanceId}/variables/{variableName}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response updateBinaryVariable(@PathParam("processInstanceId") String processInstanceId, @PathParam("variableName") String variableName, MultipartBody multipartBody) {
    Execution execution = getExecutionInstanceFromRequest(processInstanceId);
    RestVariable result;
    try {
        result = setBinaryVariable(multipartBody, execution, RestResponseFactory.VARIABLE_PROCESS, false);
    } catch (IOException | ServletException e) {
        throw new BPMNRestException("Exception occured during creating binary execution variable", e);
    }
    return Response.ok().entity(result).build();
}
Also used : RestVariable(org.wso2.carbon.bpmn.rest.engine.variable.RestVariable) ServletException(javax.servlet.ServletException) Execution(org.activiti.engine.runtime.Execution) BPMNRestException(org.wso2.carbon.bpmn.rest.common.exception.BPMNRestException) IOException(java.io.IOException) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes) PUT(javax.ws.rs.PUT)

Aggregations

BPMNRestException (org.wso2.carbon.bpmn.rest.common.exception.BPMNRestException)7 IOException (java.io.IOException)5 ServletException (javax.servlet.ServletException)5 Consumes (javax.ws.rs.Consumes)5 Path (javax.ws.rs.Path)5 Produces (javax.ws.rs.Produces)5 Execution (org.activiti.engine.runtime.Execution)5 Response (javax.ws.rs.core.Response)4 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)4 ProcessInstanceResponse (org.wso2.carbon.bpmn.rest.model.runtime.ProcessInstanceResponse)4 PUT (javax.ws.rs.PUT)3 POST (javax.ws.rs.POST)2 RepositoryService (org.activiti.engine.RepositoryService)2 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)2 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)2 ExecutionListener (org.activiti.engine.delegate.ExecutionListener)1 TaskListener (org.activiti.engine.delegate.TaskListener)1 TaskDefinition (org.activiti.engine.impl.task.TaskDefinition)1 ProcessTerminationListener (org.wso2.carbon.bpmn.analytics.publisher.listeners.ProcessTerminationListener)1 TaskCompletionListener (org.wso2.carbon.bpmn.analytics.publisher.listeners.TaskCompletionListener)1