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 {PropertyBEModel} from "../../../models/properties-inputs/property-be-model";
30 import { PolicyInstance } from "app/models/graph/zones/policy-instance";
31 import { GroupInstance } from "../../../models/graph/zones/group-instance";
32 import { InputsGroup } from "../../../models/inputs";
33 import { InterfaceModel } from "../../../models/operation";
35 export class ComponentGenericResponse implements Serializable<ComponentGenericResponse> {
37 public metadata: ComponentMetadata;
38 public deploymentArtifacts:ArtifactGroupModel;
39 public artifacts:ArtifactGroupModel;
40 public toscaArtifacts:ArtifactGroupModel;
41 public componentInstancesProperties:PropertiesGroup;
42 public componentInstancesInputs:InputsGroup;
43 public componentInstancesAttributes:AttributesGroup;
44 public componentInstancesRelations:Array<RelationshipModel>;
45 public componentInstances:Array<ComponentInstance>;
46 public componentInstancesInterfaces: Map<string, Array<InterfaceModel>>;
47 public inputs:Array<InputBEModel>;
48 public capabilities:CapabilitiesGroup;
49 public requirements:RequirementsGroup;
50 public properties:Array<PropertyModel>;
51 public attributes:Array<AttributeModel>;
52 public policies:Array<PolicyInstance>;
53 public groupInstances: Array<GroupInstance>;
54 public modules:Array<Module>;
55 public interfaces:any;
56 public interfaceOperations:Array<OperationModel>;
57 public additionalInformation:any;
58 public derivedList:Array<any>;
59 public nodeFilterData: Array<any>;
61 deserialize (response): ComponentGenericResponse {
63 if(response.componentInstancesProperties) {
64 this.componentInstancesProperties = new PropertiesGroup(response.componentInstancesProperties);
66 if(response.componentInstancesInputs) {
67 this.componentInstancesInputs = response.componentInstancesInputs;
69 if(response.componentInstancesAttributes) {
70 this.componentInstancesAttributes = new AttributesGroup(response.componentInstancesAttributes);
72 if(response.componentInstances) {
73 this.componentInstances = CommonUtils.initComponentInstances(response.componentInstances);
75 if(response.componentInstancesRelations) {
76 this.componentInstancesRelations = CommonUtils.initComponentInstanceRelations(response.componentInstancesRelations);
78 if(response.deploymentArtifacts) {
79 this.deploymentArtifacts = new ArtifactGroupModel(response.deploymentArtifacts);
82 this.inputs = CommonUtils.initInputs(response.inputs);
84 if(response.attributes) {
85 this.attributes = CommonUtils.initAttributes(response.attributes);
87 if(response.artifacts) {
88 this.artifacts = new ArtifactGroupModel(response.artifacts);
90 if(response.properties) {
91 this.properties = CommonUtils.initProperties(response.properties);
93 if(response.capabilities) {
94 this.capabilities = new CapabilitiesGroup(response.capabilities);
96 if(response.requirements) {
97 this.requirements = new RequirementsGroup(response.requirements);
99 if(response.toscaArtifacts) {
100 this.toscaArtifacts = new ArtifactGroupModel(response.toscaArtifacts);
102 if(response.interfaces) {
103 this.interfaceOperations = CommonUtils.initInterfaceOperations(response.interfaces);
105 if (response.componentInstancesInterfaces) {
106 this.componentInstancesInterfaces = new Map();
107 for (let resourceId in response.componentInstancesInterfaces) {
108 this.componentInstancesInterfaces[resourceId] = CommonUtils.initInterfaces(response.componentInstancesInterfaces[resourceId]);
111 if(response.metadata) {
112 this.metadata = new ComponentMetadata().deserialize(response.metadata);
114 if(response.groups) {
115 this.modules = CommonUtils.initModules(response.groups);
116 this.groupInstances = CommonUtils.initGroups(response.groups)
118 if(response.policies) {
119 this.policies = CommonUtils.initPolicies(response.policies);
121 if(response.nodeFilterData) {
122 this.nodeFilterData = response.nodeFilterData;