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=========================================================
20 package org.openecomp.sdc.be.resources.data;
22 import java.util.HashMap;
24 import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
25 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
26 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
28 public abstract class CategoryData extends GraphNode {
31 private String normalizedName;
32 private String uniqueId;
34 protected CategoryData(NodeTypeEnum label) {
38 protected CategoryData(String name, String normalizedName, NodeTypeEnum label) {
41 this.normalizedName = normalizedName;
44 protected CategoryData(Map<String, Object> properties, NodeTypeEnum label) {
46 setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty()));
47 setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
48 setNormalizedName((String) properties.get(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty()));
51 protected abstract void createUniqueId();
54 public Map<String, Object> toGraphMap() {
55 Map<String, Object> map = new HashMap<>();
56 addIfExists(map, GraphPropertiesDictionary.NAME, name);
57 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
58 addIfExists(map, GraphPropertiesDictionary.NORMALIZED_NAME, normalizedName);
62 public String getName() {
66 public void setName(String name) {
70 public String getNormalizedName() {
71 return normalizedName;
74 public void setNormalizedName(String normalizedName) {
75 this.normalizedName = normalizedName;
79 public String toString() {
80 return "CategoryData [name=" + name + ", normalizedName=" + normalizedName + "uniqueId=" + uniqueId + "]";
84 public String getUniqueIdKey() {
85 return GraphPropertiesDictionary.UNIQUE_ID.getProperty();
89 public String getUniqueId() {
93 public void setUniqueId(String uniqueId) {
94 this.uniqueId = uniqueId;