List<ProcessDefinitionEntity> processDefinitionEntities = new ArrayList<ProcessDefinitionEntity>();
ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();
if(processDefinitionId != null) {
ProcessDefinitionEntity processDefinitionEntity = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);
if(processDefinitionEntity == null) {
throw new ActivitiException("Cannot find process definition for id '"+processDefinitionId+"'");
}
processDefinitionEntities.add(processDefinitionEntity);