cancel
Showing results for 
Search instead for 
Did you mean: 

How to model jsf form properties as process variables

sherlock
Champ in-the-making
Champ in-the-making
Hi,
We are buildig a workflow using Activiti, JSF/PrimeFaces and JEE/CDI.
Our JSF form has about 40 form fields and each field can have different view permissions like (readable,disabled,editable,hidden)
based on privileges of the approver. There are around 5 levels of approvers so we have created 5 user tasks in sequence
but the name of the approvers can only be decided at runtime based on the selection done by previous approver. So
a previous approver has a choice to select next approver based on list available in the drop down, or he can assign it to
a valid group of next level and someone from that group can claim the task.

We are looking for the best practice to model such workflow, here are our initial thoughts.

1) All the 40 fields will be modelled as XML schema elements with appropriate permissions as attributes.
2) The initial submission of form fields will trigger the workflow as well as generate the XML having elements populated.
3) the XML will propagate from one user task to another and in between its contents (elements/attributes) will get modified based on current approver inputs and also based on next approver privileges.
4) The screen will be rendered to the approvers based on the XML contents.

Now we have following questions for each steps above.

Step 1) Can we have a backing bean with all 40 fields and their attributes and propagate that bean instead of XML. If yes than  what should be scope of that bean and does it needs to be converted to process variables ??

Step 2) If we go with XML approach then how will XML exist in the process engine, as a process variable or any other form ?
Step 3) Do we achieve this using XSL transformation inside a service task or maybe XML modification within JSF objects itself ?
Step 4) Whats the best approach to render JSF/PrimeFaces page using this XML ?

Thanks
Sherlock
4 REPLIES 4

sherlock
Champ in-the-making
Champ in-the-making
Hi,

Please give me proper direction to model above workflow.

jbarrez
Star Contributor
Star Contributor
The reason why nobody answers is because it is a pretty specific use-case. As such, nobody reall has 'best practices' on it.

I'll try to give it a go

Step 1) Can we have a backing bean with all 40 fields and their attributes and propagate that bean instead of XML. If yes than what should be scope of that bean and does it needs to be converted to process variables ??

It's been 5 years since I wrote my last line of JSF … so I don't really know the answer to that question. But as far as Activiti goes, you choose whatever you like. Do you want to store it as process variable? Fine, no problem. Only some? No problem too. None at all, and only link it somehow (eg using the formKey) … also not an issue.

Step 2) If we go with XML approach then how will XML exist in the process engine, as a process variable or any other form ?

If you store the XML as-is, it will be one process variable. Note you do lose query functionality in that case.
Of course, having 40 process variables will also have a serious impact on performance.

Step 3) Do we achieve this using XSL transformation inside a service task or maybe XML modification within JSF objects itself ?

My gut feeling says it belongs to the process. That way you don't bind your logic to one UI technology.

Step 4) Whats the best approach to render JSF/PrimeFaces page using this XML ?

No clue, like I said, my jsf is very rusty.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
My addition:
- In my JSF based app (or tapestry or whatever) we use XForms for the forms. Simply because it is best suited to the task
- We use formKey to reference a fulle external (to activiti) form
- We store the XML either as a process variable while in transit (several tasks work on the same xml) and after several steps we store it in our own model.
- We have some generic code that extracts some data via xpath and store it in process variables so it can be easily used in expressions (support for xpath as expressions in Activiti would be nice ;-))
- The rest of the app is in JSF (or whatever)

This approach works great for us

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
No clue, like I said, my jsf is very rusty.

Time to buy a wirebrush and some sanding paper then 🙂