Search in sources :

Example 1 with OASGenerator

use of org.kie.server.services.dmn.modelspecific.OASGenerator in project droolsjbpm-integration by kiegroup.

the class ModelEvaluatorServiceBase method getOAS.

public Response getOAS(String containerId, boolean asJSON) {
    try {
        KieContainerInstanceImpl kContainer = context.getContainer(containerId, ContainerLocatorProvider.get().getLocator());
        ReleaseId resolvedReleaseId = kContainer.getKieContainer().getResolvedReleaseId();
        DMNRuntime dmnRuntime = KieRuntimeFactory.of(kContainer.getKieContainer().getKieBase()).get(DMNRuntime.class);
        Collection<DMNModel> models = dmnRuntime.getModels();
        String content = new OASGenerator(containerId, resolvedReleaseId).generateOAS(models, asJSON);
        return Response.ok().entity(content).build();
    } catch (Exception e) {
        LOG.error("Error from container '" + containerId + "'", e);
        return Response.serverError().entity(e.getMessage()).build();
    }
}
Also used : KieContainerInstanceImpl(org.kie.server.services.impl.KieContainerInstanceImpl) ReleaseId(org.kie.api.builder.ReleaseId) OASGenerator(org.kie.server.services.dmn.modelspecific.OASGenerator) DMNRuntime(org.kie.dmn.api.core.DMNRuntime) DMNModel(org.kie.dmn.api.core.DMNModel)

Aggregations

ReleaseId (org.kie.api.builder.ReleaseId)1 DMNModel (org.kie.dmn.api.core.DMNModel)1 DMNRuntime (org.kie.dmn.api.core.DMNRuntime)1 OASGenerator (org.kie.server.services.dmn.modelspecific.OASGenerator)1 KieContainerInstanceImpl (org.kie.server.services.impl.KieContainerInstanceImpl)1