protected internal virtual HistoryEvent CreateHistoricJobLogEvt(IJob job, HistoryEventTypes eventType)
        {
            HistoricJobLogEventEntity @event = NewHistoricJobLogEntity(job);

            InitHistoricJobLogEvent(@event, job, eventType);
            return(@event);
        }
Exemplo n.º 2
0
        // helper /////////////////////////////////////////////////////////

        protected internal virtual bool IsHistoryEventProduced(HistoryEventTypes eventType, IJob job)
        {
            var configuration = context.Impl.Context.ProcessEngineConfiguration;
            var historyLevel  = configuration.HistoryLevel;

            return(historyLevel.IsHistoryEventProduced(eventType, job));
        }
        // helper /////////////////////////////////////////////////////////

        protected internal virtual bool IsHistoryEventProduced(HistoryEventTypes eventType, IExternalTask externalTask)
        {
            ProcessEngineConfigurationImpl configuration = context.Impl.Context.ProcessEngineConfiguration;
            IHistoryLevel historyLevel = configuration.HistoryLevel;

            return(historyLevel.IsHistoryEventProduced(eventType, externalTask));
        }
        protected internal virtual HistoryEvent CreateBatchEvent(BatchEntity batch, HistoryEventTypes eventType)
        {
            HistoricBatchEntity @event = new HistoricBatchEntity();

            @event.Id                     = batch.Id;
            @event.Type                   = batch.Type;
            @event.TotalJobs              = batch.TotalJobs;
            @event.BatchJobsPerSeed       = batch.BatchJobsPerSeed;
            @event.InvocationsPerBatchJob = batch.InvocationsPerBatchJob;
            @event.SeedJobDefinitionId    = batch.SeedJobDefinitionId;
            @event.MonitorJobDefinitionId = batch.MonitorJobDefinitionId;
            @event.BatchJobDefinitionId   = batch.BatchJobDefinitionId;
            @event.TenantId               = batch.TenantId;
            @event.EventType              = eventType.EventName;

            if (HistoryEventTypes.BatchStart.Equals(eventType))
            {
                @event.StartTime = ClockUtil.CurrentTime;
            }

            if (HistoryEventTypes.BatchEnd.Equals(eventType))
            {
                @event.EndTime = ClockUtil.CurrentTime;
            }

            return(@event);
        }
Exemplo n.º 5
0
 public virtual bool IsHistoryEventProduced(HistoryEventTypes eventType, object entity)
 {
     if (recordedHistoryEventTypes.Count == 0 || recordedHistoryEventTypes.Contains(eventType))
     {
         producedHistoryEvents.Add(new ProducedHistoryEvent(eventType, entity));
     }
     return(true);
 }
Exemplo n.º 6
0
 public override bool IsHistoryEventProduced(HistoryEventTypes eventType, object entity)
 {
     return(base.IsHistoryEventProduced(eventType, entity) ||
            (HistoryEventTypes.VariableInstanceCreate == eventType) ||
            (HistoryEventTypes.VariableInstanceUpdate == eventType) ||
            (HistoryEventTypes.VariableInstanceMigrate == eventType) ||
            (HistoryEventTypes.VariableInstanceDelete == eventType) ||
            (HistoryEventTypes.FormPropertyUpdate == eventType));
 }
Exemplo n.º 7
0
        protected internal virtual void FireHistoricIncidentEvent(HistoryEventTypes eventType)
        {
            ProcessEngineConfigurationImpl processEngineConfiguration = context.Impl.Context.ProcessEngineConfiguration;

            IHistoryLevel historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(eventType, this))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this, eventType));
            }
        }
Exemplo n.º 8
0
        public virtual void FireHistoricIdentityLinkEvent(HistoryEventTypes eventType)
        {
            var processEngineConfiguration = Context.ProcessEngineConfiguration;

            var historyLevel = processEngineConfiguration.HistoryLevel;

            if (historyLevel.IsHistoryEventProduced(eventType, this))
            {
                HistoryEventProcessor.ProcessHistoryEvents(new HistoryEventCreatorAnonymousInnerClassHelper(this,
                                                                                                            eventType));
            }
        }
Exemplo n.º 9
0
        protected internal virtual void Remove(bool resolved)
        {
            ExecutionEntity execution = Execution;

            if (execution != null)
            {
                // Extract possible super execution of the assigned execution
                ExecutionEntity superExecution = null;
                if (execution.Id == execution.ProcessInstanceId)
                {
                    superExecution = (ExecutionEntity)execution.SuperExecution;
                }
                else
                {
                    //superExecution = execution.getProcessInstance().getSuperExecution();
                    superExecution = (ExecutionEntity)execution.ProcessInstance.SuperExecution;
                }

                if (superExecution != null)
                {
                    // get the incident, where this incident is the cause
                    IncidentEntity parentIncident = superExecution.GetIncidentByCauseIncidentId(Id);

                    if (parentIncident != null)
                    {
                        // remove the incident
                        parentIncident.Remove(resolved);
                    }
                }

                // remove link to execution
                execution.RemoveIncident(this);
            }

            // always delete the incident
            context.Impl.Context.CommandContext.IncidentManager.Delete(this);//.DbEntityManager.Delete(this);

            // update historic incident
            HistoryEventTypes eventType = resolved ? HistoryEventTypes.IncidentResolve : HistoryEventTypes.IncidentDelete;

            FireHistoricIncidentEvent(eventType);
        }
Exemplo n.º 10
0
 public override bool IsHistoryEventProduced(HistoryEventTypes eventType, object entity)
 {
     return((HistoryEventTypes.ProcessInstanceStart == eventType) ||
            (HistoryEventTypes.ProcessInstanceUpdate == eventType) ||
            (HistoryEventTypes.ProcessInstanceMigrate == eventType) ||
            (HistoryEventTypes.ProcessInstanceEnd == eventType) ||
            (HistoryEventTypes.TaskInstanceCreate == eventType) ||
            (HistoryEventTypes.TaskInstanceUpdate == eventType) ||
            (HistoryEventTypes.TaskInstanceMigrate == eventType) ||
            (HistoryEventTypes.TaskInstanceComplete == eventType) ||
            (HistoryEventTypes.TaskInstanceDelete == eventType) ||
            (HistoryEventTypes.ActivityInstanceStart == eventType) ||
            (HistoryEventTypes.ActivityInstanceUpdate == eventType) ||
            (HistoryEventTypes.ActivityInstanceMigrate == eventType) ||
            (HistoryEventTypes.ActivityInstanceEnd == eventType) ||
            (HistoryEventTypes.CaseInstanceCreate == eventType) ||
            (HistoryEventTypes.CaseInstanceUpdate == eventType) ||
            (HistoryEventTypes.CaseInstanceClose == eventType) ||
            (HistoryEventTypes.CaseActivityInstanceCreate == eventType) ||
            (HistoryEventTypes.CaseActivityInstanceUpdate == eventType) ||
            (HistoryEventTypes.CaseActivityInstanceEnd == eventType));
 }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        protected internal virtual HistoryEvent CreateHistoricIdentityLinkEvt(IIdentityLink identityLink, HistoryEventTypes eventType)
        {
            // create historic identity link event
            HistoricIdentityLinkLogEventEntity evt = NewIdentityLinkEventEntity();

            // Mapping all the values of identity link to HistoricIdentityLinkEvent
            InitHistoricIdentityLinkEvent(evt, identityLink, eventType);
            return(evt);
        }
Exemplo n.º 13
0
        // helper /////////////////////////////////////////////////////////////////

        protected internal virtual IList <HistoryLevel> setCustomHistoryLevel(HistoryEventTypes eventType)
        {
            ((CustomHistoryLevelRemovalTime)customHistoryLevel).EventTypes = eventType;

            return(Collections.singletonList(customHistoryLevel));
        }
Exemplo n.º 14
0
 public HistoryEventArgs(HistoryEventTypes type) : base()
 {
     this.type = type;
 }
Exemplo n.º 15
0
 public HistoryEventArgs(HistoryEventTypes type)
     : base()
 {
     this.type = type;
 }
Exemplo n.º 16
0
 public HistoryEventCreatorAnonymousInnerClassHelper(IncidentEntity outerInstance, HistoryEventTypes eventType)
 {
     this._outerInstance = outerInstance;
     this._eventType     = eventType;
 }
Exemplo n.º 17
0
 public override bool IsHistoryEventProduced(HistoryEventTypes eventType, object entity)
 {
     return(false);
 }
 public VATRPCallEventArgs(HistoryEventTypes nType)
 {
     historyEventType = nType;
 }
Exemplo n.º 19
0
 public abstract bool IsHistoryEventProduced(HistoryEventTypes eventType, object entity);
Exemplo n.º 20
0
        protected internal virtual void InitHistoricJobLogEvent(HistoricJobLogEventEntity evt, IJob job, HistoryEventTypes eventType)
        {
            evt.TimeStamp = ClockUtil.CurrentTime;

            JobEntity jobEntity = (JobEntity)job;

            evt.JobId       = jobEntity.Id;
            evt.JobDueDate  = jobEntity.Duedate;
            evt.JobRetries  = jobEntity.Retries;
            evt.JobPriority = jobEntity.Priority;

            IJobDefinition jobDefinition = jobEntity.JobDefinition;

            if (jobDefinition != null)
            {
                evt.JobDefinitionId            = jobDefinition.Id;
                evt.JobDefinitionType          = jobDefinition.JobType;
                evt.JobDefinitionConfiguration = jobDefinition.JobConfiguration;
            }
            else
            {
                // in case of async signal there does not exist a job definition
                // but we use the jobHandlerType as jobDefinitionType
                evt.JobDefinitionType = jobEntity.JobHandlerType;
            }

            evt.ActivityId           = jobEntity.ActivityId;
            evt.ExecutionId          = jobEntity.ExecutionId;
            evt.ProcessInstanceId    = jobEntity.ProcessInstanceId;
            evt.ProcessDefinitionId  = jobEntity.ProcessDefinitionId;
            evt.ProcessDefinitionKey = jobEntity.ProcessDefinitionKey;
            evt.DeploymentId         = jobEntity.DeploymentId;
            evt.TenantId             = jobEntity.TenantId;

            // initialize sequence counter
            InitSequenceCounter(jobEntity, evt);

            IJobState state = null;

            if (HistoryEventTypes.JobCreate.Equals(eventType))
            {
                state = JobStateFields.Created;
            }
            else if (HistoryEventTypes.JobFail.Equals(eventType))
            {
                state = JobStateFields.Failed;
            }
            else if (HistoryEventTypes.JobSuccess.Equals(eventType))
            {
                state = JobStateFields.Successful;
            }
            else if (HistoryEventTypes.JobDelete.Equals(eventType))
            {
                state = JobStateFields.Deleted;
            }
            evt.State = state.StateCode;
        }
Exemplo n.º 21
0
        protected internal virtual void initDecisionInstanceEvent(HistoricDecisionInstanceEntity @event, DmnDecisionLogicEvaluationEvent evaluationEvent, HistoryEventTypes eventType, HistoricDecisionInstanceEntity rootDecisionInstance)
        {
            @event.EventType = eventType.EventName;

            DecisionDefinition decision = (DecisionDefinition)evaluationEvent.Decision;

            @event.DecisionDefinitionId   = decision.Id;
            @event.DecisionDefinitionKey  = decision.Key;
            @event.DecisionDefinitionName = decision.Name;

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

            // set current time as evaluation time
            @event.EvaluationTime = ClockUtil.CurrentTime;

            if (string.ReferenceEquals(@event.RootProcessInstanceId, null) && string.ReferenceEquals(@event.CaseInstanceId, null))
            {
                if (rootDecisionInstance != null)
                {
                    @event.RemovalTime = rootDecisionInstance.RemovalTime;
                }
                else
                {
                    DateTime removalTime = calculateRemovalTime(@event, decision);
                    @event.RemovalTime = removalTime;
                }
            }

            if (evaluationEvent is DmnDecisionTableEvaluationEvent)
            {
                initDecisionInstanceEventForDecisionTable(@event, (DmnDecisionTableEvaluationEvent)evaluationEvent);
            }
            else if (evaluationEvent is DmnDecisionLiteralExpressionEvaluationEvent)
            {
                initDecisionInstanceEventForDecisionLiteralExpression(@event, (DmnDecisionLiteralExpressionEvaluationEvent)evaluationEvent);
            }
            else
            {
                @event.Inputs  = System.Linq.Enumerable.Empty <HistoricDecisionInputInstance> ();
                @event.Outputs = System.Linq.Enumerable.Empty <HistoricDecisionOutputInstance> ();
            }
        }
Exemplo n.º 22
0
 public HistoryEventCreatorAnonymousInnerClassHelper(IdentityLinkEntity outerInstance,
                                                     HistoryEventTypes eventType)
 {
     _outerInstance = outerInstance;
     _eventType     = eventType;
 }
Exemplo n.º 23
0
 public ProducedHistoryEvent(HistoryEventTypes eventType, object entity)
 {
     EventType = eventType;
     Entity    = entity;
 }
Exemplo n.º 24
0
        protected internal virtual HistoryEvent CreateHistoricIncidentEvt(IIncident incident, HistoryEventTypes eventType)
        {
            // create event
            Event.HistoricIncidentEntity evt = LoadIncidentEvent(incident);
            // initialize
            InitHistoricIncidentEvent(evt, incident, eventType);

            if (HistoryEventTypes.IncidentCreate != eventType)
            {
                evt.EndTime = ClockUtil.CurrentTime;
            }

            return(evt);
        }
Exemplo n.º 25
0
        protected internal virtual HistoryEvent CreateHistoricVariableEvent(VariableInstanceEntity variableInstance, IVariableScope sourceVariableScope, HistoryEventTypes eventType)
        {
            string scopeActivityInstanceId  = null;
            string sourceActivityInstanceId = null;

            if (variableInstance.ExecutionId != null)
            {
                //ExecutionEntity scopeExecution = Context.CommandContext.DbEntityManager.SelectById(typeof(ExecutionEntity), variableInstance.ExecutionId);
                ExecutionEntity scopeExecution = Context.CommandContext.ExecutionManager.FindExecutionById(variableInstance.ExecutionId);
                if (variableInstance.TaskId == null && !variableInstance.IsConcurrentLocal)
                {
                    scopeActivityInstanceId = scopeExecution.ParentActivityInstanceId;
                }
                else
                {
                    scopeActivityInstanceId = scopeExecution.ActivityInstanceId;
                }
            }
            else if (!string.ReferenceEquals(variableInstance.CaseExecutionId, null))
            {
                scopeActivityInstanceId = variableInstance.CaseExecutionId;
            }

            ExecutionEntity sourceExecution = null;

            //CaseExecutionEntity sourceCaseExecution = null;
            if (sourceVariableScope is ExecutionEntity)
            {
                sourceExecution          = (ExecutionEntity)sourceVariableScope;
                sourceActivityInstanceId = sourceExecution.ActivityInstanceId;
            }
            else if (sourceVariableScope is TaskEntity)
            {
                sourceExecution = ((TaskEntity)sourceVariableScope).GetExecution();
                if (sourceExecution != null)
                {
                    sourceActivityInstanceId = sourceExecution.ActivityInstanceId;
                }
                else
                {
                    //sourceCaseExecution = ((TaskEntity)sourceVariableScope).GetCaseExecution();
                    //if (sourceCaseExecution != null)
                    //{
                    //    sourceActivityInstanceId = sourceCaseExecution.Id;
                    //}
                }
            }
            //else if (sourceVariableScope is CaseExecutionEntity)
            //{
            //    sourceCaseExecution = (CaseExecutionEntity)sourceVariableScope;
            //    sourceActivityInstanceId = sourceCaseExecution.Id;
            //}

            // create event
            HistoricVariableUpdateEventEntity evt = NewVariableUpdateEventEntity(sourceExecution);

            // initialize
            InitHistoricVariableUpdateEvt(evt, variableInstance, eventType);
            // initialize sequence counter
            InitSequenceCounter(variableInstance, evt);

            // set scope activity instance id
            evt.ScopeActivityInstanceId = scopeActivityInstanceId;

            // set source activity instance id
            evt.ActivityInstanceId = sourceActivityInstanceId;

            return(evt);
        }
Exemplo n.º 26
0
 public VATRPCallEventArgs(HistoryEventTypes nType)
 {
     historyEventType = nType;
 }
Exemplo n.º 27
0
        protected internal virtual void InitHistoricIdentityLinkEvent(HistoricIdentityLinkLogEventEntity evt, IIdentityLink identityLink, HistoryEventTypes eventType)
        {
            if (!string.ReferenceEquals(identityLink.TaskId, null))
            {
                TaskEntity task = Context.CommandContext.TaskManager.FindTaskById(identityLink.TaskId);

                evt.ProcessDefinitionId = task.ProcessDefinitionId;

                if (task.ProcessDefinition != null)
                {
                    evt.ProcessDefinitionKey = task.ProcessDefinition.Key;
                }
            }

            if (!string.ReferenceEquals(identityLink.ProcessDefId, null))
            {
                evt.ProcessDefinitionId = identityLink.ProcessDefId;

                ProcessDefinitionEntity definition = Context.ProcessEngineConfiguration.DeploymentCache.FindProcessDefinitionFromCache(identityLink.ProcessDefId);
                evt.ProcessDefinitionKey = definition.Key;
            }

            evt.Time     = ClockUtil.CurrentTime;
            evt.Type     = identityLink.Type;
            evt.UserId   = identityLink.UserId;
            evt.GroupId  = identityLink.GroupId;
            evt.TaskId   = identityLink.TaskId;
            evt.TenantId = identityLink.TenantId;
            // There is a conflict in HistoryEventTypes for 'delete' keyword,
            // So HistoryEventTypes.IDENTITY_LINK_ADD /
            // HistoryEventTypes.IDENTITY_LINK_DELETE is provided with the event name
            // 'add-identity-link' /'delete-identity-link'
            // and changed to 'add'/'delete' (While inserting it into the database) on
            // Historic identity link add / delete event
            string operationType = "add";

            if (eventType.EventName.Equals(HistoryEventTypes.IdentityLinkDelete.EventName))
            {
                operationType = "delete";
            }

            evt.OperationType = operationType;
            evt.EventType     = eventType.EventName;
            evt.AssignerId    = Context.CommandContext.AuthenticatedUserId;
        }
Exemplo n.º 28
0
 public virtual bool IsHistoryEventProduced(HistoryEventTypes eventType, object entity)
 {
     return(true);
 }
Exemplo n.º 29
0
 protected internal virtual void initDecisionInstanceEvent(HistoricDecisionInstanceEntity @event, DmnDecisionLogicEvaluationEvent evaluationEvent, HistoryEventTypes eventType)
 {
     initDecisionInstanceEvent(@event, evaluationEvent, eventType, null);
 }