cancel
Showing results for 
Search instead for 
Did you mean: 

About the ProcessDefinitionEntity v5.0rc1

hery1
Champ in-the-making
Champ in-the-making
Hi,

I was using activiti v5.0beta2 before.
In 5.0beta2, the org.activiti.engine.impl.repository.ProcessDefinitionEntity has an attribute called startFormResourceKey that contains the string for the start form.

I upgraded to 5.0rc1 and I noticed that this attribute has disappeared. I noticed there is a new attribute called startFormHandler. I tried that attribute using this code:

        ProcessDefinition pd; //get pd from somewhere
        ProcessDefinitionEntity pde = (ProcessDefinitionEntity) pd;
        DefaultStartFormHandler dsfh = (DefaultStartFormHandler) pde.getStartFormHandler();
        if (dsfh != null) {
            formKey = dsfh.getFormKey();
        }
However the dsfh is always null.

I tried using the new form service as well:

            ProcessDefinition pd; //get pd from somewhere
            Object obj = formService.getRenderedStartForm(pd.getId());
            if (obj != null) {
                FormData fd = (FormData) obj;
                System.out.println("fd key: " + fd.getFormKey());
            }
However the obj is always null.

Update:
I tried another method given by form service:


            StartFormData sfd = formService.getStartFormData(pd.getId());
            if (sfd != null) {
                System.out.println("sfd is not null");
                String formKey = sfd.getFormKey();
                System.out.println("form key: " + formKey);
            }
            else {
                System.out.println("sfd is null");
            }
And I get the output "sfd is not null" but the formKey is still null.

For all the programs above, the sample data I used is the VacationRequest.bpmn20.xml.

Can someone help me to get back the start form string again?
2 REPLIES 2

hery1
Champ in-the-making
Champ in-the-making
Never mind. It is solved. The main problem is because I used the old version of the VacationRequest.bpmn20.xml.
The third way works with the new VacationRequest.bpmn20.xml, didn't bother to try the other ways.

jbarrez
Star Contributor
Star Contributor
Thanks for posting that, will help many people 🙂

Is it clear to you know how to retrieve the formKey ?