cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic process Id generation

hyapit
Champ in-the-making
Champ in-the-making
Hi guys,

I'd like to be able to programmatically generate process-id dynamically at runtime. You can't seem to use ${process_variables} to do this within .bpmn20.xml file – I got XML parse exception doing this. Is there any other way in XML / Java API that allows this before a Deployment is deployed?

My workaround is to parse .bpmn20.xml into String, replaced the Id myself, before converting it back into InputStream for Bpmn parsing, but I'm hoping to get better suggestion.

Thanks!

hussein
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
You can read the xml into a BpmnModel first, and change the id through the Java api. Afterwards, simply deploy that BpmnModel through the repositoryService.

What do you mean with 'tag'? Don't get that.

hyapit
Champ in-the-making
Champ in-the-making
Whoops, I meant timeCycle tag. I had angle brackets around "timeCycle" that it was removed in the forum. Apologies.

<timerCycle>${cronExpression}</timerCycle>

is failing for me with XMLParseException. Thoughts?

Thanks a lot for the response.

hyapit
Champ in-the-making
Champ in-the-making
Btw, slightly off-topic, but similar problem:

Same goes for value of timeCycle tag. It doesn't take a ${process_variable}, and failed with XML parsing error. This contradicts with what the docs says:

You can use expressions for the timer event definitions, by doing so you can influence the timer definition based on process variables. The process variables must contain the ISO 8601 (or cron for cycle type) string for appropriate timer type.

trademak
Star Contributor
Star Contributor
The timeCycle tag works ok with the XML converter. I've added the tag to the UserTaskConverter test in the activiti-bpmn-converter module to show that. I see that you use timerCycle instead of timeCycle, that could be the issue.

Best regards,