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=========================================================
21 import { CapabilitiesGroup, RequirementsGroup } from 'app/models';
22 import { ComponentType } from 'app/utils';
23 import { IMainCategory } from './category';
25 * Created by obarda on 4/18/2017.
27 export interface IComponentMetadata {
32 invariantUUID: string;
36 lastUpdateDate: number;
38 lifecycleState: string;
43 creatorUserId: string;
44 creatorFullName: string;
45 lastUpdaterUserId: string;
46 lastUpdaterFullName: string;
47 componentType: string;
48 categories: IMainCategory[];
49 highestVersion: boolean;
50 normalizedName: string;
54 selectedCategory: string;
61 derivedList: string[];
63 vendorRelease: string;
64 derivedFrom: string[];
65 resourceVendorModelNumber: string;
66 csarPackageType: string;
71 serviceFunction: string;
72 distributionStatus: string;
73 ecompGeneratedNaming: boolean;
77 environmentContext: string;
78 instantiationType: string;
80 // backend lifecycleState
83 capabilities: CapabilitiesGroup;
84 requirements: RequirementsGroup;
88 export class ComponentMetadata implements IComponentMetadata {
90 public abstract: string;
91 public uniqueId: string;
93 public invariantUUID: string;
95 public version: string;
96 public creationDate: number;
97 public lastUpdateDate: number;
98 public description: string;
99 public lifecycleState: string;
100 public tags: string[];
102 public contactId: string;
103 public allVersions: any;
104 public creatorUserId: string;
105 public creatorFullName: string;
106 public lastUpdaterUserId: string;
107 public lastUpdaterFullName: string;
108 public componentType: string;
109 public categories: IMainCategory[];
110 public highestVersion: boolean;
111 public normalizedName: string;
112 public systemName: string;
113 public archived: boolean;
114 public vspArchived: boolean;
115 public toscaResourceName: string;
116 public selectedCategory: string;
117 public filterTerm: string;
120 public resourceType: string;
121 public csarUUID: string;
122 public csarVersion: string;
123 public derivedList: string[];
124 public vendorName: string;
125 public vendorRelease: string;
126 public derivedFrom: string[];
127 public resourceVendorModelNumber: string;
128 public csarPackageType: string;
129 public packageId: string;
130 public iconSprite: string;
133 public serviceFunction: string;
134 public distributionStatus: string;
135 public ecompGeneratedNaming: boolean;
136 public namingPolicy: string;
137 public serviceType: string;
138 public serviceRole: string;
139 public environmentContext: string;
140 public instantiationType: string;
142 // backend lifecycleState
143 public state: string;
149 deserialize(response): ComponentMetadata {
150 this.abstract = response.abstract;
151 this.uniqueId = response.uniqueId;
152 this.uuid = response.uuid;
153 this.invariantUUID = response.invariantUUID;
154 this.contactId = response.contactId;
155 this.categories = response.categories;
156 this.creatorUserId = response.creatorUserId;
157 this.creationDate = response.creationDate;
158 this.creatorFullName = response.creatorFullName;
159 this.description = response.description;
160 this.icon = response.icon;
161 this.lastUpdateDate = response.lastUpdateDate;
162 this.lastUpdaterUserId = response.lastUpdaterUserId;
163 this.lastUpdaterFullName = response.lastUpdaterFullName;
164 this.lifecycleState = response.lifecycleState;
165 this.name = response.name;
166 this.version = response.version;
167 this.tags = angular.copy(response.tags, this.tags);
168 this.allVersions = response.allVersions;
169 this.componentType = response.componentType;
170 this.distributionStatus = response.distributionStatus;
171 this.highestVersion = response.highestVersion;
172 this.vendorName = response.vendorName;
173 this.vendorRelease = response.vendorRelease;
174 this.derivedList = response.derivedList;
175 this.normalizedName = response.normalizedName;
176 this.systemName = response.systemName;
177 this.serviceFunction = response.serviceFunction;
178 this.resourceType = response.resourceType;
179 this.csarUUID = response.csarUUID;
180 this.csarVersion = response.csarVersion;
181 this.state = response.state;
182 this.ecompGeneratedNaming = response.ecompGeneratedNaming;
183 this.namingPolicy = response.namingPolicy;
184 this.derivedFrom = response.derivedFrom;
185 this.resourceVendorModelNumber = response.resourceVendorModelNumber;
186 this.serviceType = response.serviceType;
187 this.serviceRole = response.serviceRole;
188 this.environmentContext = response.environmentContext;
189 this.archived = response.archived;
190 this.instantiationType = response.instantiationType;
191 this.vspArchived = response.vspArchived;
192 this.toscaResourceName = response.toscaResourceName;
193 this.capabilities = response.capabilities;
194 this.requirements = response.requirements;
198 public isService = (): boolean => {
199 return this.componentType === ComponentType.SERVICE;
202 public getTypeUrl(): string {
203 return this.componentType === ComponentType.RESOURCE ? 'resources/' : 'services/';