Filters according to what's applicable
depending on the context of the task activity instance.

@param standardTaskActions unfiltered list
@return the list of task actions
514861
public List<TaskAction> filterStandardActions(List<TaskAction> standardTaskActions)
    throws ServiceException, DataAccessException {

        CodeTimer timer = new CodeTimer("TaskManager.filterStandardTaskActions()", true);

        List<TaskAction> filteredTaskActions = standardTaskActions;
        try {
            ActivityInstance activityInstance = getActivityInstance(true);

            if (activityInstance != null) {
                Long processInstanceId = activityInstance.getProcessInstanceId();
                ProcessInstance processInstance = ServiceLocator.getWorkflowServices().getProcess(processInstanceId);

                if (processInstance.isEmbedded()) {
                    // remove RETRY since no default behavior is defined for inline tasks
                    TaskAction retryAction = null;
                    for (TaskAction taskAction : standardTaskActions) {
                        if (taskAction.getTaskActionName().equalsIgnoreCase("Retry"))
                            retryAction = taskAction;
                        }
                    if (retryAction != null)
                        standardTaskActions.remove(retryAction);
                }

                Process processVO = null;
                if (processInstance.getProcessInstDefId() > 0L)
                    processVO = ProcessCache.getProcessInstanceDefiniton(processInstance.getProcessId(), processInstance.getProcessInstDefId());
                if (processVO == null)
                    processVO = ProcessCache.getProcess(processInstance.getProcessId());
                if (processInstance.isEmbedded())
                    processVO = processVO.getSubProcessVO(new Long(processInstance.getComment()));
                List<Transition> outgoingWorkTransVOs = processVO.getAllTransitions(activityInstance.getActivityId());
                boolean foundNullResultCode = false;
                for (Transition workTransVO : outgoingWorkTransVOs) {
                    Integer eventType = workTransVO.getEventType();
                    if ((eventType.equals(EventType.FINISH) || eventType.equals(EventType.RESUME))
                        && workTransVO.getCompletionCode() == null) {
                      foundNullResultCode = true;
                      break;
                    }
                }
                if (!foundNullResultCode) {
                    TaskAction cancelAction = null;
                    TaskAction completeAction = null;
                    for (TaskAction taskAction : standardTaskActions) {
                        if (taskAction.getTaskActionName().equalsIgnoreCase("Cancel"))
                            cancelAction = taskAction;
                        if (taskAction.getTaskActionName().equalsIgnoreCase("Complete"))
                            completeAction = taskAction;
                    }
                    if (cancelAction != null)
                        standardTaskActions.remove(cancelAction);
                    if (completeAction != null)
                      standardTaskActions.remove(completeAction);
                }
            }
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
        }
        timer.stopAndLogTiming("");
        return filteredTaskActions;
    }
749319
private final <T> ImmutableList<Callable<T>> wrapTasks(Collection<? extends Callable<T>> tasks) {
    ImmutableList.Builder<Callable<T>> builder = ImmutableList.builder();
    for (Callable<T> task : tasks) {
      builder.add(wrapTask(task));
    }
    return builder.build();
  }
1085836
public static Map<String,List<TaskAction>> getTaskStatusAllowableActions() throws IOException, XmlException {
        if (taskStatusAllowableActions == null) {
            taskStatusAllowableActions = new HashMap<String,List<TaskAction>>();
            for (TaskActionStatus taskActionStatus : getTaskActions().getTaskDetailActions().getTaskStatusList()) {
                String status = taskActionStatus.getStatus();
                List<TaskAction> taskActions = new ArrayList<TaskAction>();
                taskStatusAllowableActions.put(status, taskActions);
                for (AllowableAction allowableAction: taskActionStatus.getAllowableActionList()) {
                    TaskAction taskAction = convertToJsonable(allowableAction);
                    if (!taskActions.contains(taskAction))
                        taskActions.add(taskAction);
                }
            }
        }
        return taskStatusAllowableActions;
    }
1332515
public List<RemoteTask> getAllTasks()
    {
        return tasks.values().stream()
                .flatMap(Set::stream)
                .collect(toImmutableList());
    }
66071
@Whitelisted
    public List<Action> getStaticAnalysisActions() {
        if (isPluginInstalled("analysis-core")) {
            return new StaticAnalysisUtilities().getActions(build);
        } else {
            return Collections.emptyList();
        }
    }
1099816
public void filterSkippedTaskStates() {
    List<TaskState> skippedTaskStates = new ArrayList<>();
    for (TaskState taskState : this.taskStates.values()) {
      if (taskState.getWorkingState() == WorkUnitState.WorkingState.SKIPPED) {
        skippedTaskStates.add(taskState);
      }
    }
    for (TaskState taskState : skippedTaskStates) {
      removeTaskState(taskState);
      addSkippedTaskState(taskState);
    }
  }
1032356
List<Task> getSetupAndCleanupTasks(
    TaskTrackerStatus taskTracker) throws IOException {
    int maxMapTasks = taskScheduler.getMaxSlots(taskTracker, TaskType.MAP);
    int maxReduceTasks =
        taskScheduler.getMaxSlots(taskTracker, TaskType.REDUCE);
    int numMaps = taskTracker.countOccupiedMapSlots();
    int numReduces = taskTracker.countOccupiedReduceSlots();
    int numTaskTrackers = getClusterStatus().getTaskTrackers();
    int numUniqueHosts = getNumberOfUniqueHosts();

    List<JobInProgress> cachedJobs = new ArrayList<JobInProgress> ();

    // get a snapshot of all the jobs in the system
    synchronized (jobs) {
      cachedJobs.addAll(jobs.values());
    }

    Task t = null;

    if (numMaps < maxMapTasks) {
      for (JobInProgress job: cachedJobs) {
        t = job.obtainJobCleanupTask(taskTracker, numTaskTrackers,
                                     numUniqueHosts, true);
        if (t != null) {
          return Collections.singletonList(t);
        }
      }
      for (JobInProgress job: cachedJobs) {
        t = job.obtainTaskCleanupTask(taskTracker, true);
        if (t != null) {
          return Collections.singletonList(t);
        }
      }
      for (JobInProgress job: cachedJobs) {
        t = job.obtainJobSetupTask(taskTracker, numTaskTrackers,
                                   numUniqueHosts, true);
        if (t != null) {
          return Collections.singletonList(t);
        }
      }
    }
    if (numReduces < maxReduceTasks) {
      for (JobInProgress job: cachedJobs) {
        t = job.obtainJobCleanupTask(taskTracker, numTaskTrackers,
                                     numUniqueHosts, false);
        if (t != null) {
          return Collections.singletonList(t);
        }
      }
      for (JobInProgress job: cachedJobs) {
        t = job.obtainTaskCleanupTask(taskTracker, false);
        if (t != null) {
          return Collections.singletonList(t);
        }
      }
      for (JobInProgress job: cachedJobs) {
        t = job.obtainJobSetupTask(taskTracker, numTaskTrackers,
                                   numUniqueHosts, false);
        if (t != null) {
          return Collections.singletonList(t);
        }
      }
    }

    return null;
  }
765997
private List<Task> receiveTasks() {
		synchronized (mutex) {
			if (tasks.isEmpty()) {
				return Collections.emptyList();
			} else {
				List<Task> currentTasks = tasks;
				tasks = new ArrayList<Task>();
				return currentTasks;
			}
		}
	}
379641
@Service
    public List<Task> getTasks(String taskType, String startKey, Integer count) {
        return executionService.getTasks(taskType, startKey, count);
    }
1280771
private List<TaskField> getAllTaskExtendedAttributes()
   {
      ArrayList<TaskField> result = new ArrayList<TaskField>();
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_TEXT));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_START));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FINISH));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_COST));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DATE));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FLAG));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_NUMBER));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DURATION));
      result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_OUTLINE_CODE));
      result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_COST));
      result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DATE));
      result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DURATION));
      result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_FLAG));
      result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_NUMBER));
      result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_TEXT));
      return result;
   }
1193707
public synchronized List<TaskStatus> getNonRunningTasks() {
    List<TaskStatus> result = new ArrayList<TaskStatus>(tasks.size());
    for(Map.Entry<TaskAttemptID, TaskInProgress> task: tasks.entrySet()) {
      if (!runningTasks.containsKey(task.getKey())) {
        result.add(task.getValue().getStatus());
      }
    }
    return result;
  }
558207
protected function getTaskActions() {
        if (!$this->_taskActions) {
            $this->_taskActions = new TaskActionsList(
                $this->version,
                $this->solution['assistantSid'],
                $this->solution['sid']
            );
        }

        return $this->_taskActions;
    }
896817
private ArrayList<String> getActions() {
        String actionList = getString(KEY_ACTIONS);
        if (actionList.equals(NO_STRING_VALUE)) {
            return new ArrayList<>();
        } else {
            return deserializeString(actionList);
        }
    }
285163
protected static Iterable<AgentTask> getTaskList(List<WeakReference<AgentTask>> tasks) {
		final Iterable<AgentTask> col = Iterables.transform(tasks, it -> it != null ? it.get() : null);
		return Iterables.filter(col, it -> it != null);
	}
513063
public List<Task> executeList(CommandContext commandContext, Map<String, Object> parameterMap, int firstResult, int maxResults) {
    return commandContext
      .getTaskManager()
      .findTasksByNativeQuery(parameterMap, firstResult, maxResults);
  }
1371557
@Nonnull
    public static <T> List<TtlCallable<T>> gets(@Nullable Collection<? extends Callable<T>> tasks) {
        return gets(tasks, false, false);
    }
218342
public java.util.List<ConversionTask> getConversionTasks() {
        if (conversionTasks == null) {
            conversionTasks = new com.amazonaws.internal.SdkInternalList<ConversionTask>();
        }
        return conversionTasks;
    }