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.datatypes.enums.NodeTypeEnum;
27 import java.util.HashMap;
30 public class RelationshipInstData extends GraphNode {
34 private String uniqueId;
36 private Long creationTime;
38 private Long modificationTime;
40 private String capabilityOwnerId;
41 private String requirementOwnerId;
42 private String capabiltyId;
43 private String requirementId;
45 public RelationshipInstData() {
46 super(NodeTypeEnum.RelationshipInst);
49 public RelationshipInstData(Map<String, Object> properties) {
53 this.setType((String) properties.get(GraphPropertiesDictionary.TYPE.getProperty()));
55 this.setUniqueId((String) properties.get(GraphPropertiesDictionary.UNIQUE_ID.getProperty()));
57 this.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
59 this.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
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()));
70 public Map<String, Object> toGraphMap() {
72 Map<String, Object> map = new HashMap<>();
74 addIfExists(map, GraphPropertiesDictionary.UNIQUE_ID, uniqueId);
76 addIfExists(map, GraphPropertiesDictionary.TYPE, type);
78 addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, creationTime);
80 addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, modificationTime);
81 addIfExists(map, GraphPropertiesDictionary.CAPABILITY_OWNER_ID, capabilityOwnerId);
82 addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_OWNER_ID, requirementOwnerId);
84 addIfExists(map, GraphPropertiesDictionary.REQUIREMENT_ID, requirementId);
86 addIfExists(map, GraphPropertiesDictionary.CAPABILITY_ID, capabiltyId);
91 public Long getCreationTime() {
95 public void setCreationTime(Long creationTime) {
96 this.creationTime = creationTime;
99 public Long getModificationTime() {
100 return modificationTime;
103 public void setModificationTime(Long modificationTime) {
104 this.modificationTime = modificationTime;
107 public void setUniqueId(String uniqueId) {
108 this.uniqueId = uniqueId;
112 public String getUniqueId() {
116 public String getType() {
120 public void setType(String type) {
124 public String getCapabilityOwnerId() {
125 return capabilityOwnerId;
128 public void setCapabilityOwnerId(String capabilityOwnerId) {
129 this.capabilityOwnerId = capabilityOwnerId;
132 public String getRequirementOwnerId() {
133 return requirementOwnerId;
136 public void setRequirementOwnerId(String requirementOwnerId) {
137 this.requirementOwnerId = requirementOwnerId;
140 public String getCapabiltyId() {
144 public void setCapabiltyId(String capabiltyId) {
145 this.capabiltyId = capabiltyId;
148 public String getRequirementId() {
149 return requirementId;
152 public void setRequirementId(String requirementId) {
153 this.requirementId = requirementId;
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 + "]";