当前位置: 首页>>代码示例>>Java>>正文


Java RuntimeService.messageEventReceived方法代码示例

本文整理汇总了Java中org.activiti.engine.RuntimeService.messageEventReceived方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeService.messageEventReceived方法的具体用法?Java RuntimeService.messageEventReceived怎么用?Java RuntimeService.messageEventReceived使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.RuntimeService的用法示例。


在下文中一共展示了RuntimeService.messageEventReceived方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/MessageCatchingEvent.bpmn").deploy();
	// 启动流程
	ProcessInstance pi = runtimeService.startProcessInstanceByKey("mcProcess");
	Execution exe = runtimeService.createExecutionQuery().activityId("messageintermediatecatchevent1").singleResult();
	runtimeService.messageEventReceived("myMsg", exe.getId());
	// 输出当前的任务
	List<Task> tasks = taskService.createTaskQuery().list();
	for (Task task : tasks) {
		System.out.println(task.getName());
	}
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:22,代码来源:MessageCatchingEvent.java

示例2: performExecutionAction

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
/**
 * Execute an action on an execution
 * @param executionId
 * @param actionRequest
 * @return Response
 */
@PUT
@Path("/{executionId}")
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
@Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
public Response performExecutionAction(@PathParam("executionId") String executionId, ExecutionActionRequest
        actionRequest) {

    Execution execution = getExecutionFromRequest(executionId);
    RuntimeService runtimeService = BPMNOSGIService.getRuntimeService();

    if (ExecutionActionRequest.ACTION_SIGNAL.equals(actionRequest.getAction())) {
        if (actionRequest.getVariables() != null) {
            runtimeService.signal(execution.getId(), getVariablesToSet(actionRequest));
        } else {
            runtimeService.signal(execution.getId());
        }
    } else if (ExecutionActionRequest.ACTION_SIGNAL_EVENT_RECEIVED.equals(actionRequest.getAction())) {
        if (actionRequest.getSignalName() == null) {
            throw new ActivitiIllegalArgumentException("Signal name is required");
        }
        if (actionRequest.getVariables() != null) {
            runtimeService.signalEventReceived(actionRequest.getSignalName(), execution.getId(),
                    getVariablesToSet(actionRequest));
        } else {
            runtimeService.signalEventReceived(actionRequest.getSignalName(), execution.getId());
        }
    } else if (ExecutionActionRequest.ACTION_MESSAGE_EVENT_RECEIVED.equals(actionRequest.getAction())) {
        if (actionRequest.getMessageName() == null) {
            throw new ActivitiIllegalArgumentException("Message name is required");
        }
        if (actionRequest.getVariables() != null) {
            runtimeService.messageEventReceived(actionRequest.getMessageName(), execution.getId(),
                    getVariablesToSet(actionRequest));
        } else {
            runtimeService.messageEventReceived(actionRequest.getMessageName(), execution.getId());
        }
    } else {
        throw new ActivitiIllegalArgumentException("Invalid action: '" + actionRequest.getAction() + "'.");
    }

    Response.ResponseBuilder response = Response.ok();
    // Re-fetch the execution, could have changed due to action or even completed
    execution = runtimeService.createExecutionQuery().executionId(execution.getId()).singleResult();
    if (execution == null) {
        // Execution is finished, return empty body to inform user
        response.status(Response.Status.NO_CONTENT);
    } else {
        response.entity(new RestResponseFactory()
                .createExecutionResponse(execution, uriInfo.getBaseUri().toString())).build();
    }

    return response.build();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:60,代码来源:ExecutionService.java


注:本文中的org.activiti.engine.RuntimeService.messageEventReceived方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。