re base code
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / resources / data / RequirementImplData.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.be.resources.data;
22
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.datatypes.enums.NodeTypeEnum;
26
27 import java.util.HashMap;
28 import java.util.Map;
29
30 public class RequirementImplData extends GraphNode {
31
32         private String name;
33
34         private String uniqueId;
35
36         private Long creationTime;
37
38         private Long modificationTime;
39
40         private String posX;
41
42         private String posY;
43
44         public RequirementImplData() {
45                 super(NodeTypeEnum.RequirementImpl);
46         }
47
48         public RequirementImplData(Map<String, Object> properties) {
49
50                 this();
51
52                 this.setName((String) properties.get(GraphPropertiesDictionary.NAME.getProperty()));
53
54                 this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
55
56                 this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
57
58                 this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
59
60                 setPosX((String) properties.get(GraphPropertiesDictionary.POSITION_X.getProperty()));
61
62                 setPosY((String) properties.get(GraphPropertiesDictionary.POSITION_Y.getProperty()));
63
64         }
65
66         @Override
67         public Map<String, Object> toGraphMap() {
68
69                 Map<String, Object> map = new HashMap<>();
70
71                 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
72
73                 addIfExists(map, GraphPropertiesDictionary.NAME, name);
74
75                 addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime);
76
77                 addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime);
78
79                 addIfExists(map, GraphPropertiesDictionary.POSITION_X, posX);
80
81                 addIfExists(map, GraphPropertiesDictionary.POSITION_Y, posY);
82
83                 return map;
84         }
85
86         public Long getCreationTime() {
87                 return creationTime;
88         }
89
90         public void setCreationTime(Long creationTime) {
91                 this.creationTime = creationTime;
92         }
93
94         public Long getModificationTime() {
95                 return modificationTime;
96         }
97
98         public void setModificationTime(Long modificationTime) {
99                 this.modificationTime = modificationTime;
100         }
101
102         public void setUniqueId(String uniqueId) {
103                 this.uniqueId = uniqueId;
104         }
105
106         @Override
107         public String getUniqueId() {
108                 return uniqueId;
109         }
110
111         public String getName() {
112                 return name;
113         }
114
115         public void setName(String name) {
116                 this.name = name;
117         }
118
119         public String getPosX() {
120                 return posX;
121         }
122
123         public void setPosX(String posX) {
124                 this.posX = posX;
125         }
126
127         public String getPosY() {
128                 return posY;
129         }
130
131         public void setPosY(String posY) {
132                 this.posY = posY;
133         }
134
135         @Override
136         public String toString() {
137                 return "RequirementImplData [name=" + name + ", uniqueId=" + uniqueId + ", creationTime=" + creationTime
138                                 + ", modificationTime=" + modificationTime + ", posX=" + posX + ", posY=" + posY + "]";
139         }
140
141 }