de.esprit.appsuite.workflow

## Class AbstractWorkflow<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.gui.task.AbstractSwingTask<C>
          - - de.esprit.appsuite.workflow.AbstractWorkflow<C>

- All Implemented Interfaces:
    ApplicationObject<C>, AsyncExecutable<C>, AsyncTask<C>, CancellableTask, LocalCancellableTask, TaskMonitorSupport, TaskEvent.Source, TaskIdHolder, ErrorHandlerSupport, Renderable, SimpleLogSupport, Dumpable, Executable, java.lang.Runnable
  Direct Known Subclasses:
    AbstractClientWorkflow, ArchiveExtractWorkflow, ArchiveListWorkflow, CreateZipArchiveWorkflow, RemoteArchiveExtractWorkflow, RemoteArchiveListWorkflow

      public abstract class AbstractWorkflow<C extends ApplicationContext>
      extends AbstractSwingTask<C>

  This is the base class for all workflows. A workflow is a collection of tasks that run asynchronously in a sequence. All `WorkflowTask`s run as child-tasks within the main workflow-task. `WorkflowTask`s are being observed by the `WorkflowMonitorDialog` which is GUI dialog visualizing the progress with check-labels. It is popped up when the workflow starts or finishes.
  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
    `AbstractWorkflow(C ctx)`
    `AbstractWorkflow(C ctx, NlsKey title)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTask(WorkflowTask task)`
    `protected LogChannel` | `createLogChannel()`
    `protected WorkflowMonitorDialog` | `createWorkflowMonitor()` Creates the `WorkflowMonitorDialog` for visualizing the progress of this workflow.
    `protected void` | `doneTaskCancelled(TaskEvent e)`
    `protected void` | `doneTaskFinished(TaskEvent e)`
    `protected void` | `doneTaskStarted(TaskEvent e)`
    `protected void` | `doneTaskStateChanged(TaskEvent e)`
    `boolean` | `equals(java.lang.Object obj)`
    `void` | `executeAsync()` Must be overridden to perform the async part.
    `int` | `getCurrentTaskIndex()`
    `java.util.List<WorkflowTask>` | `getTaskList()`
    `java.lang.String` | `getTitleDetailText()`
    `IconKey` | `getTitleIcon()`
    `java.lang.String` | `getTitleText()`
    `WorkflowMonitorDialog` | `getWorkflowMonitor()`
    `java.io.File` | `getWorkingDir()`
    `void` | `handleDecision(CheckOption option)`
    `int` | `hashCode()`
    `void` | `insertTask(WorkflowTask task)`
    `static boolean` | `isAutoClose(java.lang.String workflowName)`
    `boolean` | `isCloseMonitorOnCancel()`
    `boolean` | `isMonitored()` Tells whether a `WorkflowMonitorDialog` exists for this workflow
    `void` | `setAutoCloseWhenFinished(boolean isAutoClose)`
    `void` | `setCloseMonitorOnCancel(boolean isCloseMonitorOnCancel)` Tells whether the monitor dialog should be closed on cancel.
    `void` | `setFinalTask(WorkflowTask finalTask)` Sets a final task which will be executed in any case at the very end of the workflow.
    `void` | `setTitleDetailText(NlsKey detailsKey, java.lang.Object... args)`
    `void` | `setTitleDetailText(java.lang.String titleDetailText)` This text is displayed as a second header line in the `WorkflowMonitorDialog`
    `void` | `setTitleIcon(IconKey iconKey)` This icon is displayed in the `WorkflowMonitorDialog`.
    `void` | `setTitleText(NlsKey titleKey, java.lang.Object... args)`
    `void` | `setTitleText(java.lang.String titleText)` This text is displayed as the main header line in the `WorkflowMonitorDialog`.
    `void` | `setWorkingDir(java.io.File workingDir)`
    `void` | `skipAllTasks()` Skips all remaining tasks
    `void` | `skipCurrentTask()` This call stops the current task immediately and marks it as skipped
    `void` | `skipNextTask()` Ensures that the next task is skipped
    `void` | `skipNextTasks(int count)` Ensures that the next n task are being skipped
    `static void` | `storeAutoClose(java.lang.String workflowName, boolean isAutoClose)`
    `TaskId` | `submit(java.util.concurrent.ExecutorService pool)` Submits this task for execution to the given thread pool

    - ### Methods inherited from class de.esprit.appsuite.gui.task.AbstractSwingTask

      `addMonitor, addTaskListener, awaitEventsDone, doneChildFinished, doneChildStarted, doneTaskFailed, doneTaskProceeded, doneTaskSucceeded, getActionCancel, getRenderColor, getRenderIcon, getRenderText, getSwingTaskMonitor, isRegisterInTaskList, removeTaskListener, showError, showError, showError, showInfo, showInfo, showWarning, showWarning`

    - ### 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, submitInternal, toString, wasSucceeded`

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

      `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, finalize, getClass, 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

      `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

    - #### AbstractWorkflow

          public AbstractWorkflow(C ctx)

    - #### AbstractWorkflow

          public AbstractWorkflow(C ctx,
                          NlsKey title)

  - ### Method Detail

    - #### storeAutoClose

          public static void storeAutoClose(java.lang.String workflowName,
                            boolean isAutoClose)

    - #### isAutoClose

          public static boolean isAutoClose(java.lang.String workflowName)

    - #### setTitleText

          public final void setTitleText(java.lang.String titleText)

      This text is displayed as the main header line in the `WorkflowMonitorDialog`. Is also used as the taskName.
      See Also:
        `AbstractAsyncExecutable.setName(String)`

    - #### setTitleText

          public final void setTitleText(NlsKey titleKey,
                          java.lang.Object... args)

    - #### getTitleText

          public final java.lang.String getTitleText()

    - #### isCloseMonitorOnCancel

          public final boolean isCloseMonitorOnCancel()

      See Also:
        `setCloseMonitorOnCancel(boolean)`

    - #### setCloseMonitorOnCancel

          public void setCloseMonitorOnCancel(boolean isCloseMonitorOnCancel)

      Tells whether the monitor dialog should be closed on cancel.
      Parameters:
        `isCloseMonitorOnCancel` - default is true
      See Also:
        `isCloseMonitorOnCancel()`

    - #### setTitleDetailText

          public final void setTitleDetailText(java.lang.String titleDetailText)

      This text is displayed as a second header line in the `WorkflowMonitorDialog`

    - #### setTitleDetailText

          public final void setTitleDetailText(NlsKey detailsKey,
                                java.lang.Object... args)

    - #### getTitleDetailText

          public final java.lang.String getTitleDetailText()

    - #### setTitleIcon

          public final void setTitleIcon(IconKey iconKey)

      This icon is displayed in the `WorkflowMonitorDialog`.

    - #### getTitleIcon

          public final IconKey getTitleIcon()

    - #### setFinalTask

          public void setFinalTask(WorkflowTask finalTask)

      Sets a final task which will be executed in any case at the very end of the workflow.

    - #### submit

          public TaskId submit(java.util.concurrent.ExecutorService pool)
                        throws java.lang.Exception

      Description copied from interface: `AsyncTask`
      Submits this task for execution to the given thread pool
      Specified by:
        `submit` in interface `AsyncTask<C extends ApplicationContext>`
      Overrides:
        `submit` in class `AbstractAsyncTask<C extends ApplicationContext>`
      Throws:
        `java.lang.Exception` - if the pool is busy

    - #### createLogChannel

          protected LogChannel createLogChannel()

    - #### getWorkingDir

          public java.io.File getWorkingDir()

    - #### setWorkingDir

          public void setWorkingDir(java.io.File workingDir)

    - #### setAutoCloseWhenFinished

          public void setAutoCloseWhenFinished(boolean isAutoClose)

    - #### getTaskList

          public java.util.List<WorkflowTask> getTaskList()

    - #### addTask

          public void addTask(WorkflowTask task)

    - #### insertTask

          public void insertTask(WorkflowTask task)

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getWorkflowMonitor

          public WorkflowMonitorDialog getWorkflowMonitor()

    - #### isMonitored

          public boolean isMonitored()

      Tells whether a `WorkflowMonitorDialog` exists for this workflow

    - #### createWorkflowMonitor

          protected WorkflowMonitorDialog createWorkflowMonitor()

      Creates the `WorkflowMonitorDialog` for visualizing the progress of this workflow. You may return null if no GUI monitoring is desired.

    - #### getCurrentTaskIndex

          public int getCurrentTaskIndex()

    - #### skipCurrentTask

          public void skipCurrentTask()

      This call stops the current task immediately and marks it as skipped

    - #### skipNextTask

          public void skipNextTask()

      Ensures that the next task is skipped

    - #### skipNextTasks

          public void skipNextTasks(int count)

      Ensures that the next n task are being skipped

    - #### skipAllTasks

          public void skipAllTasks()

      Skips all remaining tasks

    - #### executeAsync

          public final 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`

    - #### doneTaskStateChanged

          protected void doneTaskStateChanged(TaskEvent e)

      Overrides:
        `doneTaskStateChanged` in class `AbstractSwingTask<C extends ApplicationContext>`

    - #### doneTaskStarted

          protected void doneTaskStarted(TaskEvent e)

      Overrides:
        `doneTaskStarted` in class `AbstractSwingTask<C extends ApplicationContext>`

    - #### doneTaskFinished

          protected void doneTaskFinished(TaskEvent e)

      Overrides:
        `doneTaskFinished` in class `AbstractSwingTask<C extends ApplicationContext>`

    - #### doneTaskCancelled

          protected void doneTaskCancelled(TaskEvent e)

      Overrides:
        `doneTaskCancelled` in class `AbstractSwingTask<C extends ApplicationContext>`

    - #### handleDecision

          public void handleDecision(CheckOption option)

Copyright © 2014 EsprIT-Systems. All Rights Reserved.