public static ProcessDefinitionImpl getProcessDefinitionToCall(VariableScope execution, BaseCallableElement callableElement) { string processDefinitionKey = callableElement.getDefinitionKey(execution); string tenantId = callableElement.getDefinitionTenantId(execution); DeploymentCache deploymentCache = DeploymentCache; ProcessDefinitionImpl processDefinition = null; if (callableElement.LatestBinding) { processDefinition = deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, tenantId); } else if (callableElement.DeploymentBinding) { string deploymentId = callableElement.DeploymentId; processDefinition = deploymentCache.findDeployedProcessDefinitionByDeploymentAndKey(deploymentId, processDefinitionKey); } else if (callableElement.VersionBinding) { int?version = callableElement.getVersion(execution); processDefinition = deploymentCache.findDeployedProcessDefinitionByKeyVersionAndTenantId(processDefinitionKey, version, tenantId); } else if (callableElement.VersionTagBinding) { string versionTag = callableElement.getVersionTag(execution); processDefinition = deploymentCache.findDeployedProcessDefinitionByKeyVersionTagAndTenantId(processDefinitionKey, versionTag, tenantId); } return(processDefinition); }
protected internal virtual ProcessDefinitionEntity findByKey(DeploymentCache deploymentCache, string processDefinitionKey) { if (isTenantIdSet) { return(deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, processDefinitionTenantId)); } else { return(deploymentCache.findDeployedLatestProcessDefinitionByKey(processDefinitionKey)); } }