Ejemplo n.º 1
0
        //protected internal virtual void SetReferenceToCaseInstance(HistoricDecisionInstanceEntity @event,
        //    CaseExecutionEntity execution)
        //{
        //    @event.CaseDefinitionKey = GetCaseDefinitionKey(execution);
        //    @event.CaseDefinitionId = execution.CaseDefinitionId;

        //    @event.CaseInstanceId = execution.CaseInstanceId;
        //    @event.ExecutionId = execution.Id;

        //    @event.ActivityId = execution.ActivityId;
        //    @event.ActivityInstanceId = execution.Id;
        //}

        //protected internal virtual string GetCaseDefinitionKey(CaseExecutionEntity execution)
        //{
        //    //CaseDefinitionEntity definition = (CaseDefinitionEntity) execution.CaseDefinition;
        //    //if (definition != null)
        //    //{
        //    //  return definition.Key;
        //    //}
        //    //else
        //    //{
        //    return null;
        //    //}
        //}

        protected internal virtual string ProvideTenantId(IDecisionDefinition decisionDefinition,
                                                          HistoricDecisionInstanceEntity @event)
        {
            var    tenantIdProvider = Context.ProcessEngineConfiguration.TenantIdProvider;
            string tenantId         = null;

            if (tenantIdProvider != null)
            {
                TenantIdProviderHistoricDecisionInstanceContext ctx = null;

                if (!ReferenceEquals(@event.ExecutionId, null))
                {
                    //ctx = new TenantIdProviderHistoricDecisionInstanceContext(decisionDefinition, getExecution(@event));
                }
                else if (!ReferenceEquals(@event.CaseExecutionId, null))
                {
                    //ctx = new TenantIdProviderHistoricDecisionInstanceContext(decisionDefinition, getCaseExecution(@event));
                }
                else
                {
                    ctx = new TenantIdProviderHistoricDecisionInstanceContext(decisionDefinition);
                }

                tenantId = tenantIdProvider.ProvideTenantIdForHistoricDecisionInstance(ctx);
            }

            return(tenantId);
        }
Ejemplo n.º 2
0
        protected internal virtual void SetReferenceToProcessInstance(HistoricDecisionInstanceEntity @event,
                                                                      ExecutionEntity execution)
        {
            @event.ProcessDefinitionKey = GetProcessDefinitionKey(execution);
            @event.ProcessDefinitionId  = execution.ProcessDefinitionId;

            @event.ProcessInstanceId = execution.ProcessInstanceId;
            @event.ExecutionId       = execution.Id;

            @event.ActivityId         = execution.ActivityId;
            @event.ActivityInstanceId = execution.ActivityInstanceId;
        }
Ejemplo n.º 3
0
        protected internal virtual void InitDecisionInstanceEventForDecisionLiteralExpression(
            HistoricDecisionInstanceEntity @event, IDmnDecisionLiteralExpressionEvaluationEvent evaluationEvent)
        {
            // no inputs for expression
            //@event.Inputs = System.Linq.Enumerable.Empty<IHistoricDecisionInputInstance> ();

            var outputInstance = new HistoricDecisionOutputInstanceEntity();

            outputInstance.VariableName = evaluationEvent.OutputName;
            //outputInstance.setValue(evaluationEvent.OutputValue);

            //@event.Outputs = Collections.singletonList<HistoricDecisionOutputInstance> (outputInstance);
        }
Ejemplo n.º 4
0
        protected internal virtual void InitDecisionInstanceEventForDecisionTable(HistoricDecisionInstanceEntity @event,
                                                                                  IDmnDecisionTableEvaluationEvent evaluationEvent)
        {
            if (evaluationEvent.CollectResultValue != null)
            {
                //double? collectResultValue = getCollectResultValue(evaluationEvent.CollectResultValue);
                //@event.CollectResultValue = collectResultValue;
            }

            var historicDecisionInputInstances = CreateHistoricDecisionInputInstances(evaluationEvent);

            @event.Inputs = historicDecisionInputInstances;

            var historicDecisionOutputInstances = CreateHistoricDecisionOutputInstances(evaluationEvent);

            @event.Outputs = historicDecisionOutputInstances;
        }
Ejemplo n.º 5
0
        protected internal virtual void InitDecisionInstanceEvent(HistoricDecisionInstanceEntity @event,
                                                                  IDmnDecisionLogicEvaluationEvent evaluationEvent, HistoryEventTypes eventType)
        {
            throw new NotImplementedException();
            //@event.EventType = eventType.EventName;

            //var decision = (IDecisionDefinition) evaluationEvent.Decision;
            //@event.DecisionDefinitionId = decision.Id;
            //@event.DecisionDefinitionKey = decision.Key;
            //@event.DecisionDefinitionName = decision.Name;

            //if (!ReferenceEquals(decision.DecisionRequirementsDefinitionId, null))
            //{
            //    @event.DecisionRequirementsDefinitionId = decision.DecisionRequirementsDefinitionId;
            //    @event.DecisionRequirementsDefinitionKey = decision.DecisionRequirementsDefinitionKey;
            //}

            //if (evaluationEvent is DmnDecisionTableEvaluationEvent)
            //    InitDecisionInstanceEventForDecisionTable(@event, (DmnDecisionTableEvaluationEvent) evaluationEvent);
            //else if (evaluationEvent is DmnDecisionLiteralExpressionEvaluationEvent)
            //    InitDecisionInstanceEventForDecisionLiteralExpression(@event,
            //        (DmnDecisionLiteralExpressionEvaluationEvent) evaluationEvent);
        }
Ejemplo n.º 6
0
        //protected internal virtual HistoricDecisionInstanceEntity CreateDecisionEvaluatedEvt(
        //    DmnDecisionLogicEvaluationEvent evaluationEvent, CaseExecutionEntity execution)
        //{
        //    // create event instance
        //    var @event = NewDecisionInstanceEventEntity(execution, evaluationEvent);
        //    // initialize event
        //    InitDecisionInstanceEvent(@event, evaluationEvent, HistoryEventTypes.DmnDecisionEvaluate);
        //    SetReferenceToCaseInstance(@event, execution);
        //    // set current time as evaluation time
        //    @event.EvaluationTime = ClockUtil.CurrentTime;

        //    var decisionDefinition = (IDecisionDefinition) evaluationEvent.Decision;
        //    var tenantId = execution.TenantId;
        //    if (ReferenceEquals(tenantId, null))
        //        tenantId = ProvideTenantId(decisionDefinition, @event);
        //    @event.TenantId = tenantId;
        //    return @event;
        //}

        protected internal virtual HistoricDecisionInstanceEntity CreateDecisionEvaluatedEvt(
            IDmnDecisionLogicEvaluationEvent evaluationEvent)
        {
            // create event instance
            var @event = NewDecisionInstanceEventEntity(evaluationEvent);

            // initialize event
            InitDecisionInstanceEvent(@event, evaluationEvent, HistoryEventTypes.DmnDecisionEvaluate);
            // set current time as evaluation time
            @event.EvaluationTime = ClockUtil.CurrentTime;
            // set the user id if there is an authenticated user and no process instance
            UserId = @event;

            var decisionDefinition = (IDecisionDefinition)evaluationEvent.Decision;
            var tenantId           = decisionDefinition.TenantId;

            if (ReferenceEquals(tenantId, null))
            {
                tenantId = ProvideTenantId(decisionDefinition, @event);
            }
            @event.TenantId = tenantId;
            return(@event);
        }