如何在Drools中从Java API操作引导式决策表? [英] How to manipulate guided decision table from Java API in Drools?

查看:168
本文介绍了如何在Drools中从Java API操作引导式决策表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我需要从基于Web的自定义UI操纵Drools指导的决策表内容(只是数据而不是结构)。



我已经搜索了很多,但是我无法在Drools中找到任何Java或REST API来访问指导决策表。



任何帮助将不胜感激。

解决方案

我假设您正在谈论的是kie-workbench中的指导决策表。



据我所知,尚无公共API来操纵引导式决策表,但是您可以做另一件事。实际上,kie-workbench中的每个项目都是一个保存在本地git存储库中的maven项目。好消息是您实际上可以制作



在上面的屏幕截图中,您可以看到一个 Pricing loan.gdst 文件。该文件的内容是一个xml,其中包含定价贷款指导的决策表的结构和数据。



这是有趣的地方。如果您深入研究kie-workbench代码,我相信您会找到某种未记录的且易失的API来处理这些.gdst文件。毕竟,kie-workbench实际上是在创建和修改这些文件。这里的挑战是:


  1. 查找此API

  2. 了解此API

从技术角度来看,另一种解决方案可能不是最佳解决方案,但是对于诸如数据操作之类的简单事情而言,它更易于实现-使用XML库解析和修改这些 .gdst 文件。



完成更改后,您可以将其推回至kie-workbench,并且GUI用户可以使用它们。



当然,这两个建议的解决方案都不是理想的。使用未打算供第三方使用且将来肯定会改变的未公开说明的API听起来可能不是一个好主意。但是,手动解析其语义可能会在不同版本的kie-workbench上改变的XML文件也带来了一些挑战。



希望它会有所帮助,


I have requirement in my project where I need to manipulate Drools guided decision table content (just data not structure) from a custom web based UI.

I have searched a lot but I'm not able to find any Java or REST API in Drools which gives access to guided decision table.

Any help would be appreciated.

解决方案

I'm assuming you are talking about guided decision tables in the kie-workbench.

As far as I know, there is no public API to manipulate a guided decision table, but there is another thing you can do. Each project in the kie-workbench is in reality a maven project persisted in a local git repository. The good news is that you can actually make a clone of that repository.

Once you have a local clone of your project, you can locate the guided decision table you want to modify as a file with .gdst extension.

For example, this is the directory structure of the uf-playground sample project coming with the kie-workbench:

In the screenshot above you can see a Pricing loans.gdst file. The content of this file is an xml containing both, the structure and the data of the "Pricing loans" guided decision table.

And here is where things get interesting. If you dig deep down into the kie-workbench code, I'm sure you will find some kind of undocumented and very volatile API to handle these .gdst files. After all, the kie-workbench is actually creating and modifying these files. The challenge here are:

  1. Find this API
  2. Understand this API

Another solution that, from the technical point of view may not be the best, - but that is easier to implement for simple things such as data manipulation - is to parse and modify those .gdst files using an XML library.

Once you are done with the changes you can push them back to the kie-workbench and they will be available for the GUI users.

Of course none of these 2 proposed solutions are ideal. Using an undocumented API that was not meant to be used by third parties and that will certainly change in the future may not sound like a good idea. But manually parsing an XML file whose semantic may probably change on different versions of the kie-workbench also presents some challenges.

Hope it helps,

这篇关于如何在Drools中从Java API操作引导式决策表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆