Activiti如何实现查询与流程实例关联的业务对象
推荐回答
一个流程中,流程实例只有一个,执行对象可以有多个SELECT*FROMactiviti.act_hi_actinsta;#所有节点的历史表。
黄睿刚2019-11-05 22:05:25
提示您:回答为网友贡献,仅供参考。
其他回答
-
1、首先是根据流程ID获取当前任务:Listtasks=taskService.createTaskQuery.processInstanceIdprocInstanceId.list;2、然后根据当前任务获取当前流程的流程定义,然后根据流程定义获得所有的节点:ProcessDefinitionEntitydef=P..。
齐景凯2019-11-05 23:02:10
-
建议你可以看一下咖啡兔的相关技术博文:网页链接,activiti6和activiti5整合方式一致1.为什么要整合Activiti5.10版本把原本独立的ActivitiModeler模块整合到了ActivitiExplorer中,两者相结合使用起来很方便,通过Modeler设计的流程模型可以直接部署到引擎,也可以把已经部署的流程转换为Model从而在Modeler中编辑。在实际应用中也有这样的需求,把Modeler整合到业务系统中可以供管理员使用,或者作为BPM平台的一部分存在,很遗憾官方没有给出如何整合Modeler的文档。2.整合工作2.1下载源码首先需要从Github下载源码:https://github.com/Activiti/Activiti;可以直接用Git克隆,也可以下载zip格式的压缩包。2.2复制文件复制的所有文件均在activiti-webapp-explorer2目录中。src/main/resources中的editor.html、stencilset.json、plugins.xml到项目源码的源码根目录,保证编译之后在classes根目录src/main/webapp中的api、editor、explorer、libs到项目的webapp目录2.3添加依赖?123456789101112131415161718192021222324 org.activiti activiti-explorer 5.14 vaadin com.vaadin dcharts-widget org.vaadin.addons activiti-simple-workflow org.activiti org.activiti activiti-modeler 5.14 2.4添加Java类添加一个ExplorerRestApplication.java类保存到项目中,注册了一些REST路由。1234567891011121314151617181920212223242526272829 packageorg.activiti.explorer.rest.application; importorg.activiti.editor.rest.application.ModelerServicesInit;importorg.activiti.rest.api.DefaultResource;importorg.activiti.rest.application.ActivitiRestApplication;importorg.activiti.rest.filter.JsonpFilter;importorg.restlet.Restlet;importorg.restlet.routing.Router; publicclassExplorerRestApplicationextendsActivitiRestApplication{ publicExplorerRestApplication{ super; } /** *CreatesarootRestletthatwillreceiveallincomingcalls. */ @Override publicsynchronizedRestletcreateInboundRoot{ Routerrouter=newRoutergetContext; router.attachDefaultDefaultResource.class; ModelerServicesInit.attachResourcesrouter; DiagramServicesInit.attachResourcesrouter; JsonpFilterjsonpFilter=newJsonpFiltergetContext; jsonpFilter.setNextrouter; returnjsonpFilter; } } 2.5配置web.xml在web.xml文件中添加如下配置:?12345678910111213141516 RestletServlet org.restlet.ext.servlet.ServerServlet RestletServlet /service/* 2.6控制器使用SpringMVC做了一个简单的封装,也可以使用其他的MVC实现。123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120191122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 packageme.kafeitu.demo.activiti.web.workflow; importjava.io.ByteArrayInputStream;importjava.util.List; importjavax.servlet.http.HttpServletRequest;importjavax.servlet.http.HttpServletResponse; importorg.activiti.bpmn.converter.BpmnXMLConverter;importorg.activiti.bpmn.model.BpmnModel;importorg.activiti.editor.constants.ModelDataJsonConstants;importorg.activiti.editor.language.json.converter.BpmnJsonConverter;importorg.activiti.engine.RepositoryService;importorg.activiti.engine.repository.Deployment;importorg.activiti.engine.repository.Model;importorg.apache.commons.io.IOUtils;importorg.apache.commons.lang3.StringUtils;importorg.codehaus.jackson.JsonNode;importorg.codehaus.jackson.map.ObjectMapper;importorg.codehaus.jackson.node.ObjectNode;importorg.slf4j.Logger;importorg.slf4j.LoggerFactory;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.stereotype.Controller;importorg.springframework.web.bind.annotation.PathVariable;importorg.springframework.web.bind.annotation.RequestMapping;importorg.springframework.web.bind.annotation.RequestParam;importorg.springframework.web.servlet.ModelAndView;importorg.springframework.web.servlet.mvc.support.RedirectAttributes; /** *流程模型控制器 * *@authorhenryyan */@Controller@RequestMappingvalue="/workflow/model"publicclassModelController{ protectedLoggerlogger=LoggerFactory.getLoggergetClass; @Autowired RepositoryServicerepositoryService; /** *模型列表 */ @RequestMappingvalue="list" publicModelAndViewmodelList{ ModelAndViewmav=newModelAndView"workflow/model-list"; Listlist=repositoryService.createModelQuery.list; mav.addObject"list",list; returnmav; } /** *创建模型 */ @RequestMappingvalue="create" publicvoidcreate@RequestParam"name"Stringname,@RequestParam"key"Stringkey,@RequestParam"description"Stringdescription, HttpServletRequestrequest,HttpServletResponseresponse{ try{ ObjectMapperobjectMapper=newObjectMapper; ObjectNodeeditorNode=objectMapper.createObjectNode; editorNode.put"id","canvas"; editorNode.put"resourceId","canvas"; ObjectNodestencilSetNode=objectMapper.createObjectNode; stencilSetNode.put"namespace","http://b3mn.org/stencilset/bpmn2.0#"; editorNode.put"stencilset",stencilSetNode; ModelmodelData=repositoryService.newModel; ObjectNodemodelObjectNode=objectMapper.createObjectNode; modelObjectNode.putModelDataJsonConstants.MODEL_NAME,name; modelObjectNode.putModelDataJsonConstants.MODEL_REVISION,1; description=StringUtils.defaultStringdescription; modelObjectNode.putModelDataJsonConstants.MODEL_DESCRIPTION,description; modelData.setMetaInfomodelObjectNode.toString; modelData.setNamename; modelData.setKeyStringUtils.defaultStringkey; repositoryService.saveModelmodelData; repositoryService.addModelEditorSourcemodelData.getId,editorNode.toString.getBytes"utf-8"; response.sendRedirectrequest.getContextPath+"/service/editor?id="+modelData.getId; }catchExceptione{ logger.error"创建模型失败:",e; } } /** *根据Model部署流程 */ @RequestMappingvalue="deploy/{modelId}" publicStringdeploy@PathVariable"modelId"StringmodelId,RedirectAttributesredirectAttributes{ try{ ModelmodelData=repositoryService.getModelmodelId; ObjectNodemodelNode=ObjectNodenewObjectMapper.readTreerepositoryService.getModelEditorSourcemodelData.getId; byte/files/2019/03/kad-modeler.png 。
龚尤贵2019-11-05 22:19:26
-
runtimeService.suspendProcessInstanceByIdprocessInstanceId挂起该流程实例。也就是冻结暂停。也可激活。Activiti是一个项目的名称,Alfresco软件在2019年5月17日宣布Activiti业务流程管理,面对新技术的机遇,诸如互操作性和云架构,提供技术实现。创始人TomBaeyens是JBossjBPM的项目架构师,以及另一位架构师JoramBarrez,一起加入到创建Alfresco这项首次实现Apache开源许可的BPMN2.0引擎开发中来。
连保康2019-11-05 22:02:15