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.graph.datatype.GraphNode;
24 import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
25 import org.openecomp.sdc.be.dao.utils.Constants;
26 import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
28 import java.util.HashMap;
30 import java.util.Objects;
32 public class AttributeValueData extends GraphNode {
33 private String uniqueId;
39 private Boolean hidden;
41 private Long creationTime;
43 private Long modificationTime;
45 public AttributeValueData() {
46 super(NodeTypeEnum.AttributeValue);
49 public AttributeValueData(Map<String, Object> properties) {
52 this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()));
54 String updatedValue = (String) properties.get(GraphPropertiesDictionary.VALUE.getProperty());
55 if (Constants.GRAPH_EMPTY_VALUE.equals(updatedValue)) {
58 this.setValue(updatedValue);
61 this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
63 this.setHidden((Boolean) properties.get(GraphPropertiesDictionary.HIDDEN.getProperty()));
65 this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
67 this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
71 public String getUniqueId() {
75 public void setUniqueId(String uniqueId) {
76 this.uniqueId = uniqueId;
79 public Long getCreationTime() {
83 public void setCreationTime(Long creationTime) {
84 this.creationTime = creationTime;
87 public Long getModificationTime() {
88 return modificationTime;
91 public void setModificationTime(Long modificationTime) {
92 this.modificationTime = modificationTime;
96 public Map<String, Object> toGraphMap() {
98 Map<String, Object> map = new HashMap<>();
100 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
102 addIfExists(map, GraphPropertiesDictionary.TYPE, type);
104 addIfExists(map, GraphPropertiesDictionary.HIDDEN, hidden);
106 addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime);
108 addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime);
110 String updatedValue = Objects.isNull(value) ? Constants.GRAPH_EMPTY_VALUE : value;
111 addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue);
116 public String toString() {
117 return "AttributeValueData [uniqueId=" + uniqueId + ", hidden=" + hidden + ", type=" + type + ", creationTime="
118 + creationTime + ", value=" + value + ", modificationTime=" + modificationTime + "]";
121 public Boolean isHidden() {
125 public void setHidden(Boolean hidden) {
126 this.hidden = hidden;
129 public String getType() {
133 public void setType(String type) {
137 public String getValue() {
141 public void setValue(String value) {