简体   繁体   English

如何在Camunda中触发表格更改(使用Grails)?

[英]How to trigger table changes in camunda (using grails)?

I am migrating my grails app from activiti to camunda (both used as grails plugins). 我正在将我的grails应用程序从activiti迁移到camunda(都用作grails插件)。 Because there is no full (automatic) database migration, I have to do some changes by myself (with the db migration plugin). 因为没有完整的(自动)数据库迁移,所以我必须自己做一些更改(使用db migration plugin)。 Only a few new tables will be created by camunda (if the property cmmn is set to true). camunda将仅创建几个新表(如果将属性cmmn设置为true)。

To do so I have to disable the job executor from camunda and disable cmmn (to avoid the migration). 为此,我必须从camunda禁用作业执行程序并禁用cmmn(以避免迁移)。 If I don't disable both mentioned properties, camunda is trying to create the new tables before the database migration plugin can do its part. 如果我没有同时禁用这两个属性,那么camunda会尝试创建新表, 然后数据库迁移插件才能发挥作用。 And this will fail, because some columns are missing (used as foreign key constraints). 这将失败,因为缺少某些列(用作外键约束)。

After the migration is done by the database migration plugin, the remaining tables should be created by camunda. 由数据库迁移插件完成迁移后,其余表应由camunda创建。 And this is only done, if cmmn is enabled. 并且仅在启用cmmn的情况下才能执行此操作。 So I enabled the job executor in bootstrap.groovy and enabled cmmn. 因此,我在bootstrap.groovy中启用了作业执行程序,并启用了cmmn。

// will be injected by spring
def processEngine

processEngine.jobExecutor.start() 
processEngine.processEngineConfiguration.cmmnEnabled = true

The problem now is, that I am not able to trigger the database table creation. 现在的问题是,我无法触发数据库表的创建。 Because this is done during process engine creation / instantiation (and I already have a process engine). 因为这是在流程引擎创建/实例化过程中完成的(并且我已经有一个流程引擎)。 The necessary method to call is executeSchemaOperations() , but this method is protected (yes, I know that this isn't really a problem in groovy because private / protected methods can be called). 调用的必要方法是executeSchemaOperations() ,但是此方法是受保护的(是的,我知道这在Groovy中并不是真正的问题,因为可以调用私有/受保护的方法)。 But, and this is my question, is there a better way to trigger the table creation? 但是,这是我的问题,是否有更好的方法来触发表创建?

I am using grails 2.3.11 and camunda plugin 0.4 (with camunda 7.2). 我正在使用grails 2.3.11和camunda插件0.4(带有camunda 7.2)。

Best regards and thanks for your help, Daniel 最好的问候,并感谢您的帮助,丹尼尔

Interesting problem and it seems you have already solved the majority of the problems. 有趣的问题,看来您已经解决了大多数问题。

Looking at the executeSchemaOperations() protected method, it appears as though it simply calls a command executor that is retrieved from the process Engine configuration. 看一下executeSchemaOperations()受保护的方法,看起来好像它只是简单地调用从流程引擎配置中检索的命令执行程序一样。

So, likely you could do something like: 因此,可能您可以执行以下操作:

processEngineConfiguration.getCommandExecutorSchemaOperations().execute(new SchemaOperationsProcessEngineBuild()) processEngineConfiguration.getCommandExecutorSchemaOperations()。execute(new SchemaOperationsProcessEngineBuild())

SchemaOperationsProcessEngineBuild should be imported from org.comunda.bpm.engine.impl SchemaOperationsProcessEngineBuild应该从org.comunda.bpm.engine.impl导入

Obviously, as you say, you could simply call the protected method, but the above gets you past the issue of protected methods. 显然,正如您所说的,您可以简单地调用protected方法,但是以上内容使您摆脱了protected方法的问题。

Cheers, Greg 干杯,格雷格

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM