use of org.drools.core.definitions.InternalKnowledgePackage in project drools by kiegroup.
the class DMNRuntimeImpl method getModel.
@Override
public DMNModel getModel(String namespace, String modelName) {
InternalKnowledgePackage kpkg = (InternalKnowledgePackage) runtime.getKieBase().getKiePackage(namespace);
if (kpkg == null) {
return null;
}
Map<ResourceType, ResourceTypePackage> map = kpkg.getResourceTypePackages();
DMNPackage dmnpkg = (DMNPackage) map.get(ResourceType.DMN);
return dmnpkg != null ? dmnpkg.getModel(modelName) : null;
}
use of org.drools.core.definitions.InternalKnowledgePackage in project drools by kiegroup.
the class DMNRuntimeImpl method getModels.
@Override
public List<DMNModel> getModels() {
List<DMNModel> models = new ArrayList<>();
runtime.getKieBase().getKiePackages().forEach(kpkg -> {
DMNPackage dmnPkg = (DMNPackage) ((InternalKnowledgePackage) kpkg).getResourceTypePackages().get(ResourceType.DMN);
if (dmnPkg != null) {
dmnPkg.getAllModels().values().forEach(model -> models.add(model));
}
});
return models;
}
Aggregations