Esempio n. 1
0
        protected internal virtual void UpdateVariableInstance(IVariableInstanceEntity variableInstance, object value, IExecutionEntity sourceActivityExecution)
        {
            // Always check if the type should be altered. It's possible that the
            // previous type is lower in the type
            // checking chain (e.g. serializable) and will return true on
            // isAbleToStore(), even though another type
            // higher in the chain is eligible for storage.

            IVariableTypes variableTypes = Context.ProcessEngineConfiguration.VariableTypes;

            IVariableType newType = variableTypes.FindVariableType(value);

            if (newType != null && !newType.Equals(variableInstance.Type))
            {
                variableInstance.Value = null;
                variableInstance.Type  = newType;
                variableInstance.ForceUpdate();
                variableInstance.Value = value;
            }
            else
            {
                variableInstance.Value = value;
            }

            Context.CommandContext.HistoryManager.RecordHistoricDetailVariableCreate(variableInstance, sourceActivityExecution, ActivityIdUsedForDetails);

            Context.CommandContext.HistoryManager.RecordVariableUpdate(variableInstance);
        }
Esempio n. 2
0
 protected internal virtual void EnsureVariablesInitialized()
 {
     if (this.queryVariableValue != null)
     {
         IVariableTypes variableTypes = Context.ProcessEngineConfiguration.VariableTypes;
         queryVariableValue.Initialize(variableTypes);
     }
 }
 protected internal virtual void EnsureVariablesInitialized()
 {
     if (queryVariableValues.Count > 0)
     {
         IVariableTypes variableTypes = Context.ProcessEngineConfiguration.VariableTypes;
         foreach (QueryVariableValue queryVariableValue in queryVariableValues)
         {
             queryVariableValue.Initialize(variableTypes);
         }
     }
 }
Esempio n. 4
0
        protected internal virtual IVariableInstanceEntity CreateVariableInstance(string variableName, object value, IExecutionEntity sourceActivityExecution)
        {
            IVariableTypes variableTypes = Context.ProcessEngineConfiguration.VariableTypes;

            IVariableType type = variableTypes.FindVariableType(value);

            IVariableInstanceEntity variableInstance = Context.CommandContext.VariableInstanceEntityManager.Create(variableName, type, value);

            InitializeVariableInstanceBackPointer(variableInstance);
            Context.CommandContext.VariableInstanceEntityManager.Insert(variableInstance);

            if (variableInstances != null)
            {
                variableInstances[variableName] = variableInstance;
            }

            // Record historic variable
            Context.CommandContext.HistoryManager.RecordVariableCreate(variableInstance);

            // Record historic detail
            Context.CommandContext.HistoryManager.RecordHistoricDetailVariableCreate(variableInstance, sourceActivityExecution, ActivityIdUsedForDetails);

            return(variableInstance);
        }
Esempio n. 5
0
 public virtual void Initialize(IVariableTypes types)
 {
     if (variableInstanceEntity == null)
     {
         IVariableType type = types.FindVariableType(value);
         if (type is ByteArrayType)
         {
             throw new ActivitiIllegalArgumentException("Variables of type ByteArray cannot be used to query");
         }
         else if (type is IEntityVariableType && @operator != QueryOperator.EQUALS)
         {
             throw new ActivitiIllegalArgumentException("JPA entity variables can only be used in 'variableValueEquals'");
         }
         else if (type is IEntityListVariableType)
         {
             throw new ActivitiIllegalArgumentException("Variables containing a list of JPA entities cannot be used to query");
         }
         else
         {
             // Type implementation determines which fields are set on the entity
             variableInstanceEntity = Context.CommandContext.VariableInstanceEntityManager.Create(name, type, value);
         }
     }
 }