Search in sources :

Example 1 with CustomProperty

use of org.activiti.bpmn.model.CustomProperty in project Activiti by Activiti.

the class UserTaskXMLConverter method writeExtensionChildElements.

@Override
protected boolean writeExtensionChildElements(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
    UserTask userTask = (UserTask) element;
    didWriteExtensionStartElement = writeFormProperties(userTask, didWriteExtensionStartElement, xtw);
    didWriteExtensionStartElement = writeCustomIdentities(element, didWriteExtensionStartElement, xtw);
    if (!userTask.getCustomProperties().isEmpty()) {
        for (CustomProperty customProperty : userTask.getCustomProperties()) {
            if (StringUtils.isEmpty(customProperty.getSimpleValue())) {
                continue;
            }
            if (didWriteExtensionStartElement == false) {
                xtw.writeStartElement(ELEMENT_EXTENSIONS);
                didWriteExtensionStartElement = true;
            }
            xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, customProperty.getName(), ACTIVITI_EXTENSIONS_NAMESPACE);
            xtw.writeCData(customProperty.getSimpleValue());
            xtw.writeEndElement();
        }
    }
    return didWriteExtensionStartElement;
}
Also used : AlfrescoUserTask(org.activiti.bpmn.model.alfresco.AlfrescoUserTask) UserTask(org.activiti.bpmn.model.UserTask) CustomProperty(org.activiti.bpmn.model.CustomProperty)

Example 2 with CustomProperty

use of org.activiti.bpmn.model.CustomProperty in project Activiti by Activiti.

the class ServiceTaskXMLConverter method writeExtensionChildElements.

@Override
protected boolean writeExtensionChildElements(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
    ServiceTask serviceTask = (ServiceTask) element;
    if (!serviceTask.getCustomProperties().isEmpty()) {
        for (CustomProperty customProperty : serviceTask.getCustomProperties()) {
            if (StringUtils.isEmpty(customProperty.getSimpleValue())) {
                continue;
            }
            if (didWriteExtensionStartElement == false) {
                xtw.writeStartElement(ELEMENT_EXTENSIONS);
                didWriteExtensionStartElement = true;
            }
            xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FIELD, ACTIVITI_EXTENSIONS_NAMESPACE);
            xtw.writeAttribute(ATTRIBUTE_FIELD_NAME, customProperty.getName());
            if ((customProperty.getSimpleValue().contains("${") || customProperty.getSimpleValue().contains("#{")) && customProperty.getSimpleValue().contains("}")) {
                xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ATTRIBUTE_FIELD_EXPRESSION, ACTIVITI_EXTENSIONS_NAMESPACE);
            } else {
                xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FIELD_STRING, ACTIVITI_EXTENSIONS_NAMESPACE);
            }
            xtw.writeCData(customProperty.getSimpleValue());
            xtw.writeEndElement();
            xtw.writeEndElement();
        }
    } else {
        didWriteExtensionStartElement = FieldExtensionExport.writeFieldExtensions(serviceTask.getFieldExtensions(), didWriteExtensionStartElement, xtw);
    }
    return didWriteExtensionStartElement;
}
Also used : ServiceTask(org.activiti.bpmn.model.ServiceTask) CustomProperty(org.activiti.bpmn.model.CustomProperty)

Aggregations

CustomProperty (org.activiti.bpmn.model.CustomProperty)2 ServiceTask (org.activiti.bpmn.model.ServiceTask)1 UserTask (org.activiti.bpmn.model.UserTask)1 AlfrescoUserTask (org.activiti.bpmn.model.alfresco.AlfrescoUserTask)1