@microsoft/windows-admin-center-sdk
Version:
Microsoft - Windows Admin Center Shell
67 lines (65 loc) • 1.74 kB
JavaScript
import { PersistentWorkflowRunner } from './persistent-workflow-runner';
/**
* Abstract class of workflow builder.
* An instance of this class will be used to build workflow.
*/
export class PersistentWorkflowBuilder {
moduleName;
name;
version;
/**
* The collection of work items.
*/
collection;
/**
* Initializes a new instance of the PersistentWorkflowBuilder abstract class.
*
* @param moduleName the module name.
* @param name the name within the namespace.
* @param version the version number.
*/
constructor(moduleName, name, version) {
this.moduleName = moduleName;
this.name = name;
this.version = version;
}
/**
* Initializes the collection to before adding any work items.
*/
init() {
this.collection = [];
}
/**
* Gets the workflow.
*/
get workflow() {
return {
moduleName: this.moduleName,
name: this.name,
version: this.version,
collection: this.collection
};
}
/**
* Add the work item single sequence pattern.
*
* @param workItem the work item.
*/
addSequence(workItem) {
workItem.id = this.collection.length + PersistentWorkflowRunner.startingId;
workItem.nextId = -1;
if (this.collection.length > 0) {
this.collection[this.collection.length - 1].nextId = workItem.id;
}
this.add(workItem);
}
/**
* Add the work item with custom sequence.
*
* @param workItem the work item.
*/
add(workItem) {
this.collection.push(workItem);
}
}
//# sourceMappingURL=persistent-workflow-builder.js.map