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 InputValueData extends GraphNode {
33 private String uniqueId;
39 private Boolean hidden;
41 private Long creationTime;
43 private Long modificationTime;
45 public InputValueData() {
46 super(NodeTypeEnum.InputValue);
49 public InputValueData(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()));
72 public String getUniqueId() {
76 public void setUniqueId(String uniqueId) {
77 this.uniqueId = uniqueId;
80 public Long getCreationTime() {
84 public void setCreationTime(Long creationTime) {
85 this.creationTime = creationTime;
88 public Long getModificationTime() {
89 return modificationTime;
92 public void setModificationTime(Long modificationTime) {
93 this.modificationTime = modificationTime;
97 public Map<String, Object> toGraphMap() {
99 Map<String, Object> map = new HashMap<String, Object>();
101 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
103 addIfExists(map, GraphPropertiesDictionary.TYPE, type);
105 addIfExists(map, GraphPropertiesDictionary.HIDDEN, hidden);
107 addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime);
109 addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime);
111 String updatedValue = Objects.isNull(value) ? Constants.GRAPH_EMPTY_VALUE : value;
112 addIfExists(map, GraphPropertiesDictionary.VALUE, updatedValue);
117 public String toString() {
118 return "InputValueData [uniqueId=" + uniqueId + ", hidden=" + hidden + ", type=" + type + ", creationTime="
119 + creationTime + ", value=" + value + ", modificationTime=" + modificationTime + "]";
122 public Boolean isHidden() {
126 public void setHidden(Boolean hidden) {
127 this.hidden = hidden;
130 public String getType() {
134 public void setType(String type) {
138 public String getValue() {
142 public void setValue(String value) {