cancel
Showing results for 
Search instead for 
Did you mean: 

External database select and insert

pkruch
Champ in-the-making
Champ in-the-making
Hi experts !

I have already post this but on the developer forum and it was not the good, so I post my question.

And now, I have not one but two questions (sorry) :

First :

So, I have designed a simple process under activiti (start event –> taskuser1 –> taskuser2 –> end event).
In the taskuser1, I have a form with some form properties.
When I deploy my process under activiti explorer, it works fine with the form.

But, my next step is : take data from an external mysql database and display it into a form property.

How can I do that ?
I tried to add in Preferences –> Data Management –> Connectivity –> Driver Definitions my jdbc driver and it's ok.
But when I right click on my project in the activiti Explorer and choose New –> Other –> Connection Profile and try to add a connection, It doesn't work.
Is it the best way to take data from an external database and inject them into a form ?

I try since yesterday but no way to do that.

(I specify that I want use H2 and an external database (mysql))"


Second :
In a other way, I try to populate my external database with the data filled by the user in the usertask1 form but I don't know how do that.
I think I should connect my external mysql database with a connection profil but like said in the first point, it seems not work fine (oing failed).
But after, how do that ?
I don't really understand the userguide about this point.


End of my questions.

Thanks for your responses Smiley Happy

(I am sorry if this questions and so responses very simple, but I a very very beginner in activiti and not really good in development)
2 REPLIES 2

frederikherema1
Star Contributor
Star Contributor
If you want to have external pre-data filled in into a form, you'll have to make activiti aware of your services that access that data. You can follow 2 approaches:
  • Create services that epos the data you need. Wire in your services (spring e.g..) to make them available in Activiti-expressions. see http://activiti.org/userguide/index.html#exposingConfigurationBeans and http://activiti.org/userguide/index.html#N10701. You could use the "default" attribute on formProperties to include an expression like "${myService.getSomeValue()}.

  • If you want to have a list of options to select from, you'll have to create a custom variable type, which does some lookup for you in the service and displays it. Additionally, when usig explorer, you should create a custom "rendered" from this. Look into org.activiti.explorer.ui.form.UserFormPropertyRenderer for inspiration on this.

heba
Champ in-the-making
Champ in-the-making
@pkruch  if you get an answer please write i want the answers of your questions too