說明
為了滿足不同的流程節點可以操作的按鈕不同,支持對接方動態配置
如 辦理 、駁回、 抄送 、掛起流程 、流程終止 可以控制某些節點可操作按鈕
同監聽器一樣
針對模型設計提交的json改動
{ "resourceId": "sid-47205900-DFBE-4720-A773-98C7970A74A9", "properties": { "overrideid": "", "name": "", "documentation": "", "asynchronousdefinition": "false", "exclusivedefinition": "false", "executionlisteners": { "executionListeners": [{ "event": "start", "implementation": "", "className": "", "expression": "", "delegateExpression": "", "fields": [], "$$hashKey": "uiGrid-002D", "http": "ttps://demeter-dev.biaoguoworks.com/scm/flowable-center-notify?id=${ businessKey}&taskName=${taskName}&status=${status}" }] }, "multiinstance_type": "None", "multiinstance_cardinality": "", "multiinstance_collection": "", "multiinstance_variable": "", "multiinstance_condition": "", "isforcompensation": "false", "usertaskassignment": "", "formkeydefinition": "", "formreference": "", "duedatedefinition": "", "html_form_url": "", "detail_html_form_url": "", "prioritydefinition": "", "formproperties": "", "tasklisteners": "", "skipexpression": "", "categorydefinition": "", "process_button": "辦理,駁回,流程終止", "autocompletetask": "false", "startusercommitnode": "false" }, "stencil": { "id": "UserTask" }, "childShapes": [], "outgoing": [{ "resourceId": "sid-E05A628C-7A43-4DBE-9DDC-2C1A248EE826" }], "bounds": { "lowerRight": { "x": 265, "y": 200 }, "upperLeft": { "x": 165, "y": 120 } }, "dockers": [] }
針對部署改動
1.針對json轉運行時PBMN對象處
com.biaoguoworks.flowable.custom.convert.CustomUserTaskJsonConverter#convertJsonToElement
2.針對BPMN對象轉XML處
com.biaoguoworks.flowable.custom.convert.CustomUserTaskXMLConverter#writeAdditionalAttributes
跟監聽器不同的監聽器類型我們是根據type區分。但是針對屬性我們是擴展屬性所以我們要自定義一個TASK繼承原有TASK進行封裝我們的自定義屬性
com.biaoguoworks.flowable.custom.model.CustomUserTask
執行階段改動
針對XML轉為BPMN對象
com.biaoguoworks.flowable.custom.convert.CustomUserTaskJsonConverter#convertJsonToElement
使用
com.biaoguoworks.flowable.center.service.impl.CenterFormServiceImpl#getTaskForm
后續我們就可以通過任務找到流程定義 通過api將流程定義xml轉換成運行時對象則可以拿到我們自定義button信息
ProcessDefinition processDefinition=processEngine.getRepositoryService().createProcessDefinitionQuery().processDefinitionId(task.getProcessDefinitionId()).singleResult(); BpmnModel bpmnModel = flowBpmnModelService.getBpmnModelByProcessDefId(task.getProcessDefinitionId()); Process process = bpmnModel.getProcessById(processDefinition.getKey()); FlowElement taskFlowElement = process.getFlowElement(task.getTaskDefinitionKey()); if (!(taskFlowElement instanceof CustomUserTask)) { return null; } CustomUserTask customUserTask=(CustomUserTask)taskFlowElement; getTaskFormResDto.setButtons(ButtonParse.INSTANCE.getProcessButtons(customUserTask.getButtons()));
