use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.callbacks.DMN12UnmarshallCallback in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsService method getDRGElements.
public void getDRGElements(final String dmnXml, final ServiceCallback<List<DRGElement>> callback) {
final DMN12UnmarshallCallback jsCallback = dmn12 -> {
final JSITDefinitions dmnDefinitions = Js.uncheckedCast(JsUtils.getUnwrappedElement(dmn12));
callback.onSuccess(modelToStunnerConverter.makeNodes(dmnDefinitions, new HashMap<>(), false, (a, b) -> {
/* Nothing. */
}).stream().map(e -> getDRGElement(e.getNode())).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList()));
};
MainJs.unmarshall(dmnXml, "", jsCallback);
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.callbacks.DMN12UnmarshallCallback in project kie-wb-common by kiegroup.
the class DMNMarshallerService method unmarshall.
public void unmarshall(final Metadata metadata, final String xml, final ServiceCallback<Diagram> callback) {
setOnDiagramLoad(callback);
setMetadata(metadata);
try {
final DMN12UnmarshallCallback jsCallback = dmn12 -> {
final JSITDefinitions definitions = Js.uncheckedCast(JsUtils.getUnwrappedElement(dmn12));
dmnUnmarshaller.unmarshall(getMetadata(), definitions).then(graph -> {
final String fileName = getMetadata().getPath().getFileName();
onDiagramLoad(dmnDiagramFactory.build(fileName, getMetadata(), graph));
return promises.resolve();
});
};
MainJs.unmarshall(xml, "", jsCallback);
} catch (final Exception e) {
GWT.log(e.getMessage(), e);
callback.onError(new ClientRuntimeError(new DiagramParsingException(getMetadata(), xml)));
}
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.callbacks.DMN12UnmarshallCallback in project kie-wb-common by kiegroup.
the class DMNMarshallerImportsService method getDMNDefinitions.
public void getDMNDefinitions(final String dmnXml, final ServiceCallback<JSITDefinitions> callback) {
final DMN12UnmarshallCallback jsCallback = dmn12 -> {
final JSITDefinitions dmnDefinitions = Js.uncheckedCast(JsUtils.getUnwrappedElement(dmn12));
callback.onSuccess(dmnDefinitions);
};
MainJs.unmarshall(dmnXml, "", jsCallback);
}
Aggregations