Exemplo n.º 1
0
        protected internal virtual void initializeCallableElement(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context)
        {
            Deployment deployment   = context.Deployment;
            string     deploymentId = null;

            if (deployment != null)
            {
                deploymentId = deployment.Id;
            }

            BaseCallableElement callableElement = createCallableElement();

            callableElement.DeploymentId = deploymentId;

            // set callableElement on behavior
            CallingTaskActivityBehavior behavior = (CallingTaskActivityBehavior)activity.ActivityBehavior;

            behavior.CallableElement = callableElement;

            // definition key
            initializeDefinitionKey(element, activity, context, callableElement);

            // binding
            initializeBinding(element, activity, context, callableElement);

            // version
            initializeVersion(element, activity, context, callableElement);

            // tenant-id
            initializeTenantId(element, activity, context, callableElement);
        }
Exemplo n.º 2
0
 public DmnBusinessRuleTaskActivityBehavior(BaseCallableElement callableElement, string resultVariableName, DecisionResultMapper decisionResultMapper)
 {
     this.callableElement      = callableElement;
     this.resultVariable       = resultVariableName;
     this.decisionResultMapper = decisionResultMapper;
 }
Exemplo n.º 3
0
        protected internal virtual void initializeBinding(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement)
        {
            string binding = getBinding(element, activity, context);

            if (BaseCallableElement.CallableElementBinding.DEPLOYMENT.Value.Equals(binding))
            {
                callableElement.Binding = BaseCallableElement.CallableElementBinding.DEPLOYMENT;
            }
            else if (BaseCallableElement.CallableElementBinding.LATEST.Value.Equals(binding))
            {
                callableElement.Binding = BaseCallableElement.CallableElementBinding.LATEST;
            }
            else if (BaseCallableElement.CallableElementBinding.VERSION.Value.Equals(binding))
            {
                callableElement.Binding = BaseCallableElement.CallableElementBinding.VERSION;
            }
        }
Exemplo n.º 4
0
        protected internal virtual void initializeDefinitionKey(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement)
        {
            ExpressionManager      expressionManager     = context.ExpressionManager;
            string                 definitionKey         = getDefinitionKey(element, activity, context);
            ParameterValueProvider definitionKeyProvider = createParameterValueProvider(definitionKey, expressionManager);

            callableElement.DefinitionKeyValueProvider = definitionKeyProvider;
        }
Exemplo n.º 5
0
        protected internal virtual void initializeTenantId(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement)
        {
            ParameterValueProvider tenantIdProvider;

            ExpressionManager expressionManager = context.ExpressionManager;
            string            tenantId          = getTenantId(element, activity, context);

            if (!string.ReferenceEquals(tenantId, null) && tenantId.Length > 0)
            {
                tenantIdProvider = createParameterValueProvider(tenantId, expressionManager);
            }
            else
            {
                tenantIdProvider = new DefaultCallableElementTenantIdProvider();
            }

            callableElement.TenantIdProvider = tenantIdProvider;
        }
Exemplo n.º 6
0
        protected internal virtual void initializeVersion(CmmnElement element, CmmnActivity activity, CmmnHandlerContext context, BaseCallableElement callableElement)
        {
            ExpressionManager      expressionManager = context.ExpressionManager;
            string                 version           = getVersion(element, activity, context);
            ParameterValueProvider versionProvider   = createParameterValueProvider(version, expressionManager);

            callableElement.VersionValueProvider = versionProvider;
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }