Generate dmn - How to set model.getName()?


I am generating DMN decision models based on existing rule-expressions. Problem: I need to deploy multiple modelInstances at once, but when I use

public Deployment deploy(final List<DmnModelInstance> modelInstances) {
    final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();

    modelInstances.forEach(dmn -> deploymentBuilder.addString(

    return deploymentBuilder.deploy();

the model name for all instances is “DMN Model”. How can I (programmatically, based solely on the modelInstance (I have separated concerns here)) determin the model name to use for deployment? It would also be okay to get the name of the (single) decision table wrapped inside. Thanks!

Hi Jan,

you can’t change the name of the model. Instead, you should use the id of the definitions (i.e. the root element) or the id of the decision - if the DMN contains only one decision. Note that the decision id and the definitions id (for DRG only) must be unique since the ids are used for the definition key (i.e. the DB entity).

Does this help you?

Best regards,

Hm … yes it helps me, I guess … I already came up with some

public static String getDecisionName(DmnModelInstance modelInstance) {
    return modelInstance.getDefinitions().getChildElementsByType(Decision.class)

which is what you meant, right (not using DRG)?

But still I find the Model-API very confusing …

Hi Jan,

yes, it looks good :slight_smile:

Do you have any additional question?

Best regards,