re base 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     public archived:boolean;
51     public vspArchived: boolean;
52
53     //Resource only
54     public resourceType: string;
55     public csarUUID:string;
56     public csarVersion:string;
57     public derivedList: string[];
58     public vendorName:string;
59     public vendorRelease:string;
60     public derivedFrom: Array<string>;
61     public resourceVendorModelNumber:string;
62
63     //Service only
64     public projectCode:string;
65     public distributionStatus:string;
66     public ecompGeneratedNaming: boolean;
67     public namingPolicy: string;
68     public serviceType:string;
69     public serviceRole:string;
70     public environmentContext:string;
71     public instantiationType:string;
72
73
74
75         //backend lifecycleState
76     public state:string;
77
78     deserialize (response): ComponentMetadata {
79         this.abstract = response.abstract;
80         this.uniqueId = response.uniqueId;
81         this.uuid = response.uuid;
82         this.invariantUUID = response.invariantUUID;
83         this.contactId = response.contactId;
84         this.categories = response.categories;
85         this.creatorUserId = response.creatorUserId;
86         this.creationDate = response.creationDate;
87         this.creatorFullName = response.creatorFullName;
88         this.description = response.description;
89         this.icon = response.icon;
90         this.lastUpdateDate = response.lastUpdateDate;
91         this.lastUpdaterUserId = response.lastUpdaterUserId;
92         this.lastUpdaterFullName = response.lastUpdaterFullName;
93         this.lifecycleState = response.lifecycleState;
94         this.name = response.name;
95         this.version = response.version;
96         this.tags = angular.copy(response.tags, this.tags);
97         this.allVersions = response.allVersions;
98         this.componentType = response.componentType;
99         this.distributionStatus = response.distributionStatus;
100         this.highestVersion = response.highestVersion;
101         this.vendorName = response.vendorName;
102         this.vendorRelease = response.vendorRelease;
103         this.derivedList = response.derivedList;
104         this.normalizedName = response.normalizedName;
105         this.systemName = response.systemName;
106         this.projectCode = response.projectCode;
107         this.resourceType = response.resourceType;
108         this.csarUUID = response.csarUUID;
109         this.csarVersion = response.csarVersion;
110         this.state = response.state;
111         this.ecompGeneratedNaming = response.ecompGeneratedNaming;
112         this.namingPolicy = response.namingPolicy;
113         this.derivedFrom = response.derivedFrom;
114         this.resourceVendorModelNumber = response.resourceVendorModelNumber;
115         this.serviceType = response.serviceType;
116         this.serviceRole = response.serviceRole;
117         this.environmentContext = response.environmentContext;
118         this.archived = response.archived;
119         this.instantiationType = response.instantiationType;
120         this.vspArchived = response.vspArchived;
121         return this;
122     }
123
124 }