But this is true only for first time deployment as I understand deployment process.
Later when given process definition is out of process definitions cache parsing is executed to put it back.
At this moment process definition id is perfectly known - look at org.activiti.engine.impl.bpmn.deployer.deploy:
if (deployment.isNew()) {
…
}
else
{…
persistedProcessDefinition = processDefinitionManager.findProcessDefinitionByDeploymentAndKey
…
processDefinition.setId(persistedProcessDefinition.getId());
…
}
So, at first time deploy you are rigth - id is not known (maybe in next releases it can be generated before parsing).
But on following deploys (when procDef must be put back into cache) shouldn't be procDef.id set at start (from DB) and passed to parser?
Understand it's not an option for now.
So I'm trying to hook in with custom deployer (public class CustomDeployerAfter implements Deployer{ …)
and something like:
@Override
public void deploy(DeploymentEntity deployment, Map<String, Object> deploymentSettings) {
// TODO Auto-generated method stub
System.out.println("DeployerAfter");
List<ProcessDefinitionEntity> proc_defs=deployment.getDeployedArtifacts(ProcessDefinitionEntity.class);
for(ProcessDefinitionEntity proc_def: proc_defs){
System.out.println(proc_def.getId());
Map<String,TaskDefinition> tasks=proc_def.getTaskDefinitions();
Set<String> tasks_key=tasks.keySet();
for(String key:tasks_key){
TaskDefinition task=tasks.get(key);
System.out.println(task.getKey());
}
}
}
I wonder if Map<String,TaskDefinition> tasks=proc_def.getTaskDefinitions(); returns only UserTasks
… or maybe it returns all kind of tasks (HumanTask, scriptTask, receiveTask, …)?
In such case how can I distinguish between task types?
Also - how to convert TaskDefinition to UserTask?
Regards
Luke