use of org.kie.dmn.api.core.DMNPackage in project drools by kiegroup.
the class DMNRuntimeKBWrappingIKB method getModelById.
@Override
public DMNModel getModelById(String namespace, String modelId) {
Objects.requireNonNull(namespace, () -> MsgUtil.createMessage(Msg.PARAM_CANNOT_BE_NULL, "namespace"));
Objects.requireNonNull(modelId, () -> MsgUtil.createMessage(Msg.PARAM_CANNOT_BE_NULL, "modelId"));
InternalKnowledgePackage kpkg = (InternalKnowledgePackage) knowledgeBase.getKiePackage(namespace);
if (kpkg == null) {
return null;
}
ResourceTypePackageRegistry map = kpkg.getResourceTypePackages();
DMNPackage dmnpkg = (DMNPackage) map.get(ResourceType.DMN);
return dmnpkg != null ? dmnpkg.getModelById(modelId) : null;
}
use of org.kie.dmn.api.core.DMNPackage in project drools by kiegroup.
the class DMNRuntimeKBWrappingIKB method getModels.
@Override
public List<DMNModel> getModels() {
List<DMNModel> models = new ArrayList<>();
knowledgeBase.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;
}
use of org.kie.dmn.api.core.DMNPackage 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.kie.dmn.api.core.DMNPackage 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;
}
use of org.kie.dmn.api.core.DMNPackage in project drools by kiegroup.
the class DMNRuntimeKBWrappingIKB method getModel.
@Override
public DMNModel getModel(String namespace, String modelName) {
Objects.requireNonNull(namespace, () -> MsgUtil.createMessage(Msg.PARAM_CANNOT_BE_NULL, "namespace"));
Objects.requireNonNull(modelName, () -> MsgUtil.createMessage(Msg.PARAM_CANNOT_BE_NULL, "modelName"));
InternalKnowledgePackage kpkg = (InternalKnowledgePackage) knowledgeBase.getKiePackage(namespace);
if (kpkg == null) {
return null;
}
ResourceTypePackageRegistry map = kpkg.getResourceTypePackages();
DMNPackage dmnpkg = (DMNPackage) map.get(ResourceType.DMN);
return dmnpkg != null ? dmnpkg.getModel(modelName) : null;
}
Aggregations