예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="variable"></param>
        /// <param name="sourceActivityExecution"></param>
        /// <param name="useActivityId"></param>
        public virtual void RecordHistoricDetailVariableCreate(IVariableInstanceEntity variable, IExecutionEntity sourceActivityExecution, bool useActivityId)
        {
            if (IsHistoryLevelAtLeast(HistoryLevel.FULL))
            {
                IHistoricDetailVariableInstanceUpdateEntity historicVariableUpdate = HistoricDetailEntityManager.CopyAndInsertHistoricDetailVariableInstanceUpdateEntity(variable);

                if (useActivityId && sourceActivityExecution != null)
                {
                    IHistoricActivityInstanceEntity historicActivityInstance = FindActivityInstance(sourceActivityExecution, false, false);
                    if (historicActivityInstance != null)
                    {
                        historicVariableUpdate.ActivityInstanceId = historicActivityInstance.Id;
                    }
                }
            }
        }
        public virtual IHistoricDetailVariableInstanceUpdateEntity CopyAndInsertHistoricDetailVariableInstanceUpdateEntity(IVariableInstanceEntity variableInstance)
        {
            IHistoricDetailVariableInstanceUpdateEntity historicVariableUpdate = historicDetailDataManager.CreateHistoricDetailVariableInstanceUpdate();

            historicVariableUpdate.ProcessInstanceId = variableInstance.ProcessInstanceId;
            historicVariableUpdate.ExecutionId       = variableInstance.ExecutionId;
            historicVariableUpdate.TaskId            = variableInstance.TaskId;
            historicVariableUpdate.Time         = Clock.CurrentTime;
            historicVariableUpdate.Revision     = variableInstance.Revision;
            historicVariableUpdate.Name         = variableInstance.Name;
            historicVariableUpdate.VariableType = variableInstance.Type;
            historicVariableUpdate.TextValue    = variableInstance.TextValue;
            historicVariableUpdate.TextValue2   = variableInstance.TextValue2;
            historicVariableUpdate.DoubleValue  = variableInstance.DoubleValue;
            historicVariableUpdate.LongValue    = variableInstance.LongValue;

            if (variableInstance.Bytes != null)
            {
                historicVariableUpdate.Bytes = variableInstance.Bytes;
            }

            Insert(historicVariableUpdate);
            return(historicVariableUpdate);
        }