camunda工作流引擎介绍二:自定义用户插件-附源码

原创不易,请多多支持!对Java技术感兴趣的童鞋请关注我,后续技术分享更精彩。 

概述

上篇介绍了camunda工作流引擎的入门知识( )。这篇将针对camunda用户体系做深入定制化集成,让引擎工具更好的与业务相结合。

实现思路

通过实现camunda定义的用户读写接口,并采用插件机制运行时注入到工作流引擎中,从而达到定制化用户替换框架默认用户体系的目的。

Identity Service

实现接口

•org.camunda.bpm.engine.impl.identity.ReadOnlyIdentityProvider

•org.camunda.bpm.engine.impl.identity.WritableIdentityProvider

Process Engine Plugin

插件实现说明:

https://docs.camunda.org/manual/7.7/user-guide/process-engine/process-engine-plugins/

插件实现接口:

org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin

Configure Process Engine Plugins

configure a process engine plugin in a bpm-platform.xml


<bpm-platform> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.camunda.org/schema/1.0/BpmPlatform http://www.camunda.org/schema/1.0/BpmPlatform ">
<job-executor>
<job-acquisition>
/<job-executor>
<process-engine>
<job-acquisition>default/<job-acquisition>
<configuration>org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration/<configuration>
<datasource>jdbc/ProcessEngine/<datasource>
<plugins>
<plugin>
<class>org.camunda.bpm.engine.MyCustomProcessEnginePlugin/<class>
<properties>
<property>10/<property>
<property>true/<property>
<property>akka/<property>
/<properties>
/<plugin>
/<plugins>
/<process-engine>
/<bpm-platform>

configure a process engine plugin in a spring beans xml

<beans> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean>
...
<property>
<list>

/<list>
/<property>
/<bean>
<bean>
<property>
<property>
<property>
<property>
<property>
<property>
<property>
<property>
<property>

<property>
<property>
<property>
<property>
<property>
<property>
<property>
<property>
/<bean>
/<beans>

Process Engine Plugins UML

camunda工作流引擎介绍二:自定义用户插件-附源码

Process Engine Plugins 注意事项

•UserEntity和GroupEntity id属性表示业务系统中登陆用户名,非系统id主键。

•UserEntity password对应设置属性方法为setDbPassword,非setPassword。 setPassword表示修改密码的新密码属性方法入口。

Process Engine Plugins 集成示例

demo源代码实现请参考以下代码仓库地址

https://github.com/eagle00001/camunda-user-plugin-demo


分享到:


相關文章: