re base code
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / resources / data / RelationshipInstData.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 RelationshipInstData extends GraphNode {
31
32         private String type;
33
34         private String uniqueId;
35
36         private Long creationTime;
37
38         private Long modificationTime;
39
40         private String capabilityOwnerId;
41         private String requirementOwnerId;
42         private String capabiltyId;
43         private String requirementId;
44
45         public RelationshipInstData() {
46                 super(NodeTypeEnum.RelationshipInst);
47         }
48
49         public RelationshipInstData(Map<String, Object> properties) {
50
51                 this();
52
53                 this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()));
54
55                 this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
56
57                 this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
58
59                 this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
60
61                 this.setCapabilityOwnerId((String) properties.get(GraphPropertiesDictionary.CAPABILITY_OWNER_ID.getProperty()));
62                 this.setRequirementOwnerId(
63                                 (String) properties.get(GraphPropertiesDictionary.REQUIREMENT_OWNER_ID.getProperty()));
64                 this.setRequirementId((String) properties.get(GraphPropertiesDictionary.REQUIREMENT_ID.getProperty()));
65                 this.setCapabiltyId((String) properties.get(GraphPropertiesDictionary.CAPABILITY_ID.getProperty()));
66
67         }
68
69         @Override
70         public Map<String, Object> toGraphMap() {
71
72                 Map<String, Object> map = new HashMap<>();
73
74                 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
75
76                 addIfExists(map, GraphPropertiesDictionary.TYPE, type);
77
78                 addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime);
79
80                 addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime);
81                 addIfExists(map, GraphPropertiesDictionary.CAPABILITY_OWNER_ID, capabilityOwnerId);
82                 addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_OWNER_ID, requirementOwnerId);
83
84                 addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_ID, requirementId);
85
86                 addIfExists(map, GraphPropertiesDictionary.CAPABILITY_ID, capabiltyId);
87
88                 return map;
89         }
90
91         public Long getCreationTime() {
92                 return creationTime;
93         }
94
95         public void setCreationTime(Long creationTime) {
96                 this.creationTime = creationTime;
97         }
98
99         public Long getModificationTime() {
100                 return modificationTime;
101         }
102
103         public void setModificationTime(Long modificationTime) {
104                 this.modificationTime = modificationTime;
105         }
106
107         public void setUniqueId(String uniqueId) {
108                 this.uniqueId = uniqueId;
109         }
110
111         @Override
112         public String getUniqueId() {
113                 return uniqueId;
114         }
115
116         public String getType() {
117                 return type;
118         }
119
120         public void setType(String type) {
121                 this.type = type;
122         }
123
124         public String getCapabilityOwnerId() {
125                 return capabilityOwnerId;
126         }
127
128         public void setCapabilityOwnerId(String capabilityOwnerId) {
129                 this.capabilityOwnerId = capabilityOwnerId;
130         }
131
132         public String getRequirementOwnerId() {
133                 return requirementOwnerId;
134         }
135
136         public void setRequirementOwnerId(String requirementOwnerId) {
137                 this.requirementOwnerId = requirementOwnerId;
138         }
139
140         public String getCapabiltyId() {
141                 return capabiltyId;
142         }
143
144         public void setCapabiltyId(String capabiltyId) {
145                 this.capabiltyId = capabiltyId;
146         }
147
148         public String getRequirementId() {
149                 return requirementId;
150         }
151
152         public void setRequirementId(String requirementId) {
153                 this.requirementId = requirementId;
154         }
155
156         @Override
157         public String toString() {
158                 return "RelationshipInstData [type=" + type + ", uniqueId=" + uniqueId + ", creationTime=" + creationTime
159                                 + ", modificationTime=" + modificationTime + ", capabilityOwnerId=" + capabilityOwnerId
160                                 + ", requirementOwnerId=" + requirementOwnerId + ", capabiltyId=" + capabiltyId + ", requirementId="
161                                 + requirementId + "]";
162         }
163
164 }