当前位置:网站首页>Flowable process custom attribute
Flowable process custom attribute
2022-07-27 16:25:00 【Tony-devj】
flowable Custom process properties
I wrote before about adding custom extension attributes to nodes , But how to extend custom attributes on the process ? In fact, it is consistent with adding custom attributes to nodes , Only the modified related classes are different .
edit stencilset_bpmn.json file
find stencilset_bpmn.json file , Open it and you will find propertyPackages Properties of , Pictured :
We just need to follow the form created before the process , I define it here as follows :
{
"name": "isbatchapproval_package",
"properties": [
{
"id": "isbatchapproval",
"type": "Boolean", // Set to boolean type
"title": " Allow batch approval ",
"value": "",
"description": " Set whether batch approval is allowed for related nodes ",
"popular": true
}
]
}
After writing , To display related attributes on related nodes , You need to reference the above attributes on the process id The value is isbatchapproval Of , We need to introduce :
{
"type": "node",
"id": "BPMNDiagram",
"title": "BPMN\u56fe\u8868",
"description": "A BPMN 2.0 diagram.",
"view": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns:oryx=\"http://www.b3mn.org/oryx\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n width=\"800\"\n height=\"600\"\n version=\"1.0\">\n <defs></defs>\n <g pointer-events=\"fill\" >\n <polygon stroke=\"black\" fill=\"black\" stroke-width=\"1\" points=\"0,0 0,590 9,599 799,599 799,9 790,0\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-miterlimit=\"10\" />\n <rect id=\"diagramcanvas\" oryx:resize=\"vertical horizontal\" x=\"0\" y=\"0\" width=\"790\" height=\"590\" stroke=\"black\" stroke-width=\"2\" fill=\"white\" />\n \t<text font-size=\"22\" id=\"diagramtext\" x=\"400\" y=\"25\" oryx:align=\"top center\" stroke=\"#373e48\"></text>\n </g>\n</svg>",
"icon": "diagram.png",
"groups": [
" The illustration "
],
"mayBeRoot": true,
"hide": true,
"propertyPackages": [
"process_idpackage",
"namepackage",
"documentationpackage",
"process_authorpackage",
"process_versionpackage",
"process_namespacepackage",
"process_historylevelpackage",
"isexecutablepackage",
"datapropertiespackage",
"executionlistenerspackage",
"eventlistenerspackage",
"signaldefinitionspackage",
"messagedefinitionspackage",
"process_potentialstarteruserpackage",
"process_potentialstartergrouppackage",
"process_iseagerexecutionfetchpackage",
"isbatchapproval_package"
],
"hiddenPropertyPackages": [],
"roles": []
}
After adding, there will be a selection box above the attributes of the process .
In download BPMN.xml Add attributes in
We know that when used on nodes , Need to expand UserTaskJsonConverter, But what classes should the process extend ? Through previous experience , We know that the process expansion is in BaseBpmnJsonConverter.java and BpmnJsonConverter.
edit BaseBpmnJsonConverter.java
find if (baseElement instanceof FlowElement) Change to the following code :PROCESS_IS_BATCHAPPROVAL_KEY = “isbatchapproval”;
if (baseElement instanceof FlowElement) {
FlowElement flowElement = (FlowElement) baseElement;
if (StringUtils.isNotEmpty(flowElement.getName())) {
propertiesNode.put(PROPERTY_NAME, flowElement.getName());
}
if (StringUtils.isNotEmpty(flowElement.getDocumentation())) {
propertiesNode.put(PROPERTY_DOCUMENTATION, flowElement.getDocumentation());
}
Map<String, List<ExtensionElement>> extensionElements = flowElement.getExtensionElements();
List<ExtensionElement> elements = extensionElements.get(PROCESS_IS_BATCHAPPROVAL_KEY);
if (CollectionUtils.isNotEmpty(elements)) {
for (ExtensionElement extensionElement : elements) {
if (extensionElement.getName().equals(PROCESS_IS_BATCHAPPROVAL_KEY)) {
propertiesNode.put(PROCESS_IS_BATCHAPPROVAL_KEY, extensionElement.getElementText());
}
}
}
BpmnJsonConverterUtil.convertListenersToJson(((FlowElement) baseElement).getExecutionListeners(), true, propertiesNode);
}
edit BpmnJsonConverter.java
find if (!nonEmptyPoolFound) Add as the following code :
String isbatchapproval = BpmnJsonConverterUtil.getPropertyValueAsString("isbatchapproval", modelNode);
if (StringUtils.isNotEmpty(isbatchapproval)) {
ExtensionElement isbatchapprovalExtensionElement = new ExtensionElement();
isbatchapprovalExtensionElement.setName("isbatchapproval");
isbatchapprovalExtensionElement.setNamespace("http://flowable.org/bpmn");
isbatchapprovalExtensionElement.setNamespacePrefix("flowable");
isbatchapprovalExtensionElement.setElementText(isbatchapproval);
process.addExtensionElement(isbatchapprovalExtensionElement);
}
Then start the project , downloaded xml There will be custom attributes on the process , Pictured :
Be careful
1. If it is source code deployment , Just modify the source code
2. If it is the introduction of jar When , Need to override BaseBpmnJsonConverter.java and BpmnJsonConverter.java, In the project , Create the same package as the package in the source class , Assign notes in the source code , Pay attention to the imported version and the edited version , Don't get it wrong !
边栏推荐
- 重新配置cubemx后,生成的代码用IAR打开不成功
- Baidu picture copy picture address
- word中插入度的方法
- Penetration test - dry goods | 80 + network security interview experience post (interview)
- Common Oracle statements
- ADAMS中转动整个模型
- Axure install Icon Font Catalog
- EXE程序加密锁
- google chrome revercecaptcha广告屏蔽
- Characters generated by JMeter function assistant in jmeter5.3 and later versions cannot be copied when they are grayed out
猜你喜欢

Mapreduce实例(一):WordCount

DRF learning notes (V): viewset

Servlet基础知识点

Time series - use tsfresh for classification tasks

2.2 basic elements of JMeter

Scratch crawler framework

The new JMeter function assistant is not under the options menu - in the toolbar

The whereor method of TP5 has many conditions

JSP Foundation

MySQL index
随机推荐
2.2 basic elements of JMeter
Test novice learning classic (with ideas)
第31回---第52回
Characters generated by JMeter function assistant in jmeter5.3 and later versions cannot be copied when they are grayed out
4-digit random data
云管平台中租户以及多租户概念简单说明
The whereor method of TP5 has many conditions
my_ls小结
SolidWorks simulation curve attribute setting
const小结
Some queries of TP5
论文缩小
What is ti's calculation for successively canceling the agency rights of anfuli / Wenye / Shiping?
The new JMeter function assistant is not under the options menu - in the toolbar
TP5 paging some small points
webRTC中的coturn服务安装
For enterprise operation and maintenance security, use the cloud housekeeper fortress machine!
DRF learning notes (V): viewset
The image displayed online by TP5 is garbled
Scratch crawler framework