use of org.drools.compiler.compiler.BaseKnowledgeBuilderResultImpl in project drools by kiegroup.
the class KnowledgeBuilderImpl method addProcessFromXml.
public void addProcessFromXml(Resource resource) {
if (processBuilder == null) {
throw new RuntimeException("Unable to instantiate a process assembler");
}
if (ResourceType.DRF.equals(resource.getResourceType())) {
addBuilderResult(new DeprecatedResourceTypeWarning(resource, "RF"));
}
this.resource = resource;
try {
List<Process> processes = processBuilder.addProcessFromXml(resource);
List<BaseKnowledgeBuilderResultImpl> errors = processBuilder.getErrors();
if (errors.isEmpty()) {
if (this.kBase != null && processes != null) {
for (Process process : processes) {
if (filterAccepts(ResourceChange.Type.PROCESS, process.getNamespace(), process.getId())) {
this.kBase.addProcess(process);
}
}
}
} else {
this.results.addAll(errors);
errors.clear();
}
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
addBuilderResult(new ProcessLoadError(resource, "Unable to load process.", e));
}
this.results = getResults(this.results);
this.resource = null;
}
Aggregations