deprecated

  The Operations class extends Operation and is used to create a 'string' of operations that must be completed in serial order.

  The implementing class is responsible (in defineOperations) for creating each operation (and invoking addNextOperation) to add the operations to the list. You must also call "defineOperations" from your constructor. This allows you to setup anything you need (in your constructor) before defining the list of operations.

  You can initiate the operation by invoking performOperation, which will iterate through each operation defined and perform them in sequence. If a operation chooses to diverge, then

### Type parameters

- #### T

### Hierarchy

- Operation<any>
  - Operations

### Implements

- ITaskWithStatus

## Index

### Constructors

- constructor

### Properties

- errorMessages
- infoMessages
- log
- mCurrentOperation
- mInputParameters
- mOperationList
- mOperationResult
- mOperationResults
- mOperationUndoIndex
- mOperationUndoList
- mOperationsCompleteCallback
- mOverallStatusMessage
- NO_OUTPUT
- NO_PARMS

### Accessors

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

### Methods

- addFileCreated
- addNextOperation
- addResult
- createFile
- defineOperations
- execute
- executeNextOperation
- executeNextUndo
- executeOperation
- logOperationBeginMessages
- logOperationResults
- operationCompleted
- performUndo
- prepareForUndo
- printFilesCreatedList
- setOperationDiverge
- setOperationFailed
- setOperationUndoAttempted
- setOperationUndoFailed
- setOperationUndoable
- setStatusMessage
- undo
- undoOpComplete
- summarizeResults

## Constructors

### constructor

- new Operations(opName: string, critical?: boolean): Operations

- Overrides Operation.constructor

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:72

  Building an Operations object

  #### Parameters

  - ##### opName: string

  - ##### Optional critical: boolean

  #### Returns Operations

## Properties

### errorMessages

errorMessages: string[] = []

Inherited from Operation.errorMessages

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

### infoMessages

infoMessages: string[] = []

Inherited from Operation.infoMessages

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

### Protected log

log: Logger

Inherited from Operation.log

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

### Private mCurrentOperation

mCurrentOperation: number = 0

- Defined in @zowe/imperative/src/operations/src/Operations.ts:49

The current operation that is being executed.

### Private mInputParameters

mInputParameters: T

- Defined in @zowe/imperative/src/operations/src/Operations.ts:72

The input parameters to this string of operations

### Private mOperationList

mOperationList: Array<Operation<any>> = []

- Defined in @zowe/imperative/src/operations/src/Operations.ts:37

The list of operations that should be executed in sequence

### Protected mOperationResult

mOperationResult: IOperationResult<any>

Inherited from Operation.mOperationResult

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

the result from the operation

### Protected mOperationResults

mOperationResults: IOperationResult<any> = null

Inherited from Operation.mOperationResults

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

The full list of operation results

### Private mOperationUndoIndex

mOperationUndoIndex: number = 0

- Defined in @zowe/imperative/src/operations/src/Operations.ts:67

The current operation undo index.

### Private mOperationUndoList

mOperationUndoList: Array<Operation<any>> = []

- Defined in @zowe/imperative/src/operations/src/Operations.ts:61

In the event of an undo request, we will prepare a list that will be traversed to complete each undo function.

### Private mOperationsCompleteCallback

mOperationsCompleteCallback: IOperationResultReady<any>

- Defined in @zowe/imperative/src/operations/src/Operations.ts:54

the callers operations complete callback

### Private mOverallStatusMessage

mOverallStatusMessage: string

- Defined in @zowe/imperative/src/operations/src/Operations.ts:43

Optionally give a status message in your Operations object instead of letting the message from your sub-operations come through.

### Static Readonly NO_OUTPUT

NO_OUTPUT: any = null

Inherited from Operation.NO_OUTPUT

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

### Static Readonly NO_PARMS

NO_PARMS: any = null

Inherited from Operation.NO_PARMS

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

## Accessors

### allFilesCreated

- get allFilesCreated(): string[]

- Inherited from Operation.allFilesCreated

  - 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[]

- Inherited from Operation.fileToUndo

  - 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

- Inherited from Operation.operationName

  - 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<any>

- Inherited from Operation.operationResult

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

  Accessor method for operation result

  #### Returns IOperationResult<any>

  : The operation result

### operationResultMessage

- set operationResultMessage(message: string): void

- Inherited from Operation.operationResultMessage

  - 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

- Inherited from Operation.operationSucceeded

  - 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

- Overrides Operation.percentComplete

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

  What percent complete is the Operations as a whole?s

  #### Returns number

  percentComplete weighted against how many operations are complete

### stageName

- get stageName(): TaskStage

- Inherited from Operation.stageName

  - 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

- Overrides Operation.statusMessage

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:112

  #### Returns string

### totalOperations

- get totalOperations(): number

- Overrides Operation.totalOperations

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:148

  Count the total number of base operation objects

  #### Returns number

## Methods

### Protected addFileCreated

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

- Inherited from Operation.addFileCreated

  - 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 addNextOperation

- addNextOperation(newOperation: Operation<any>): void

- - Defined in @zowe/imperative/src/operations/src/Operations.ts:161

  Add a new operation to the list of operations to be executed.

  #### Parameters

  - ##### newOperation: Operation<any>

  #### Returns void

### Protected addResult

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

- Inherited from Operation.addResult

  - 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

- Inherited from Operation.createFile

  - 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

### Protected Abstract defineOperations

- defineOperations(): void

- - Defined in @zowe/imperative/src/operations/src/Operations.ts:234

  Abstract method that must be implemented by the subclass. In this method, you invoke "addNextOperation" to add all the operations that must be performed when "executeOperation" is invoked.

  #### Returns void

### Protected execute

- execute(): void

- Overrides Operation.execute

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:168

  This is a placeholder and is never directly called.

  #### Returns void

### Private executeNextOperation

- executeNextOperation(input: any): void

- - Defined in @zowe/imperative/src/operations/src/Operations.ts:240

  If more operations are available, execute the next operation in the list

  #### Parameters

  - ##### input: any

  #### Returns void

### Private executeNextUndo

- executeNextUndo(): void

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

  Execute the next undo in the list. If the undo index is 0 when this function is called, then we can invoke the callers callback as all undos are complete.

  #### Returns void

### executeOperation

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

- Overrides Operation.executeOperation

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:87

  The public interface to Operations. This method allows consumers to initiate the operation sequence.

  #### Parameters

  - ##### inputParameters: T

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

  #### Returns void

  : The operation results

### Protected logOperationBeginMessages

- logOperationBeginMessages(): void

- Overrides Operation.logOperationBeginMessages

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:182

  Log that this is a set of operations that are about to begin.

  #### Returns void

### logOperationResults

- logOperationResults(): void

- Overrides Operation.logOperationResults

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:140

  Log that the set of operations have completed.

  #### Returns void

### Protected operationCompleted

- operationCompleted(output: any, operationResult: IOperationResult<any>): void

- - Defined in @zowe/imperative/src/operations/src/Operations.ts:192

  Callback invoked when the operation completes. Passed the result object of the operation.

  #### Parameters

  - ##### output: any

  - ##### operationResult: IOperationResult<any>

  #### Returns void

### performUndo

- performUndo(undoCompletedCallback: IOperationUndoCompleted): void

- Inherited from Operation.performUndo

  - 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

### Private prepareForUndo

- prepareForUndo(): void

- - Defined in @zowe/imperative/src/operations/src/Operations.ts:270

  Prepare a list of operations to 'undo', we will traverse the list calling the undo function of each operation. Only operations that are marked as 'undoa-able' will be called.

  TODO - we could probably fire off all undo functions here async, but for now they are serial

  #### Returns void

### Protected printFilesCreatedList

- printFilesCreatedList(): void

- Inherited from Operation.printFilesCreatedList

  - 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

- Inherited from Operation.setOperationDiverge

  - 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

- Inherited from Operation.setOperationFailed

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

  Set method to indicate that the operation failed.

  #### Returns void

### Protected setOperationUndoAttempted

- setOperationUndoAttempted(): void

- Inherited from Operation.setOperationUndoAttempted

  - 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

- Inherited from Operation.setOperationUndoFailed

  - 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

- Inherited from Operation.setOperationUndoable

  - 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[]): string

- Overrides Operation.setStatusMessage

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

  Set the status message for the overall Operations object, which takes precedence over the sub-operations' messages

  #### 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 string

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

### Protected undo

- undo(): void

- Overrides Operation.undo

  - Defined in @zowe/imperative/src/operations/src/Operations.ts:175

  Perform all undos if the undo function is called for an Operations

  #### Returns void

### Private undoOpComplete

- undoOpComplete(): void

- - Defined in @zowe/imperative/src/operations/src/Operations.ts:313

  Undo operation completed callback. Probably unnecessary.

  #### Returns void

### Static summarizeResults

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

- Inherited from Operation.summarizeResults

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

  #### Parameters

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

  #### Returns boolean

Generated using TypeDoc