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><plugin ... /></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);
}
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><process-engine .../></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);
}
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;
}
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));
}
}
}
}
}
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));
}
}
}
}
}
Aggregations