Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Operation<T>

deprecated

Type parameters

  • T

Hierarchy

Implements

Index

Constructors

constructor

  • new Operation(opName: string, criticalOperation?: boolean): Operation

Properties

errorMessages

errorMessages: string[] = []

infoMessages

infoMessages: string[] = []

Protected log

log: Logger

Private mAllFilesCreated

mAllFilesCreated: string[] = []

The list of all files that have been created by the service function

Private mFilesForUndo

mFilesForUndo: string[] = []

The list of files that will be cleaned during an undo operation.

Private mOperationCompleteCallback

mOperationCompleteCallback: IOperationResultReady<any>

The operation has completed and results are ready, this callback is invoked to inform the caller of executeOperation, that the operation is done.

Protected mOperationResult

mOperationResult: IOperationResult<T>

the result from the operation

Protected mOperationResults

mOperationResults: IOperationResult<any> = null

The full list of operation results

Private mPercentComplete

mPercentComplete: number = 0

Private mStageName

mStageName: TaskStage = TaskStage.NOT_STARTED

The status of the operation

Private mStatusMessage

mStatusMessage: string

A string describing what is currently happening in the operation e.g. "Submitted job..."

Static Readonly NO_OUTPUT

NO_OUTPUT: any = null

Static Readonly NO_PARMS

NO_PARMS: any = null

Static Private Readonly outputSeparator

outputSeparator: "*******************************************************************" = "*******************************************************************"

Traverses the results chain and prints results and gives overall failure status

Accessors

allFilesCreated

  • get allFilesCreated(): string[]

fileToUndo

  • get fileToUndo(): string[]

operationName

  • get operationName(): string

operationResult

operationResultMessage

  • set operationResultMessage(message: string): void

operationSucceeded

  • get operationSucceeded(): boolean

percentComplete

  • get percentComplete(): number
  • set percentComplete(newPercent: number): void

stageName

statusMessage

  • get statusMessage(): string

totalOperations

  • get totalOperations(): number

Methods

Protected addFileCreated

  • addFileCreated(fileUndoable: boolean, file: string): void
  • Add a file created by the operation to the list of all files created and optionally mark this file as undoable, which will cause the undo operation to attempt to remove the file or directory.

    Parameters

    • fileUndoable: boolean
    • file: string

    Returns void

Protected addResult

Protected createFile

  • createFile(filePath: string, message: string, saveFileNameForUndo: boolean, isDir: boolean): void
  • Use this method to create files and optionally push them onto the files created stack that will be referenced when an undo is required.

    Parameters

    • filePath: string
    • message: string
    • saveFileNameForUndo: boolean
    • isDir: boolean

    Returns void

Private deleteAllFilesMarkedForUndo

  • deleteAllFilesMarkedForUndo(): void

Protected Abstract execute

executeOperation

Private logBeginMessage

  • logBeginMessage(): void

Private logEndMessage

  • logEndMessage(): void

Protected Abstract logOperationBeginMessages

  • logOperationBeginMessages(): void

Abstract logOperationResults

  • logOperationResults(): void

Private operationComplete

  • operationComplete(output: any): void
  • Operation complete callback method. The operation must invoke the callback to indicate that it has finished. If it does not, the operation sequence will not continue.

    Parameters

    • output: any

    Returns void

performUndo

Protected printFilesCreatedList

  • printFilesCreatedList(): void

Protected setOperationDiverge

  • setOperationDiverge(operation: Operation<any>, continuePathAfterDiverge: boolean): void
  • If the operation decides that a different path is required. You can set the next operation to complete and whether or not you should continue down the original path

    Parameters

    • operation: Operation<any>
    • continuePathAfterDiverge: boolean

    Returns void

Protected setOperationFailed

  • setOperationFailed(): void

Protected setOperationUndoAttempted

  • setOperationUndoAttempted(): void

Protected setOperationUndoFailed

  • setOperationUndoFailed(): void

Protected setOperationUndoable

  • setOperationUndoable(): void

setStatusMessage

  • setStatusMessage(message: string, ...args: any[]): void
  • Set the status message for the operation

    Parameters

    • message: string

      the message, including any templates you want replaced like %s or "{{myObject}}"

    • Rest ...args: any[]

      variable args as allowed by printf-like syntax or {myObject: this.myObject}

    Returns void

    the final translated and formatted string (in case you want to log it etc.)

Protected Abstract undo

Private undoComplete

  • undoComplete(): void

Static summarizeResults

Generated using TypeDoc