use of org.activiti.bpmn.model.ExtensionAttribute in project Activiti by Activiti.
the class MessageEventDefinitionParser method parseChildElement.
public void parseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model) throws Exception {
if (!(parentElement instanceof Event))
return;
MessageEventDefinition eventDefinition = new MessageEventDefinition();
BpmnXMLUtil.addXMLLocation(eventDefinition, xtr);
eventDefinition.setMessageRef(xtr.getAttributeValue(null, ATTRIBUTE_MESSAGE_REF));
eventDefinition.setMessageExpression(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_MESSAGE_EXPRESSION));
eventDefinition.setCorrelationKey(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_MESSAGE_CORRELATION_KEY));
List<ExtensionAttribute> attributes = parseExtensionAttributes(xtr, parentElement, model);
if (!attributes.isEmpty()) {
eventDefinition.setAttributes(singletonMap(ACTIVITI_EXTENSIONS_PREFIX, attributes));
}
if (!StringUtils.isEmpty(eventDefinition.getMessageRef())) {
int indexOfP = eventDefinition.getMessageRef().indexOf(':');
if (indexOfP != -1) {
String prefix = eventDefinition.getMessageRef().substring(0, indexOfP);
String resolvedNamespace = model.getNamespace(prefix);
String messageRef = eventDefinition.getMessageRef().substring(indexOfP + 1);
if (resolvedNamespace == null) {
// if it's an invalid prefix will consider this is not a namespace prefix so will be used as part of the stringReference
messageRef = prefix + ":" + messageRef;
} else if (!resolvedNamespace.equalsIgnoreCase(model.getTargetNamespace())) {
// if it's a valid namespace prefix but it's not the targetNamespace then we'll use it as a valid namespace
// (even out editor does not support defining namespaces it is still a valid xml file)
messageRef = resolvedNamespace + ":" + messageRef;
}
eventDefinition.setMessageRef(messageRef);
} else {
eventDefinition.setMessageRef(eventDefinition.getMessageRef());
}
}
BpmnXMLUtil.parseChildElements(ELEMENT_EVENT_MESSAGEDEFINITION, eventDefinition, xtr, model);
((Event) parentElement).getEventDefinitions().add(eventDefinition);
}
use of org.activiti.bpmn.model.ExtensionAttribute in project Activiti by Activiti.
the class DecisionTaskJsonConverter method addExtensionAttributeToExtension.
protected void addExtensionAttributeToExtension(ExtensionElement element, String attributeName, String value) {
ExtensionAttribute extensionAttribute = new ExtensionAttribute(NAMESPACE, attributeName);
extensionAttribute.setNamespacePrefix("modeler");
extensionAttribute.setValue(value);
element.addAttribute(extensionAttribute);
}
Aggregations