Search in sources :

Example 1 with ModelBuilderImpl

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);
    }
}
Also used : ModelBuilderImpl(org.camunda.bpm.model.xml.impl.ModelBuilderImpl) ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) BaseElement(org.camunda.bpm.model.bpmn.instance.BaseElement) ExtensionElements(org.camunda.bpm.model.bpmn.instance.ExtensionElements) WkfProcessConfig(com.axelor.apps.bpm.db.WkfProcessConfig) ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance)

Aggregations

WkfProcessConfig (com.axelor.apps.bpm.db.WkfProcessConfig)1 BaseElement (org.camunda.bpm.model.bpmn.instance.BaseElement)1 ExtensionElements (org.camunda.bpm.model.bpmn.instance.ExtensionElements)1 ModelBuilderImpl (org.camunda.bpm.model.xml.impl.ModelBuilderImpl)1 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)1 ModelElementType (org.camunda.bpm.model.xml.type.ModelElementType)1