We have a Activiti workflow with UI developed using JSF , JPA and CDI. We have a submit screen which is associated with start-form-key and one User task which corresponds
to the approver screen.
I have some questions :-
Q1) We have a requirement such that if Approver rejects the data then we need to send request back to Sumitter which in our case is not
a user task but a form associated with start event, so how do we accomplish that. Either we move submit screen to a user task by itself or we loop back after approver user task and keep an intermediate user task of re-submission. which one will be good option. ?
Q2) The Approver is selected dynamically from the Submit screen in a drop-down. So where do we store this value such that it becomes a assignee in the Approver user task. Do we inject it as a process variable or we keep it in a session scoped CDI bean and access it via EL expression in the assignee property. ?
Q3) If the approver Rejects the data, how do we assign it back to the original submitter, do we need to keep track of submitter in a process variable or a CDI bean or there is any API available ?
Q4) After Approval I need to "insert" data in our business database which is different than Acitivi, so we have configure JTA for 2 phase commit. Now my question is that this "insert" should happen inside JSF UI controller code of Approval screen or it should happen inside a service task which gets called after completion of Approval user Task. In case the "insert" happens inside a service task then how do I pass my Entity and Entity Manager to Java delegate of service task. Can I inject JTA UserTransaction inside Java delegate so that both my business data Insert and Activiti process completion happens together.