Search in sources :

Example 31 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class ConnectorParseListener method parseServiceTask.

@Override
public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
    Element connectorDefinition = findCamundaExtensionElement(serviceTaskElement, "connector");
    if (connectorDefinition != null) {
        Element connectorIdElement = connectorDefinition.element("connectorId");
        String connectorId = null;
        if (connectorIdElement != null) {
            connectorId = connectorIdElement.getText().trim();
        }
        if (connectorIdElement == null || connectorId.isEmpty()) {
            throw new BpmnParseException("No 'id' defined for connector.", connectorDefinition);
        }
        IoMapping ioMapping = parseInputOutput(connectorDefinition);
        activity.setActivityBehavior(new ServiceTaskConnectorActivityBehavior(connectorId, ioMapping));
    }
}
Also used : IoMapping(org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping) BpmnParseException(org.camunda.bpm.engine.BpmnParseException) BpmnParseUtil.findCamundaExtensionElement(org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseUtil.findCamundaExtensionElement) Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 32 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmPlatformXmlParse method parseJobAcquisition.

/**
 * parse a <code>&lt;job-acquisition .../&gt;</code> element and add it to the
 * list of parsed elements
 */
protected void parseJobAcquisition(Element element, List<JobAcquisitionXml> jobAcquisitions) {
    JobAcquisitionXmlImpl jobAcquisition = new JobAcquisitionXmlImpl();
    // set name
    jobAcquisition.setName(element.attribute(NAME));
    Map<String, String> properties = new HashMap<String, String>();
    for (Element childElement : element.elements()) {
        if (JOB_EXECUTOR_CLASS_NAME.equals(childElement.getTagName())) {
            jobAcquisition.setJobExecutorClassName(childElement.getText());
        } else if (PROPERTIES.equals(childElement.getTagName())) {
            parseProperties(childElement, properties);
        }
    }
    // set collected properties
    jobAcquisition.setProperties(properties);
    // add to list
    jobAcquisitions.add(jobAcquisition);
}
Also used : HashMap(java.util.HashMap) Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 33 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmPlatformXmlParse method parseRootElement.

/**
 * We know this is a <code>&lt;bpm-platform ../&gt;</code> element
 */
protected void parseRootElement() {
    JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl();
    List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>();
    for (Element element : rootElement.elements()) {
        if (JOB_EXECUTOR.equals(element.getTagName())) {
            parseJobExecutor(element, jobExecutor);
        } else if (PROCESS_ENGINE.equals(element.getTagName())) {
            parseProcessEngine(element, processEngines);
        }
    }
    bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines);
}
Also used : ProcessEngineXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml) Element(org.camunda.bpm.engine.impl.util.xml.Element) ArrayList(java.util.ArrayList)

Example 34 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class BpmPlatformXmlParse method parseJobExecutor.

/**
 * parse a <code>&lt;job-executor .../&gt;</code> element and add it to the list of parsed elements
 */
protected void parseJobExecutor(Element element, JobExecutorXmlImpl jobExecutorXml) {
    List<JobAcquisitionXml> jobAcquisitions = new ArrayList<JobAcquisitionXml>();
    Map<String, String> properties = new HashMap<String, String>();
    for (Element childElement : element.elements()) {
        if (JOB_ACQUISITION.equals(childElement.getTagName())) {
            parseJobAcquisition(childElement, jobAcquisitions);
        } else if (PROPERTIES.equals(childElement.getTagName())) {
            parseProperties(childElement, properties);
        }
    }
    jobExecutorXml.setJobAcquisitions(jobAcquisitions);
    jobExecutorXml.setProperties(properties);
}
Also used : HashMap(java.util.HashMap) Element(org.camunda.bpm.engine.impl.util.xml.Element) ArrayList(java.util.ArrayList) JobAcquisitionXml(org.camunda.bpm.container.impl.metadata.spi.JobAcquisitionXml)

Example 35 with Element

use of org.camunda.bpm.engine.impl.util.xml.Element in project camunda-bpm-platform by camunda.

the class DeploymentMetadataParse method parseProperties.

/**
 * Transform a
 * <pre>
 * &lt;properties&gt;
 *   &lt;property name="name"&gt;value&lt;/property&gt;
 * &lt;/properties&gt;
 * </pre>
 * structure into a properties {@link Map}
 *
 * Supports resolution of Ant-style placeholders against system properties.
 */
protected void parseProperties(Element element, Map<String, String> properties) {
    for (Element childElement : element.elements()) {
        if (PROPERTY.equals(childElement.getTagName())) {
            String resolved = PropertyHelper.resolveProperty(System.getProperties(), childElement.getText());
            properties.put(childElement.attribute(NAME), resolved);
        }
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Aggregations

Element (org.camunda.bpm.engine.impl.util.xml.Element)60 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)5 BpmnParseException (org.camunda.bpm.engine.BpmnParseException)4 ExecutableScript (org.camunda.bpm.engine.impl.scripting.ExecutableScript)4 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)3 ProcessEngineXml (org.camunda.bpm.container.impl.metadata.spi.ProcessEngineXml)2 TaskListener (org.camunda.bpm.engine.delegate.TaskListener)2 Condition (org.camunda.bpm.engine.impl.Condition)2 IoMapping (org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping)2 ParameterValueProvider (org.camunda.bpm.engine.impl.core.variable.mapping.value.ParameterValueProvider)2 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)2 ScriptCondition (org.camunda.bpm.engine.impl.scripting.ScriptCondition)2 ClassDelegateTaskListener (org.camunda.bpm.engine.impl.task.listener.ClassDelegateTaskListener)2 DelegateExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.DelegateExpressionTaskListener)2 ExpressionTaskListener (org.camunda.bpm.engine.impl.task.listener.ExpressionTaskListener)2 ScriptTaskListener (org.camunda.bpm.engine.impl.task.listener.ScriptTaskListener)2 LinkedHashMap (java.util.LinkedHashMap)1 TreeMap (java.util.TreeMap)1 ProcessArchiveXml (org.camunda.bpm.application.impl.metadata.spi.ProcessArchiveXml)1