use of org.camunda.bpm.model.xml.impl.ModelBuilderImpl in project axelor-open-suite by axelor.
the class BpmDeploymentServiceImpl method addProcessConfig.
private void addProcessConfig(BpmnModelInstance bpmInstance, WkfProcess process) {
BaseElement processElement = bpmInstance.getModelElementById(process.getName());
ExtensionElements extensionElements = processElement.getExtensionElements();
if (extensionElements == null) {
return;
}
ModelBuilderImpl builderImpl = new ModelBuilderImpl(null);
ModelElementType processConfigType = builderImpl.defineGenericType("processConfiguration", BpmnParser.CAMUNDA_BPMN_EXTENSIONS_NS);
List<ModelElementInstance> processConfigElements = extensionElements.getElementsQuery().filterByType(processConfigType).list();
if (processConfigElements == null || processConfigElements.size() == 0) {
return;
}
ModelElementInstance processConfigElement = processConfigElements.get(0);
Map<String, WkfProcessConfig> configMap = createConfigMap(process);
ModelElementType processConfigParamType = builderImpl.defineGenericType("processConfigurationParameter", BpmnParser.CAMUNDA_BPMN_EXTENSIONS_NS);
Collection<ModelElementInstance> configParams = processConfigElement.getChildElementsByType(processConfigParamType);
for (ModelElementInstance configParam : configParams) {
WkfProcessConfig config = getProcessCofig(configMap, configParam);
config = (WkfProcessConfig) wkfService.addProperties(WkfPropertyMapper.PROCESS_CONFIG_PROPERTIES, config, configParam);
process.addWkfProcessConfigListItem(config);
}
}
Aggregations