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;
106 protected OperationTypeEnum: Array<String> = [
114 constructor(operation?: any) {
117 this.interfaceId = operation.interfaceId;
118 this.interfaceType = operation.interfaceType;
119 this.description = operation.description;
120 this.inputParams = operation.inputParams;
121 this.operationType = operation.operationType;
122 this.outputParams = operation.outputParams;
123 this.uniqueId = operation.uniqueId;
124 this.workflowId = operation.workflowId;
125 this.workflowVersionId = operation.workflowVersionId;
126 this.artifactFileName = operation.artifactFileName;
127 this.artifactData = operation.artifactData;
128 this.workflowName = operation.workflowName;
129 this.workflowVersion = operation.workflowVersion;
130 this.milestones = operation.milestones;
134 public displayType(): string {
135 return displayType(this.interfaceType);
138 public createInputParamsList(inputParams: Array<OperationParameter>): void {
140 listToscaDataDefinition: inputParams
144 public createOutputParamsList(outputParams: Array<OperationParameter>): void {
145 this.outputParams = {
146 listToscaDataDefinition: outputParams
151 export interface CreateOperationResponse extends OperationModel {
152 artifactUUID: string;
155 export class InterfaceModel {
158 operations: Array<OperationModel>;
160 constructor(interf?: any) {
162 this.type = interf.type;
163 this.uniqueId = interf.uniqueId;
164 this.operations = interf.operations;
168 public displayType(): string {
169 return displayType(this.type);
173 const displayType = (type:string) => type && type.substr(type.lastIndexOf('.') + 1);