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 package org.openecomp.sdc.be.resources.data;
23 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
24 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor;
25 import org.openecomp.sdc.be.datatypes.components.ComponentMetadataDataDefinition;
26 import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
27 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
28 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
32 public class ResourceMetadataData extends ComponentMetadataData {
34 public ResourceMetadataData() {
35 super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition());
38 public ResourceMetadataData(ComponentMetadataDataDefinition metadataDataDefinition) {
39 super(NodeTypeEnum.Resource, metadataDataDefinition);
42 public ResourceMetadataData(GraphPropertiesDictionaryExtractor extractor) {
43 super(NodeTypeEnum.Resource, new ResourceMetadataDataDefinition(), extractor);
44 ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorName(extractor.getVendorName());
45 ((ResourceMetadataDataDefinition) metadataDataDefinition).setVendorRelease(extractor.getVendorRelease());
46 ((ResourceMetadataDataDefinition) metadataDataDefinition).setResourceType(extractor.getResourceType());
47 ((ResourceMetadataDataDefinition) metadataDataDefinition).setAbstract(extractor.isAbstract());
48 ((ResourceMetadataDataDefinition) metadataDataDefinition).setCost(extractor.getCost());
49 ((ResourceMetadataDataDefinition) metadataDataDefinition).setLicenseType(extractor.getLicenseType());
50 ((ResourceMetadataDataDefinition) metadataDataDefinition).setToscaResourceName(extractor.getToscaResourceName());
54 public Map<String, Object> toGraphMap() {
55 Map<String, Object> graphMap = super.toGraphMap();
56 addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorName());
57 addIfExists(graphMap, GraphPropertiesDictionary.VENDOR_RELEASE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getVendorRelease());
58 addIfExists(graphMap, GraphPropertiesDictionary.RESOURCE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getResourceType().name());
59 addIfExists(graphMap, GraphPropertiesDictionary.IS_ABSTRACT, ((ResourceMetadataDataDefinition) metadataDataDefinition).isAbstract());
60 addIfExists(graphMap, GraphPropertiesDictionary.COST, ((ResourceMetadataDataDefinition) metadataDataDefinition).getCost());
61 addIfExists(graphMap, GraphPropertiesDictionary.LICENSE_TYPE, ((ResourceMetadataDataDefinition) metadataDataDefinition).getLicenseType());
62 addIfExists(graphMap, GraphPropertiesDictionary.TOSCA_RESOURCE_NAME, ((ResourceMetadataDataDefinition) metadataDataDefinition).getToscaResourceName());