summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/models/operation.ts
blob: 55fcd823207494459bad9506470774a5cd2e8137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';

export class OperationParam {
    paramName: string = '';
    paramId: string = '';

    constructor(param?: OperationParam) {
        if (param) {
            this.paramId = param.paramId;
            this.paramName = param.paramName;
        }
    }
}

export interface IOperationParamsList {
    listToscaDataDefinition: Array<OperationParam>;
}

export class OperationModel {
    description: string;
    inputParams: IOperationParamsList;
    operationType: string;
    outputParams: IOperationParamsList;
    uniqueId: string;

    constructor(operation?: any) {
        if (operation) {
            this.description = operation.description;
            this.inputParams = operation.inputParams;
            this.operationType = operation.operationType;
            this.outputParams = operation.outputParams;
            this.uniqueId = operation.uniqueId;
        }
    }

    public createInputParamsList(inputParams: Array<OperationParam>): void {
        this.inputParams = {
            listToscaDataDefinition: inputParams
        };
    }

    public createOutputParamsList(outputParams: Array<OperationParam>): void {
        this.outputParams = {
            listToscaDataDefinition: outputParams
        };
    }
}

export interface CreateOperationResponse extends OperationModel {
    artifactUUID: string;
}