コード例 #1
0
        public virtual IList <LockedExternalTask> execute(CommandContext commandContext)
        {
            validateInput();

            foreach (TopicFetchInstruction instruction in fetchInstructions.Values)
            {
                instruction.ensureVariablesInitialized();
            }

            IList <ExternalTaskEntity> externalTasks = commandContext.ExternalTaskManager.selectExternalTasksForTopics(fetchInstructions.Values, maxResults, usePriority);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final List<org.camunda.bpm.engine.externaltask.LockedExternalTask> result = new ArrayList<org.camunda.bpm.engine.externaltask.LockedExternalTask>();
            IList <LockedExternalTask> result = new List <LockedExternalTask>();

            foreach (ExternalTaskEntity entity in externalTasks)
            {
                TopicFetchInstruction fetchInstruction = fetchInstructions[entity.TopicName];
                entity.@lock(workerId, fetchInstruction.LockDuration.Value);

                LockedExternalTaskImpl resultTask = LockedExternalTaskImpl.fromEntity(entity, fetchInstruction.VariablesToFetch, fetchInstruction.LocalVariables, fetchInstruction.DeserializeVariables);

                result.Add(resultTask);
            }

            filterOnOptimisticLockingFailure(commandContext, result);

            return(result);
        }
コード例 #2
0
        public virtual IList <ILockedExternalTask> Execute(CommandContext commandContext)
        {
            ValidateInput();

            IList <ExternalTaskEntity> externalTasks = commandContext.ExternalTaskManager.SelectExternalTasksForTopics(FetchInstructions.Keys, MaxResults, UsePriority);

            IList <ILockedExternalTask> result = new List <ILockedExternalTask>();

            foreach (ExternalTaskEntity entity in externalTasks)
            {
                TopicFetchInstruction fetchInstruction = FetchInstructions[entity.TopicName];
                entity.Lock(WorkerId, fetchInstruction.LockDuration.Value);

                LockedExternalTaskImpl resultTask = LockedExternalTaskImpl.FromEntity(entity, fetchInstruction.VariablesToFetch, fetchInstruction.DeserializeVariables);

                result.Add(resultTask);
            }

            FilterOnOptimisticLockingFailure(commandContext, result);

            return(result);
        }