de.esprit.appsuite.task

## Class TaskCollection<C extends ApplicationContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.task.AbstractAsyncExecutable<C>
      - - de.esprit.appsuite.task.AbstractAsyncTask<C>
        - - de.esprit.appsuite.task.TaskCollection<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncExecutable<C>, AsyncTask<C>, CancellableTask, LocalCancellableTask, TaskMonitorSupport, TaskIdHolder, SimpleLogSupport, Clearable, Dumpable, Executable, java.lang.Runnable

      public class TaskCollection<C extends ApplicationContext>
      extends AbstractAsyncTask<C>
      implements Clearable

  This is a (main) task that runs a list of `AsyncExecutable`s as sub-tasks in a serie. For each sub-tasks it notifies its monitors with CHILD_STARTED/CHILD_FINISHED calls. That way it is able to drive a double progressBar.
  Author:
    Rainer Buesch

- - ### Field Summary

    - ### Fields inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `childTaskRef, isTestMode, monitorController, resultRef, stateFlag`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaskCollection(C ctx)`
    `TaskCollection(C ctx, java.lang.String collTaskName)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTask(AsyncExecutable task)` Add a sub-task to be executed
    `void` | `clear()` Removes all sub-tasks from the execution list
    `void` | `executeAsync()` Must be overridden to perform the async part.
    `AsyncExecutable` | `getTask(int index)`
    `void` | `insertTask(int index, AsyncExecutable task)` Add a sub-task to be executed at a particular index
    `void` | `removeTask(AsyncExecutable task)` Remove the given sub-task from the execution list
    `void` | `removeTask(int index)` Remove the sub-task at the given index from the execution list

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncTask

      `awaitFinished, awaitFinished, awaitStarted, cancel, createTaskId, deregisterTask, doOnFinish, doOnStart, doOnSuccess, executeChildTask, executeChildTask, getCurrentFuture, getMaxChildTasks, getPriority, getProcessingDuration, getStartTime, getStopWatch, handleFinish, handleStart, handleSuccess, isRegisterForCancel, isRunning, notifyProceeded, registerTask, releaseStart, run, setCurrentFuture, setMaxChildTasks, setPriority, setRegisterForCancel, setReleaseTimeout, submit, submit, submitInternal, toString, wasSucceeded`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `addMonitor, checkCancelled, checkForErrorAndRethrow, clearMonitors, createRunStateFlag, doOnCancel, doOnFailure, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, hasError, hasMonitor, isCancellable, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelled`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.appsuite.task.AsyncTask

      `getError, hasError, setName`

    - ### Methods inherited from interface de.esprit.appsuite.task.AsyncExecutable

      `checkCancelled, checkForErrorAndRethrow, executeSubTask, getName, getResult, getRunStateFlag, getTaskId, getType, handleCancellation, handleFailure, isCancellable, setCancellable, setName, setResult, setRunStateFlag, sleepChecked`

    - ### Methods inherited from interface de.esprit.appsuite.launch.ApplicationObject

      `getApplicationContext`

    - ### Methods inherited from interface de.esprit.common.type.Executable

      `execute`

    - ### Methods inherited from interface de.esprit.appsuite.task.monitor.TaskMonitorSupport

      `addMonitor, clearMonitors, getMonitorCount, getMonitors, hasMonitor, removeMonitor`

    - ### Methods inherited from interface de.esprit.common.log.SimpleLogSupport

      `getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from interface de.esprit.appsuite.task.CancellableTask

      `wasCancelled`

    - ### Methods inherited from interface de.esprit.appsuite.task.TaskIdHolder

      `getTaskId`

    - ### Methods inherited from interface de.esprit.common.type.Dumpable

      `toDumpString, toDumpString, toString`

- - ### Constructor Detail

    - #### TaskCollection

          public TaskCollection(C ctx)

    - #### TaskCollection

          public TaskCollection(C ctx,
                        java.lang.String collTaskName)

  - ### Method Detail

    - #### executeAsync

          public void executeAsync()
                            throws java.lang.Exception

      Description copied from class: `AbstractAsyncTask`
      Must be overridden to perform the async part. From within this method you may directly call `AbstractAsyncTask.notifyProceeded(Object, int, int, String)` in order to notify about task progress. Note: the running task should periodically call `AbstractAsyncExecutable.checkCancelled()` in order to detect cancellation.
      Specified by:
        `executeAsync` in interface `AsyncExecutable<C extends ApplicationContext>`
      Specified by:
        `executeAsync` in class `AbstractAsyncTask<C extends ApplicationContext>`
      Throws:
        `java.lang.Exception`
      See Also:
        `for synchronous execution`

    - #### addTask

          public void addTask(AsyncExecutable task)

      Add a sub-task to be executed

    - #### insertTask

          public void insertTask(int index,
                        AsyncExecutable task)

      Add a sub-task to be executed at a particular index

    - #### removeTask

          public void removeTask(AsyncExecutable task)

      Remove the given sub-task from the execution list

    - #### removeTask

          public void removeTask(int index)

      Remove the sub-task at the given index from the execution list

    - #### getTask

          public AsyncExecutable getTask(int index)

    - #### clear

          public void clear()

      Removes all sub-tasks from the execution list
      Specified by:
        `clear` in interface `Clearable`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.