deprecated

### Type parameters

- #### T

### Hierarchy

- Operation
  - Operations

### Implements

- ITaskWithStatus

## Index

### Constructors

- constructor

### Properties

- errorMessages
- infoMessages
- log
- mAllFilesCreated
- mFilesForUndo
- mOperationCompleteCallback
- mOperationResult
- mOperationResults
- mPercentComplete
- mStageName
- mStatusMessage
- NO_OUTPUT
- NO_PARMS
- outputSeparator

### Accessors

- allFilesCreated
- fileToUndo
- operationName
- operationResult
- operationResultMessage
- operationSucceeded
- percentComplete
- stageName
- statusMessage
- totalOperations

### Methods

- addFileCreated
- addResult
- createFile
- deleteAllFilesMarkedForUndo
- execute
- executeOperation
- logBeginMessage
- logEndMessage
- logOperationBeginMessages
- logOperationResults
- operationComplete
- performUndo
- printFilesCreatedList
- setOperationDiverge
- setOperationFailed
- setOperationUndoAttempted
- setOperationUndoFailed
- setOperationUndoable
- setStatusMessage
- undo
- undoComplete
- summarizeResults

## Constructors

### constructor

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

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:169

  Action constructor to build action object

  #### Parameters

  - ##### opName: string

  - ##### Optional criticalOperation: boolean

    the operation is critical - meaning if it fails the entire operation fails and the undo methods should be called.

  #### Returns Operation

## Properties

### errorMessages

errorMessages: string[] = []

- Defined in @zowe/imperative/src/operations/src/Operation.ts:105

### infoMessages

infoMessages: string[] = []

- Defined in @zowe/imperative/src/operations/src/Operation.ts:104

### Protected log

log: Logger

- Defined in @zowe/imperative/src/operations/src/Operation.ts:130

### Private mAllFilesCreated

mAllFilesCreated: string[] = []

- Defined in @zowe/imperative/src/operations/src/Operation.ts:163

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

### Private mFilesForUndo

mFilesForUndo: string[] = []

- Defined in @zowe/imperative/src/operations/src/Operation.ts:169

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

### Private mOperationCompleteCallback

mOperationCompleteCallback: IOperationResultReady<any>

- Defined in @zowe/imperative/src/operations/src/Operation.ts:157

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>

- Defined in @zowe/imperative/src/operations/src/Operation.ts:139

the result from the operation

### Protected mOperationResults

mOperationResults: IOperationResult<any> = null

- Defined in @zowe/imperative/src/operations/src/Operation.ts:134

The full list of operation results

### Private mPercentComplete

mPercentComplete: number = 0

- Defined in @zowe/imperative/src/operations/src/Operation.ts:151

### Private mStageName

mStageName: TaskStage = TaskStage.NOT_STARTED

- Defined in @zowe/imperative/src/operations/src/Operation.ts:144

The status of the operation

### Private mStatusMessage

mStatusMessage: string

- Defined in @zowe/imperative/src/operations/src/Operation.ts:149

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

### Static Readonly NO_OUTPUT

NO_OUTPUT: any = null

- Defined in @zowe/imperative/src/operations/src/Operation.ts:38

### Static Readonly NO_PARMS

NO_PARMS: any = null

- Defined in @zowe/imperative/src/operations/src/Operation.ts:36

### Static Private Readonly outputSeparator

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

- Defined in @zowe/imperative/src/operations/src/Operation.ts:102

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

## Accessors

### allFilesCreated

- get allFilesCreated(): string[]

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:281

  Accessor method to obtain all the files created using the file creator service

  #### Returns string[]

### fileToUndo

- get fileToUndo(): string[]

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:289

  Accessor method to obtain all the files created that are marked as delete on undo

  #### Returns string[]

### operationName

- get operationName(): string

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:297

  Get the operation name for display and other purposes

  #### Returns string

### operationResult

- get operationResult(): IOperationResult<T>

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:262

  Accessor method for operation result

  #### Returns IOperationResult<T>

  : The operation result

### operationResultMessage

- set operationResultMessage(message: string): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:322

  Append an additional message to the result message buffer

  #### Parameters

  - ##### message: string

  #### Returns void

### operationSucceeded

- get operationSucceeded(): boolean

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:331

  Determine if the operation failed

  #### Returns boolean

  : If the operation failed

### percentComplete

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

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:111

  #### Returns number

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:115

  #### Parameters

  - ##### newPercent: number

  #### Returns void

### stageName

- get stageName(): TaskStage

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:273

  Accessor method for operation status

  #### Returns TaskStage

  : The operation status/ stage name e.g. FAILED

### statusMessage

- get statusMessage(): string

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:107

  #### Returns string

### totalOperations

- get totalOperations(): number

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:126

  #### Returns number

## Methods

### Protected addFileCreated

- addFileCreated(fileUndoable: boolean, file: string): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:451

  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

- addResult(result: IOperationResult<any>): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:387

  Add the result to the end of the results list

  #### Parameters

  - ##### result: IOperationResult<any>

  #### Returns void

### Protected createFile

- createFile(filePath: string, message: string, saveFileNameForUndo: boolean, isDir: boolean): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:412

  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

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:463

  Method that is called after the implementing classes undo to delete all the files that have been saved during the operation (on the mFilesForUndo list).

  #### Returns void

### Protected Abstract execute

- execute(inputParameters: T, operationCompletedCallback: IOperationCompleted<any>): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:370

  The execute method must be implemented by the class. This is where the operation performs its work and sets the result and the course of action (failed, undo possible, etc).

  #### Parameters

  - ##### inputParameters: T

  - ##### operationCompletedCallback: IOperationCompleted<any>

  #### Returns void

### executeOperation

- executeOperation(inputParameters: T, operationComplete: IOperationResultReady<any>): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:206

  Execute the operation. Set the status of the operation to IN_PROGRESS and invoke the implemented operations execute method.

  #### Parameters

  - ##### inputParameters: T

  - ##### operationComplete: IOperationResultReady<any>

  #### Returns void

### Private logBeginMessage

- logBeginMessage(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:488

  This method logs a standard header for the operation

  #### Returns void

### Private logEndMessage

- logEndMessage(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:509

  This method logs a standard header for the operation

  #### Returns void

### Protected Abstract logOperationBeginMessages

- logOperationBeginMessages(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:381

  Override this method when implementing and place any operation start messages that should be logged here.

  #### Returns void

### Abstract logOperationResults

- logOperationResults(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:256

  Override this method when implementing and place any operation end messages that should be logged here.

  #### Returns void

### Private operationComplete

- operationComplete(output: any): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:522

  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

- performUndo(undoCompletedCallback: IOperationUndoCompleted): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:245

  The perform undo method sets that an attempt was made to perform the undo and invokes the undo method of the implemented operation.

  Before invoking, any files that have been created and saved on the undo-able list will be cleaned.

  #### Parameters

  - ##### undoCompletedCallback: IOperationUndoCompleted

  #### Returns void

### Protected printFilesCreatedList

- printFilesCreatedList(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:436

  Method to print all the files created by the file creator service.

  #### Returns void

### Protected setOperationDiverge

- setOperationDiverge(operation: Operation<any>, continuePathAfterDiverge: boolean): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:350

  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

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:304

  Set method to indicate that the operation failed.

  #### Returns void

### Protected setOperationUndoAttempted

- setOperationUndoAttempted(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:359

  Set the operation undo attempted (whether it succeed or failed is up to the undo method to set)

  #### Returns void

### Protected setOperationUndoFailed

- setOperationUndoFailed(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:338

  Set that the operation undo failed. This is for diagnostic purposes.

  #### Returns void

### Protected setOperationUndoable

- setOperationUndoable(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:314

  Set method to indicate that the operation is "undoable".

  This means that if an operation fails, we will 'rollback' through the completed operations and undo any that have occurred.

  #### Returns void

### setStatusMessage

- setStatusMessage(message: string, ...args: any[]): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:230

  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

- undo(undoCompleteCallback: IOperationUndoCompleted): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:375

  The undo method is called when an operation fails and the operation is set to "undoable"

  #### Parameters

  - ##### undoCompleteCallback: IOperationUndoCompleted

  #### Returns void

### Private undoComplete

- undoComplete(): void

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:579

  The operation undo complete callback method, this must be called by the operations undo method in order for the operation 'undos' to continue.

  #### Returns void

### Static summarizeResults

- summarizeResults(operationResults: IOperationResult<any>): boolean

- - Defined in @zowe/imperative/src/operations/src/Operation.ts:40

  #### Parameters

  - ##### operationResults: IOperationResult<any>

  #### Returns boolean

Generated using TypeDoc