예제 #1
0
        /// <summary>
        /// Construct representation of locked ExternalTask from corresponding entity.
        /// During mapping variables will be collected,during collection variables will not be deserialized
        /// and scope will not be set to local.
        /// </summary>
        /// <seealso cref= <seealso cref="org.camunda.bpm.engine.impl.core.variable.scope.AbstractVariableScope.collectVariables(VariableMapImpl, System.Collections.ICollection, bool, bool)"/>
        /// </seealso>
        /// <param name="externalTaskEntity"> - source persistent entity to use for fields </param>
        /// <param name="variablesToFetch"> - list of variable names to fetch, if null then all variables will be fetched </param>
        /// <param name="isLocal"> - if true only local variables will be collected
        /// </param>
        /// <returns> object with all fields copied from the ExternalTaskEntity, error details fetched from the
        /// database and variables attached </returns>
        public static LockedExternalTaskImpl fromEntity(ExternalTaskEntity externalTaskEntity, IList <string> variablesToFetch, bool isLocal, bool deserializeVariables)
        {
            LockedExternalTaskImpl result = new LockedExternalTaskImpl();

            result.id                 = externalTaskEntity.Id;
            result.topicName          = externalTaskEntity.TopicName;
            result.workerId           = externalTaskEntity.WorkerId;
            result.lockExpirationTime = externalTaskEntity.LockExpirationTime;
            result.retries            = externalTaskEntity.Retries;
            result.errorMessage       = externalTaskEntity.ErrorMessage;
            result.errorDetails       = externalTaskEntity.ErrorDetails;

            result.processInstanceId    = externalTaskEntity.ProcessInstanceId;
            result.executionId          = externalTaskEntity.ExecutionId;
            result.activityId           = externalTaskEntity.ActivityId;
            result.activityInstanceId   = externalTaskEntity.ActivityInstanceId;
            result.processDefinitionId  = externalTaskEntity.ProcessDefinitionId;
            result.processDefinitionKey = externalTaskEntity.ProcessDefinitionKey;
            result.tenantId             = externalTaskEntity.TenantId;
            result.priority             = externalTaskEntity.Priority;
            result.businessKey          = externalTaskEntity.BusinessKey;

            ExecutionEntity execution = externalTaskEntity.Execution;

            result.variables = new VariableMapImpl();
            execution.collectVariables(result.variables, variablesToFetch, isLocal, deserializeVariables);

            return(result);
        }
예제 #2
0
        public virtual VariableMap execute(CommandContext commandContext)
        {
            ensureNotNull("executionId", executionId);

            ExecutionEntity execution = commandContext.ExecutionManager.findExecutionById(executionId);

            ensureNotNull("execution " + executionId + " doesn't exist", "execution", execution);

            checkGetExecutionVariables(execution, commandContext);

            VariableMapImpl executionVariables = new VariableMapImpl();

            // collect variables from execution
            execution.collectVariables(executionVariables, variableNames, isLocal, deserializeValues);

            return(executionVariables);
        }