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,
26 InputBEModel, Module, ComponentMetadata, RelationshipModel, RequirementsGroup, CapabilitiesGroup,InputFEModel} 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";
32 export class ComponentGenericResponse implements Serializable<ComponentGenericResponse> {
34 public metadata: ComponentMetadata;
35 public deploymentArtifacts:ArtifactGroupModel;
36 public artifacts:ArtifactGroupModel;
37 public toscaArtifacts:ArtifactGroupModel;
38 public componentInstancesProperties:PropertiesGroup;
39 public componentInstancesAttributes:AttributesGroup;
40 public componentInstancesRelations:Array<RelationshipModel>;
41 public componentInstances:Array<ComponentInstance>;
42 public inputs:Array<InputBEModel>;
43 public capabilities:CapabilitiesGroup;
44 public requirements:RequirementsGroup;
45 public properties:Array<PropertyModel>;
46 public attributes:Array<AttributeModel>;
47 public policies:Array<PolicyInstance>;
48 public groups:Array<Module>;
49 public interfaces:any;
50 public additionalInformation:any;
51 public derivedList:Array<any>;
53 deserialize (response): ComponentGenericResponse {
55 if(response.componentInstancesProperties) {
56 this.componentInstancesProperties = new PropertiesGroup(response.componentInstancesProperties);
58 if(response.componentInstancesAttributes) {
59 this.componentInstancesAttributes = new AttributesGroup(response.componentInstancesAttributes);
61 if(response.componentInstances) {
62 this.componentInstances = CommonUtils.initComponentInstances(response.componentInstances);
64 if(response.componentInstancesRelations) {
65 this.componentInstancesRelations = CommonUtils.initComponentInstanceRelations(response.componentInstancesRelations);
67 if(response.deploymentArtifacts) {
68 this.deploymentArtifacts = new ArtifactGroupModel(response.deploymentArtifacts);
71 this.inputs = CommonUtils.initInputs(response.inputs);
73 if(response.attributes) {
74 this.attributes = CommonUtils.initAttributes(response.attributes);
76 if(response.artifacts) {
77 this.artifacts = new ArtifactGroupModel(response.artifacts);
79 if(response.properties) {
80 this.properties = CommonUtils.initProperties(response.properties);
82 if(response.capabilities) {
83 this.capabilities = new CapabilitiesGroup(response.capabilities);
85 if(response.requirements) {
86 this.requirements = new RequirementsGroup(response.requirements);
88 if(response.toscaArtifacts) {
89 this.toscaArtifacts = new ArtifactGroupModel(response.toscaArtifacts);
91 if(response.metadata) {
92 this.metadata = new ComponentMetadata().deserialize(response.metadata);
95 this.groups = CommonUtils.initModules(response.groups);
97 if(response.policies) {
98 this.policies = CommonUtils.initPolicies(response.policies);