反序列化问题。

This commit is contained in:
dengqichen 2024-12-20 18:37:51 +08:00
parent 4f58a92167
commit 2878d66e50

View File

@ -166,7 +166,7 @@ public class BpmnConverter {
if (element instanceof ServiceTask) { if (element instanceof ServiceTask) {
configureServiceTask((ServiceTask) element, node, process, extensionElements); configureServiceTask((ServiceTask) element, node, process, extensionElements);
} else if (element instanceof StartEvent || element instanceof EndEvent) { } else if (element instanceof StartEvent || element instanceof EndEvent) {
// 为开始节点和结束节点设置监<EFBFBD><EFBFBD> // 为开始节点和结束节点设置监
element.setExtensionElements(extensionElements); element.setExtensionElements(extensionElements);
} }
} }
@ -246,9 +246,8 @@ public class BpmnConverter {
stringElement.setName("string"); stringElement.setName("string");
stringElement.setNamespace("http://flowable.org/bpmn"); stringElement.setNamespace("http://flowable.org/bpmn");
stringElement.setNamespacePrefix("flowable"); stringElement.setNamespacePrefix("flowable");
// 转义JSON内容 // 直接设置JSON内容不使用CDATA
String escapedJson = escapeXml(node.getPanelVariables().toString()); stringElement.setElementText(node.getPanelVariables().toString());
stringElement.setElementText(escapedJson);
// 设置field的name属性 // 设置field的name属性
Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>(); Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>();
@ -274,9 +273,8 @@ public class BpmnConverter {
stringElement.setName("string"); stringElement.setName("string");
stringElement.setNamespace("http://flowable.org/bpmn"); stringElement.setNamespace("http://flowable.org/bpmn");
stringElement.setNamespacePrefix("flowable"); stringElement.setNamespacePrefix("flowable");
// 转义JSON内容 // 直接设置JSON内容不使用CDATA
String escapedJson = escapeXml(node.getLocalVariables().toString()); stringElement.setElementText(node.getLocalVariables().toString());
stringElement.setElementText(escapedJson);
// 设置field的name属性 // 设置field的name属性
Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>(); Map<String, List<ExtensionAttribute>> fieldAttributes = new HashMap<>();
@ -309,7 +307,7 @@ public class BpmnConverter {
} }
/** /**
* 创建执行监听器扩展<EFBFBD><EFBFBD> * 创建执行监听器扩展
* *
* @param event 事件类型start/end * @param event 事件类型start/end
* @param delegateExpression 委托表达式 * @param delegateExpression 委托表达式
@ -352,7 +350,6 @@ public class BpmnConverter {
EndEvent errorEndEvent = createErrorEndEvent(serviceTask); EndEvent errorEndEvent = createErrorEndEvent(serviceTask);
SequenceFlow errorFlow = createErrorSequenceFlow(boundaryEvent, errorEndEvent); SequenceFlow errorFlow = createErrorSequenceFlow(boundaryEvent, errorEndEvent);
// 将错误处理相关的元素添加到流程中
process.addFlowElement(boundaryEvent); process.addFlowElement(boundaryEvent);
process.addFlowElement(errorEndEvent); process.addFlowElement(errorEndEvent);
process.addFlowElement(errorFlow); process.addFlowElement(errorFlow);
@ -419,7 +416,7 @@ public class BpmnConverter {
} }
/** /**
* 转换连<EFBFBD><EFBFBD>为顺序流 * 转换连线为顺序流
* *
* @param edges 工作流定义边集合 * @param edges 工作流定义边集合
* @param idMapping 节点ID映射 * @param idMapping 节点ID映射
@ -437,21 +434,4 @@ public class BpmnConverter {
process.addFlowElement(flow); process.addFlowElement(flow);
} }
} }
/**
* 转义XML特殊字符
*
* @param input 需要转义的字符串
* @return 转义后的字符串
*/
private String escapeXml(String input) {
if (input == null) {
return null;
}
return input.replace("&", "&amp;")
.replace("<", "&lt;")
.replace(">", "&gt;")
.replace("\"", "&quot;")
.replace("'", "&apos;");
}
} }