Hello everyone,
I have decision table created through modeler,and want to add new rule in it using API, so I am trying this using below code, any idea why this is not working ?
DecisionTable decisionTable = dmnModelInstance.getModelElementById("decisionTable");
Rule rule = dmnModelInstance.newInstance(Rule.class);
//add value for input1
Text text1 = dmnModelInstance.newInstance(Text.class);
text1.setTextContent("New input1");
InputEntry inputEntry1 = dmnModelInstance.newInstance(InputEntry.class);
inputEntry1.setText(text1);
rule.getInputEntries().add(inputEntry1);
//add value for input2
Text text2 = dmnModelInstance.newInstance(Text.class);
text2.setTextContent("New input2");
InputEntry inputEntry2 = dmnModelInstance.newInstance(InputEntry.class);
inputEntry2.setText(text2);
rule.getInputEntries().add(inputEntry2);
//add value for output
Text text3 = dmnModelInstance.newInstance(Text.class);
text3.setTextContent("new output");
OutputEntry outputEntry = dmnModelInstance.newInstance(OutputEntry.class);
outputEntry.setText(text3);
rule.getOutputEntries().add(outputEntry);
decisionTable.getRules().add(rule);
Thanks,
Anjum