suvaio
March 13, 2017, 5:00am
1
I need to use the DMN in my project and the requirement is to add a new RULE programmatically in an existing decision table.
DmnModelInstance dmnModelInstance = Dmn.readModelFromStream(ExampleTestCompatibility.class.getResourceAsStream(“Example.dmn”));
DecisionTable decisionTable = dmnModelInstance.getModelElementById(“decisionTable”);
decisionTable.getRules().add(newRules);
When I drilled down into the source code,I found that ChildElementCollectionBuilderImpl class in camunda-xml-model where the collection is made immutable … collection.setImmutable();
Is there any sort of restriction of not allowing to append row in an existing Decision Table ?
Hi @suvaio ,
please have a look at the class:
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.camunda.bpm.dmn.engine.benchmark.util;
import java.io.File;
import java.io.InputStream;
import org.camunda.bpm.model.dmn.Dmn;
import org.camunda.bpm.model.dmn.DmnModelInstance;
import org.camunda.bpm.model.dmn.instance.Decision;
This file has been truncated. show original
Does this help you?
Best regards,
Philipp
suvaio
March 13, 2017, 8:41am
3
Thanks a lot.
The problem might have been with the template I was using.