limcheekin / activiti

Grails Activiti Plugin - Enabled Activiti BPM Suite support for Grails
http://code.google.com/p/grails-activiti-plugin/
Apache License 2.0
22 stars 31 forks source link

Add support for configuring data source #2

Open dmurat opened 12 years ago

dmurat commented 12 years ago

Since grails 2.0.0 now support multiple data sources, it would be nice to add support for configuring data source name in activiti plugin.

If this doesn't brake something else in the plugin (i.e. in scripts), I believe this can be implemented by modifying a single line in ActivitiGrailsPlugin:

processEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) {
  //...
  dataSource = ref("dataSource")
  //..
}

should be replaced with

processEngineConfiguration(org.activiti.spring.SpringProcessEngineConfiguration) {
  //...
  dataSource = ref(CH.config.activiti.dataSourceName ?: "dataSource")
  //..
}
dmurat commented 12 years ago

I've just done some preliminary testing, and it works ok after few known bumps :-) I'm also using activiti-spring-security plugin, and I was able to login with user/role stored in default data source, while activiti executed a process (with full history) against another data source. All activiti data was stored correctly, and querying is working too.

Since I'm using activiti-spring-security plugin, I had this issue: http://jira.grails.org/browse/GPSPRINGSECURITYCORE-114 When I changed spring-security-core's User implementation as suggested there (http://jira.grails.org/browse/GPSPRINGSECURITYCORE-114?focusedCommentId=67373&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-67373), all pieces start working.

limcheekin commented 12 years ago

Thanks for further writing and provide solutions for the bumps you hit. I will add multiple data source support in next release of the plugin.