3 * ============LICENSE_START=======================================================
4 * Copyright (C) 2022 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
24 import {DataTypeModel} from "./data-types";
25 import {Icon, ToscaType} from "../utils/constants";
26 import {Service} from "./components/service";
27 import {Resource} from "./components/resource";
28 import {Model} from "./model";
30 export class DataTypeCatalogComponent {
33 public uniqueId:string;
35 public version:string;
37 public componentType:string;
39 public iconSprite:string;
40 public lastUpdateDate:string;
41 public filterTerm:string;
43 constructor(dataTypeCatalogComponent?: DataTypeModel) {
44 this.name = dataTypeCatalogComponent.name;
45 this.uniqueId = dataTypeCatalogComponent.uniqueId;
46 if (dataTypeCatalogComponent.model) {
47 this.model = dataTypeCatalogComponent.model;
49 this.model = undefined;
51 this.componentType = ToscaType.DATATYPE;
52 this.icon = Icon.DATATYPE_ICON;
53 this.iconSprite = 'sprite-resource-icons';
54 this.lastUpdateDate = dataTypeCatalogComponent.creationTime;
55 this.filterTerm = dataTypeCatalogComponent.name;
58 public isService = ():boolean => {
59 return this instanceof Service;
62 public isResource = ():boolean => {
63 return this instanceof Resource;
66 public getComponentSubType= ():string => {
67 return this.componentType;