Esempio n. 1
0
        /// <summary>
        /// Gets the persisted version of the already-deployed process definition.  Note that this is
        /// different from <seealso cref="#getMostRecentVersionOfProcessDefinition"/> as it looks specifically for
        /// a process definition that is already persisted and attached to a particular deployment,
        /// rather than the latest version across all deployments.
        /// </summary>
        public virtual IProcessDefinitionEntity GetPersistedInstanceOfProcessDefinition(IProcessDefinitionEntity processDefinition)
        {
            string deploymentId = processDefinition.DeploymentId;

            if (string.IsNullOrWhiteSpace(processDefinition.DeploymentId))
            {
                throw new InvalidOperationException("Provided process definition must have a deployment id.");
            }

            IProcessDefinitionEntityManager processDefinitionManager = Context.CommandContext.ProcessEngineConfiguration.ProcessDefinitionEntityManager;
            IProcessDefinitionEntity        persistedProcessDefinition;

            if (processDefinition.TenantId is null || ProcessEngineConfiguration.NO_TENANT_ID.Equals(processDefinition.TenantId))
            {
                persistedProcessDefinition = processDefinitionManager.FindProcessDefinitionByDeploymentAndKey(deploymentId, processDefinition.Key);
            }