3 export class OperationParameter {
11 constructor(param?: any) {
13 this.name = param.name;
14 this.type = param.type;
15 this.inputId = param.inputId ;
16 this.required = param.required;
17 this.property = param.property;
18 this.mandatory = param.mandatory;
23 export interface IOperationParamsList {
24 listToscaDataDefinition: Array<OperationParameter>;
27 export class WORKFLOW_ASSOCIATION_OPTIONS {
30 static EXISTING = 'EXISTING';
31 static EXTERNAL = 'EXTERNAL';
34 export class BEOperationModel {
39 inputs: IOperationParamsList;
40 outputs: IOperationParamsList;
42 workflowAssociationType: string;
44 workflowVersionId: string;
46 workflowVersion: string;
53 constructor(operation?: any) {
55 this.name = operation.name;
56 this.description = operation.description;
57 this.uniqueId = operation.uniqueId;
59 this.inputs = operation.inputs;
60 this.outputs = operation.outputs;
62 this.workflowAssociationType = operation.workflowAssociationType;
63 this.workflowId = operation.workflowId;
64 this.workflowVersionId = operation.workflowVersionId;
65 this.workflowName = operation.workflowName;
66 this.workflowVersion = operation.workflowVersion;
67 this.implementation = operation.implementation || {};
71 public createInputsList(inputs: Array<OperationParameter>): void {
73 listToscaDataDefinition: inputs
77 public createOutputsList(outputs: Array<OperationParameter>): void {
79 listToscaDataDefinition: _.map(outputs, output => {
80 delete output.inputId;
87 export class OperationModel extends BEOperationModel{
88 interfaceType: string;
90 operationType: string;
93 artifactFileName?: string;
96 inputParams: IOperationParamsList;
97 outputParams: IOperationParamsList;
100 workflowVersionId: string;
101 workflowName: string;
102 workflowVersion: string;
104 protected OperationTypeEnum: Array<String> = [
112 constructor(operation?: any) {
115 this.interfaceId = operation.interfaceId;
116 this.interfaceType = operation.interfaceType;
117 this.description = operation.description;
118 this.inputParams = operation.inputParams;
119 this.operationType = operation.operationType;
120 this.outputParams = operation.outputParams;
121 this.uniqueId = operation.uniqueId;
122 this.workflowId = operation.workflowId;
123 this.workflowVersionId = operation.workflowVersionId;
124 this.artifactFileName = operation.artifactFileName;
125 this.artifactData = operation.artifactData;
126 this.workflowName = operation.workflowName;
127 this.workflowVersion = operation.workflowVersion;
131 public displayType(): string {
132 return displayType(this.interfaceType);
135 public createInputParamsList(inputParams: Array<OperationParameter>): void {
137 listToscaDataDefinition: inputParams
141 public createOutputParamsList(outputParams: Array<OperationParameter>): void {
142 this.outputParams = {
143 listToscaDataDefinition: outputParams
148 export interface CreateOperationResponse extends OperationModel {
149 artifactUUID: string;
152 export class InterfaceModel {
155 operations: Array<OperationModel>;
157 constructor(interf?: any) {
159 this.type = interf.type;
160 this.uniqueId = interf.uniqueId;
161 this.operations = interf.operations;
165 public displayType(): string {
166 return displayType(this.type);
170 const displayType = (type:string) => type && type.substr(type.lastIndexOf('.') + 1);