We have custom extension elements in our model where we store our metadata. For example, a task can contain a property of exception script in its extension element.
We also have a requirement of creating BPMN Model programmatically and we are doing it as per the below link:
However, when we convert the modelInstance to an XML string, the value in the extension element is not added in CDATA. Is there a way to add the extension element information in the CDATA section?
Attached is the BPMN XML that is generated programmatically. If you see here, there is a property tag inside the extension elements whose value is NOT present in the CDATA section because of which it fails while loading.
The custom property element is added as per the following link:
Here is the code for PDPropertyImpl for reference:
public class PDPropertyImpl extends BpmnModelElementInstanceImpl implements PDProperty {
protected static Attribute<String> nameAttribute;
public static void registerType(ModelBuilder modelBuilder) {
// removed code for brevity
}
public PDPropertyImpl(ModelTypeInstanceContext instanceContext) {
super(instanceContext);
}
public String getName() {
return (String) nameAttribute.getValue(this);
}
public void setName(String camundaName) {
nameAttribute.setValue(this, camundaName);
}
public String getValue() {
return this.getTextContent();
}
public void setValue(String value) {
this.setTextContent(value);
}
}