cancel
Showing results for 
Search instead for 
Did you mean: 

Need to access processVariables in convertFormValueToModelValue()

stephan_bauer
Champ in-the-making
Champ in-the-making
Hi,

I have been searching the forum now very deeply, but I couldn't find any topic that fits for my problem:

I write my own custom FormType (extends AbstractFormType). I wanted to do it analog to the more complex "ProcessDefinitionFormType" example explained in http://www.jorambarrez.be/blog/2013/03/13/creating-a-new-form-property-in-activiti/

The difference to the example above is, that my Modelobjects are stored in a List-Attribute of a Bean class, which itself is a processVariable. I retrieve that Bean in a taskListener when a new processinstance starts and put it also into the processVariables from there.

My problem now is, that the convertFormValueToModelValue()-Method does not know, which ProcessInstance is currently involved. It only knows the "propertyValue"- argument. Is there a way to get the missing link?

The same problem exists for my implementation of the AbstractFormPropertyRenderer. In order to populate the ComboBox, I must iterate over the list in the Bean.

Many thanks in advance,
Stephan
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
I'm not sure, but can you get the current ExecutionContext (Context.getExecutionContext():smileywink:, that would give you the current execution and thus the process instance.

stephan_bauer
Champ in-the-making
Champ in-the-making
Hi Joram,
thanks, but I could neither find a class named "Context" nor "ExecutionContext". In which jar file are they included?
thanks again,
Stephan

stephan_bauer
Champ in-the-making
Champ in-the-making
ups, I only looked into the api-docs. I found the classes in the impl packages. sorry for stealing your time. Finally I must decide for myself, if I want to use an impl class directly in my source code (I mean from a "design-technical" point of view).
Thanks,
Stephan

stephan_bauer
Champ in-the-making
Champ in-the-making
sorry, I need to follow up once more. If I used activiti-cdi, would it then be possible to inject activiti-stuff into my custom form type? If yes, which scope suits best for that case? => This maybe turns out to become a more general question: Which Scope suits best for the other stuff I extend, like TaskListeners, especially when i am inside the activiti-explorer.war (to be more precise: we are trying to use activiti-stuff only inside the explorer webapp and plan to make REST-calls into a completely separate EAR file (which itself is unaware of activiti) for the "real" business logic stuff).
Thanks again,
Stephan

jbarrez
Star Contributor
Star Contributor
> Finally I must decide for myself, if I want to use an impl class directly in my source code

Valid point. Those impl classes are indeed not seen as 'stable' vs the API.

>  If I used activiti-cdi, would it then be possible to inject activiti-stuff into my custom form type

Im not sure about CDI (not my main knowledge) - but if the form stuff is in a bean that should work. However, I don't know how this setup would look as the order if injecting will probably have influence.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.