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 com.google.gson.reflect.TypeToken;
24 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
25 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionaryExtractor;
26 import org.openecomp.sdc.be.datatypes.elements.ProductMetadataDataDefinition;
27 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
29 import java.lang.reflect.Type;
30 import java.util.List;
33 public class ProductMetadataData extends ComponentMetadataData {
35 public ProductMetadataData() {
36 super(NodeTypeEnum.Product, new ProductMetadataDataDefinition());
39 public ProductMetadataData(ProductMetadataDataDefinition metadataDataDefinition) {
40 super(NodeTypeEnum.Product, metadataDataDefinition);
43 public ProductMetadataData(GraphPropertiesDictionaryExtractor extractor) {
44 super(NodeTypeEnum.Product, new ProductMetadataDataDefinition(), extractor);
45 ((ProductMetadataDataDefinition) metadataDataDefinition).setFullName(extractor.getFullName());
46 ((ProductMetadataDataDefinition) metadataDataDefinition).setContacts(extractor.getContacts());
47 ((ProductMetadataDataDefinition) metadataDataDefinition).setIsActive(extractor.isActive());
51 public String getUniqueIdKey() {
52 return GraphPropertiesDictionary.UNIQUE_ID.getProperty();
56 public Map<String, Object> toGraphMap() {
57 Map<String, Object> graphMap = super.toGraphMap();
58 addIfExists(graphMap, GraphPropertiesDictionary.FULL_NAME,
59 ((ProductMetadataDataDefinition) metadataDataDefinition).getFullName());
60 addIfExists(graphMap, GraphPropertiesDictionary.CONTACTS,
61 ((ProductMetadataDataDefinition) metadataDataDefinition).getContacts());
62 addIfExists(graphMap, GraphPropertiesDictionary.IS_ACTIVE,
63 ((ProductMetadataDataDefinition) metadataDataDefinition).getIsActive());
68 public String toString() {
69 return "ProductMetadataData [metadataDataDefinition=" + metadataDataDefinition + "]";