Search in sources :

Example 1 with Element

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

the class DeploymentMetadataParse method parseProcessEnginePlugin.

/**
 * Transform a <code>&lt;plugin ... /&gt;</code> structure.
 */
protected void parseProcessEnginePlugin(Element element, List<ProcessEnginePluginXml> plugins) {
    ProcessEnginePluginXmlImpl plugin = new ProcessEnginePluginXmlImpl();
    Map<String, String> properties = new HashMap<String, String>();
    for (Element childElement : element.elements()) {
        if (PLUGIN_CLASS.equals(childElement.getTagName())) {
            plugin.setPluginClass(childElement.getText());
        } else if (PROPERTIES.equals(childElement.getTagName())) {
            parseProperties(childElement, properties);
        }
    }
    plugin.setProperties(properties);
    plugins.add(plugin);
}
Also used : HashMap(java.util.HashMap) Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 2 with Element

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

the class DeploymentMetadataParse method parseProcessEngine.

/**
 * parse a <code>&lt;process-engine .../&gt;</code> element and add it to the list of parsed elements
 */
protected void parseProcessEngine(Element element, List<ProcessEngineXml> parsedProcessEngines) {
    ProcessEngineXmlImpl processEngine = new ProcessEngineXmlImpl();
    // set name
    processEngine.setName(element.attribute(NAME));
    // set default
    String defaultValue = element.attribute(DEFAULT);
    if (defaultValue == null || defaultValue.isEmpty()) {
        processEngine.setDefault(false);
    } else {
        processEngine.setDefault(Boolean.parseBoolean(defaultValue));
    }
    Map<String, String> properties = new HashMap<String, String>();
    List<ProcessEnginePluginXml> plugins = new ArrayList<ProcessEnginePluginXml>();
    for (Element childElement : element.elements()) {
        if (CONFIGURATION.equals(childElement.getTagName())) {
            processEngine.setConfigurationClass(childElement.getText());
        } else if (DATASOURCE.equals(childElement.getTagName())) {
            processEngine.setDatasource(childElement.getText());
        } else if (JOB_ACQUISITION.equals(childElement.getTagName())) {
            processEngine.setJobAcquisitionName(childElement.getText());
        } else if (PROPERTIES.equals(childElement.getTagName())) {
            parseProperties(childElement, properties);
        } else if (PLUGINS.equals(childElement.getTagName())) {
            parseProcessEnginePlugins(childElement, plugins);
        }
    }
    // set collected properties
    processEngine.setProperties(properties);
    // set plugins
    processEngine.setPlugins(plugins);
    // add the process engine to the list of parsed engines.
    parsedProcessEngines.add(processEngine);
}
Also used : ProcessEnginePluginXml(org.camunda.bpm.container.impl.metadata.spi.ProcessEnginePluginXml) HashMap(java.util.HashMap) Element(org.camunda.bpm.engine.impl.util.xml.Element) ArrayList(java.util.ArrayList)

Example 3 with Element

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

the class BpmnParseUtil method parseInputOutput.

/**
 * Returns the {@link IoMapping} of an element.
 *
 * @param element the element to parse
 * @return the input output mapping or null if non defined
 * @throws BpmnParseException if a input/output parameter element is malformed
 */
public static IoMapping parseInputOutput(Element element) {
    Element inputOutputElement = element.elementNS(BpmnParse.CAMUNDA_BPMN_EXTENSIONS_NS, "inputOutput");
    if (inputOutputElement != null) {
        IoMapping ioMapping = new IoMapping();
        parseCamundaInputParameters(inputOutputElement, ioMapping);
        parseCamundaOutputParameters(inputOutputElement, ioMapping);
        return ioMapping;
    }
    return null;
}
Also used : IoMapping(org.camunda.bpm.engine.impl.core.variable.mapping.IoMapping) Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 4 with Element

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

the class BpmnParse method parsePotentialOwnerResourceAssignment.

protected void parsePotentialOwnerResourceAssignment(Element performerElement, TaskDefinition taskDefinition) {
    Element raeElement = performerElement.element(RESOURCE_ASSIGNMENT_EXPR);
    if (raeElement != null) {
        Element feElement = raeElement.element(FORMAL_EXPRESSION);
        if (feElement != null) {
            List<String> assignmentExpressions = parseCommaSeparatedList(feElement.getText());
            for (String assignmentExpression : assignmentExpressions) {
                assignmentExpression = assignmentExpression.trim();
                if (assignmentExpression.startsWith(USER_PREFIX)) {
                    String userAssignementId = getAssignmentId(assignmentExpression, USER_PREFIX);
                    taskDefinition.addCandidateUserIdExpression(expressionManager.createExpression(userAssignementId));
                } else if (assignmentExpression.startsWith(GROUP_PREFIX)) {
                    String groupAssignementId = getAssignmentId(assignmentExpression, GROUP_PREFIX);
                    taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(groupAssignementId));
                } else {
                    // default: given string is a goupId, as-is.
                    taskDefinition.addCandidateGroupIdExpression(expressionManager.createExpression(assignmentExpression));
                }
            }
        }
    }
}
Also used : Element(org.camunda.bpm.engine.impl.util.xml.Element)

Example 5 with Element

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

the class BpmnParse method parsePotentialStarterResourceAssignment.

protected void parsePotentialStarterResourceAssignment(Element performerElement, ProcessDefinitionEntity processDefinition) {
    Element raeElement = performerElement.element(RESOURCE_ASSIGNMENT_EXPR);
    if (raeElement != null) {
        Element feElement = raeElement.element(FORMAL_EXPRESSION);
        if (feElement != null) {
            List<String> assignmentExpressions = parseCommaSeparatedList(feElement.getText());
            for (String assignmentExpression : assignmentExpressions) {
                assignmentExpression = assignmentExpression.trim();
                if (assignmentExpression.startsWith(USER_PREFIX)) {
                    String userAssignementId = getAssignmentId(assignmentExpression, USER_PREFIX);
                    processDefinition.addCandidateStarterUserIdExpression(expressionManager.createExpression(userAssignementId));
                } else if (assignmentExpression.startsWith(GROUP_PREFIX)) {
                    String groupAssignementId = getAssignmentId(assignmentExpression, GROUP_PREFIX);
                    processDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(groupAssignementId));
                } else {
                    // default: given string is a goupId, as-is.
                    processDefinition.addCandidateStarterGroupIdExpression(expressionManager.createExpression(assignmentExpression));
                }
            }
        }
    }
}
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