예제 #1
0
        public static DecisionDefinition getDecisionDefinitionToCall(VariableScope execution, BaseCallableElement callableElement)
        {
            string decisionDefinitionKey = callableElement.getDefinitionKey(execution);
            string tenantId = callableElement.getDefinitionTenantId(execution);

            DeploymentCache deploymentCache = DeploymentCache;

            DecisionDefinition decisionDefinition = null;

            if (callableElement.LatestBinding)
            {
                decisionDefinition = deploymentCache.findDeployedLatestDecisionDefinitionByKeyAndTenantId(decisionDefinitionKey, tenantId);
            }
            else if (callableElement.DeploymentBinding)
            {
                string deploymentId = callableElement.DeploymentId;
                decisionDefinition = deploymentCache.findDeployedDecisionDefinitionByDeploymentAndKey(deploymentId, decisionDefinitionKey);
            }
            else if (callableElement.VersionBinding)
            {
                int?version = callableElement.getVersion(execution);
                decisionDefinition = deploymentCache.findDeployedDecisionDefinitionByKeyVersionAndTenantId(decisionDefinitionKey, version, tenantId);
            }
            else if (callableElement.VersionTagBinding)
            {
                string versionTag = callableElement.getVersionTag(execution);
                decisionDefinition = deploymentCache.findDeployedDecisionDefinitionByKeyVersionTagAndTenantId(decisionDefinitionKey, versionTag, tenantId);
            }

            return(decisionDefinition);
        }
예제 #2
0
        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);
        }
예제 #3
0
        public static CmmnCaseDefinition getCaseDefinitionToCall(VariableScope execution, BaseCallableElement callableElement)
        {
            string caseDefinitionKey = callableElement.getDefinitionKey(execution);
            string tenantId          = callableElement.getDefinitionTenantId(execution);

            DeploymentCache deploymentCache = DeploymentCache;

            CmmnCaseDefinition caseDefinition = null;

            if (callableElement.LatestBinding)
            {
                caseDefinition = deploymentCache.findDeployedLatestCaseDefinitionByKeyAndTenantId(caseDefinitionKey, tenantId);
            }
            else if (callableElement.DeploymentBinding)
            {
                string deploymentId = callableElement.DeploymentId;
                caseDefinition = deploymentCache.findDeployedCaseDefinitionByDeploymentAndKey(deploymentId, caseDefinitionKey);
            }
            else if (callableElement.VersionBinding)
            {
                int?version = callableElement.getVersion(execution);
                caseDefinition = deploymentCache.findDeployedCaseDefinitionByKeyVersionAndTenantId(caseDefinitionKey, version, tenantId);
            }

            return(caseDefinition);
        }
예제 #4
0
 protected internal virtual ProcessDefinitionEntity findByKey(DeploymentCache deploymentCache, string processDefinitionKey)
 {
     if (isTenantIdSet)
     {
         return(deploymentCache.findDeployedLatestProcessDefinitionByKeyAndTenantId(processDefinitionKey, processDefinitionTenantId));
     }
     else
     {
         return(deploymentCache.findDeployedLatestProcessDefinitionByKey(processDefinitionKey));
     }
 }
예제 #5
0
        protected internal override void checkAuthorization(CommandContext commandContext)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            DeploymentCache         deploymentCache   = processEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkReadProcessDefinition(processDefinition);
            }
        }
예제 #6
0
        protected internal virtual ProcessDefinitionEntity find(CommandContext commandContext)
        {
            DeploymentCache deploymentCache = commandContext.ProcessEngineConfiguration.DeploymentCache;

            if (!string.ReferenceEquals(processDefinitionId, null))
            {
                return(findById(deploymentCache, processDefinitionId));
            }
            else
            {
                return(findByKey(deploymentCache, processDefinitionKey));
            }
        }
예제 #7
0
        public virtual string execute(CommandContext commandContext)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = Context.ProcessEngineConfiguration;
            DeploymentCache         deploymentCache   = processEngineConfiguration.DeploymentCache;
            ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkReadProcessDefinition(processDefinition);
            }

            Expression formKeyExpression = null;

            if (string.ReferenceEquals(taskDefinitionKey, null))
            {
                // TODO: Maybe add getFormKey() to FormHandler interface to avoid the following cast
                FormHandler formHandler = processDefinition.StartFormHandler;

                if (formHandler is DelegateStartFormHandler)
                {
                    DelegateStartFormHandler delegateFormHandler = (DelegateStartFormHandler)formHandler;
                    formHandler = delegateFormHandler.FormHandler;
                }

                // Sorry!!! In case of a custom start form handler (which does not extend
                // the DefaultFormHandler) a formKey would never be returned. So a custom
                // form handler (for a startForm) has always to extend the DefaultStartFormHandler!
                if (formHandler is DefaultStartFormHandler)
                {
                    DefaultStartFormHandler startFormHandler = (DefaultStartFormHandler)formHandler;
                    formKeyExpression = startFormHandler.FormKey;
                }
            }
            else
            {
                TaskDefinition taskDefinition = processDefinition.TaskDefinitions[taskDefinitionKey];
                formKeyExpression = taskDefinition.FormKey;
            }

            string formKey = null;

            if (formKeyExpression != null)
            {
                formKey = formKeyExpression.ExpressionText;
            }
            return(formKey);
        }
예제 #8
0
        public virtual DmnModelInstance execute(CommandContext commandContext)
        {
            ensureNotNull("decisionDefinitionId", decisionDefinitionId);

            DeploymentCache deploymentCache = Context.ProcessEngineConfiguration.DeploymentCache;

            DecisionDefinitionEntity decisionDefinition = deploymentCache.findDeployedDecisionDefinitionById(decisionDefinitionId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkReadDecisionDefinition(decisionDefinition);
            }

            DmnModelInstance modelInstance = deploymentCache.findDmnModelInstanceForDecisionDefinition(decisionDefinitionId);

            ensureNotNull(typeof(DmnModelInstanceNotFoundException), "No DMN model instance found for decision definition id " + decisionDefinitionId, "modelInstance", modelInstance);
            return(modelInstance);
        }
예제 #9
0
        public virtual CmmnModelInstance execute(CommandContext commandContext)
        {
            ensureNotNull("caseDefinitionId", caseDefinitionId);

            ProcessEngineConfigurationImpl configuration = Context.ProcessEngineConfiguration;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache deploymentCache = configuration.getDeploymentCache();
            DeploymentCache deploymentCache = configuration.DeploymentCache;

            CaseDefinitionEntity caseDefinition = deploymentCache.findDeployedCaseDefinitionById(caseDefinitionId);

            foreach (CommandChecker checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
            {
                checker.checkReadCaseDefinition(caseDefinition);
            }

            CmmnModelInstance modelInstance = Context.ProcessEngineConfiguration.DeploymentCache.findCmmnModelInstanceForCaseDefinition(caseDefinitionId);

            ensureNotNull(typeof(CmmnModelInstanceNotFoundException), "No CMMN model instance found for case definition id " + caseDefinitionId, "modelInstance", modelInstance);
            return(modelInstance);
        }
예제 #10
0
 protected internal virtual ProcessDefinitionEntity findById(DeploymentCache deploymentCache, string processDefinitionId)
 {
     return(deploymentCache.findDeployedProcessDefinitionById(processDefinitionId));
 }