2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
22 * Created by ob0695 on 4/18/2017.
25 import { ArtifactGroupModel, PropertyModel, PropertiesGroup, AttributeModel, AttributesGroup, ComponentInstance, OperationModel,
26 InputBEModel, Module, ComponentMetadata, RelationshipModel, RequirementsGroup, CapabilitiesGroup} from "app/models";
27 import {CommonUtils} from "app/utils";
28 import {Serializable} from "../utils/serializable";
29 import { PolicyInstance } from "app/models/graph/zones/policy-instance";
30 import { GroupInstance } from "../../../models/graph/zones/group-instance";
31 import { InputsGroup } from "../../../models/inputs";
32 import { InterfaceModel } from "../../../models/operation";
33 import { OutputBEModel } from "app/models/attributes-outputs/output-be-model";
34 import {Model} from "../../../models/model";
36 export class ComponentGenericResponse implements Serializable<ComponentGenericResponse> {
38 public metadata: ComponentMetadata;
39 public deploymentArtifacts:ArtifactGroupModel;
40 public artifacts:ArtifactGroupModel;
41 public toscaArtifacts:ArtifactGroupModel;
42 public componentInstancesProperties:PropertiesGroup;
43 public componentInstancesInputs:InputsGroup;
44 public componentInstancesAttributes:AttributesGroup;
45 public componentInstancesRelations:Array<RelationshipModel>;
46 public componentInstances:Array<ComponentInstance>;
47 public componentInstancesInterfaces: Map<string, Array<InterfaceModel>>;
48 public inputs:Array<InputBEModel>;
49 public outputs:Array<OutputBEModel>;
50 public capabilities:CapabilitiesGroup;
51 public requirements:RequirementsGroup;
52 public properties:Array<PropertyModel>;
53 public attributes:Array<AttributeModel>;
54 public policies:Array<PolicyInstance>;
55 public groupInstances: Array<GroupInstance>;
56 public modules:Array<Module>;
57 public interfaces:any;
58 public interfaceOperations:Array<OperationModel>;
59 public additionalInformation:any;
60 public derivedList:Array<any>;
61 public nodeFilterforNode: Array<any>;
62 public substitutionFilters: any;
63 public derivedFromGenericType;
64 public derivedFromGenericVersion;
67 deserialize (response): ComponentGenericResponse {
69 if(response.componentInstancesProperties) {
70 this.componentInstancesProperties = new PropertiesGroup(response.componentInstancesProperties);
72 if(response.componentInstancesInputs) {
73 this.componentInstancesInputs = response.componentInstancesInputs;
75 if(response.componentInstancesAttributes) {
76 this.componentInstancesAttributes = new AttributesGroup(response.componentInstancesAttributes);
78 if(response.componentInstances) {
79 this.componentInstances = CommonUtils.initComponentInstances(response.componentInstances);
81 if(response.componentInstancesRelations) {
82 this.componentInstancesRelations = CommonUtils.initComponentInstanceRelations(response.componentInstancesRelations);
84 if(response.deploymentArtifacts) {
85 this.deploymentArtifacts = new ArtifactGroupModel(response.deploymentArtifacts);
88 this.inputs = CommonUtils.initInputs(response.inputs);
90 if (response.outputs) {
91 this.outputs = CommonUtils.initOutputs(response.outputs);
93 if(response.attributes) {
94 this.attributes = CommonUtils.initAttributes(response.attributes);
96 if(response.artifacts) {
97 this.artifacts = new ArtifactGroupModel(response.artifacts);
99 if(response.properties) {
100 this.properties = CommonUtils.initProperties(response.properties);
102 if(response.capabilities) {
103 this.capabilities = new CapabilitiesGroup(response.capabilities);
105 if(response.requirements) {
106 this.requirements = new RequirementsGroup(response.requirements);
108 if(response.toscaArtifacts) {
109 this.toscaArtifacts = new ArtifactGroupModel(response.toscaArtifacts);
111 if(response.interfaces) {
112 this.interfaces = CommonUtils.initInterfaces(response.interfaces);
113 this.interfaceOperations = CommonUtils.initInterfaceOperations(response.interfaces);
115 if (response.componentInstancesInterfaces) {
116 this.componentInstancesInterfaces = new Map();
117 for (let resourceId in response.componentInstancesInterfaces) {
118 this.componentInstancesInterfaces[resourceId] = CommonUtils.initInterfaces(response.componentInstancesInterfaces[resourceId]);
121 if(response.metadata) {
122 this.metadata = new ComponentMetadata().deserialize(response.metadata);
124 if(response.groups) {
125 this.modules = CommonUtils.initModules(response.groups);
126 this.groupInstances = CommonUtils.initGroups(response.groups)
128 if(response.policies) {
129 this.policies = CommonUtils.initPolicies(response.policies);
131 if(response.nodeFilterforNode) {
132 this.nodeFilterforNode = response.nodeFilterforNode;
134 if(response.substitutionFilters) {
135 this.substitutionFilters = response.substitutionFilters;
137 if(response.derivedFromGenericType) {
138 this.derivedFromGenericType = response.derivedFromGenericType;
140 if(response.derivedFromGenericVersion) {
141 this.derivedFromGenericVersion = response.derivedFromGenericVersion;
144 this.model = response.model;