[SDC] rebase 1710 code
[sdc.git] / catalog-ui / src / app / models / component-metadata.ts
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 import {IMainCategory} from "./category";
22 /**
23  * Created by obarda on 4/18/2017.
24  */
25 export class ComponentMetadata {
26
27     public abstract:string;
28     public uniqueId:string;
29     public uuid:string;
30     public invariantUUID:string;
31     public name:string;
32     public version:string;
33     public creationDate:number;
34     public lastUpdateDate:number;
35     public description:string;
36     public lifecycleState:string;
37     public tags:Array<string>;
38     public icon:string;
39     public contactId:string;
40     public allVersions:any;
41     public creatorUserId:string;
42     public creatorFullName:string;
43     public lastUpdaterUserId:string;
44     public lastUpdaterFullName:string;
45     public componentType:string;
46     public categories:Array<IMainCategory>;
47     public highestVersion:boolean;
48     public normalizedName:string;
49     public systemName:string;
50
51     //Resource only
52     public resourceType: string;
53     public csarUUID:string;
54     public csarVersion:string;
55     public derivedList: string[];
56     public vendorName:string;
57     public vendorRelease:string;
58     public derivedFrom: Array<string>;
59     public resourceVendorModelNumber:string;
60
61     //Service only
62     public projectCode:string;
63     public distributionStatus:string;
64     public ecompGeneratedNaming: boolean;
65     public namingPolicy: string;
66     public serviceType:string;
67     public serviceRole:string;
68
69
70     //backend lifecycleState
71     public state:string;
72
73     deserialize (response): ComponentMetadata {
74         this.abstract = response.abstract;
75         this.uniqueId = response.uniqueId;
76         this.uuid = response.uuid;
77         this.invariantUUID = response.invariantUUID;
78         this.contactId = response.contactId;
79         this.categories = response.categories;
80         this.creatorUserId = response.creatorUserId;
81         this.creationDate = response.creationDate;
82         this.creatorFullName = response.creatorFullName;
83         this.description = response.description;
84         this.icon = response.icon;
85         this.lastUpdateDate = response.lastUpdateDate;
86         this.lastUpdaterUserId = response.lastUpdaterUserId;
87         this.lastUpdaterFullName = response.lastUpdaterFullName;
88         this.lifecycleState = response.lifecycleState;
89         this.name = response.name;
90         this.version = response.version;
91         this.tags = angular.copy(response.tags, this.tags);
92         this.allVersions = response.allVersions;
93         this.componentType = response.componentType;
94         this.distributionStatus = response.distributionStatus;
95         this.highestVersion = response.highestVersion;
96         this.vendorName = response.vendorName;
97         this.vendorRelease = response.vendorRelease;
98         this.derivedList = response.derivedList;
99         this.normalizedName = response.normalizedName;
100         this.systemName = response.systemName;
101         this.projectCode = response.projectCode;
102         this.resourceType = response.resourceType;
103         this.csarUUID = response.csarUUID;
104         this.csarVersion = response.version;
105         this.state = response.state;
106         this.ecompGeneratedNaming = response.ecompGeneratedNaming;
107         this.namingPolicy = response.namingPolicy;
108         this.derivedFrom = response.derivedFrom;
109         this.resourceVendorModelNumber = response.resourceVendorModelNumber;
110         this.serviceType = response.serviceType;
111         this.serviceRole = response.serviceRole;
112         return this;
113     }
114
115 }