2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 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.datatypes.elements;
23 import com.fasterxml.jackson.annotation.JsonCreator;
24 import com.google.common.base.MoreObjects;
25 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
26 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
28 import java.util.Objects;
30 public class ForwardingPathElementDataDefinition extends ToscaDataDefinition {
32 public ForwardingPathElementDataDefinition() {
36 public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName , String fromCPOriginId, String toCPOriginId) {
38 setFromNode(fromNode);
40 setFromCP(fromCPName);
42 setFromCPOriginId(fromCPOriginId);
43 setToCPOriginId(toCPOriginId);
46 public ForwardingPathElementDataDefinition(ForwardingPathElementDataDefinition pathElement) {
48 setFromNode(pathElement.getFromNode());
49 setToNode(pathElement.getToNode());
50 setFromCP(pathElement.getFromCP());
51 setToCP(pathElement.getToCP());
52 setFromCPOriginId(pathElement.getFromCPOriginId());
53 setToCPOriginId(pathElement.getToCPOriginId());
56 public String getFromNode() {
57 return (String) getToscaPresentationValue(JsonPresentationFields.FROM_NODE);
60 public void setFromNode(String fromNode) {
61 setToscaPresentationValue(JsonPresentationFields.FROM_NODE, fromNode);
64 public String getToNode() {
65 return (String) getToscaPresentationValue(JsonPresentationFields.TO_NODE);
68 public void setToNode(String toNode) {
69 setToscaPresentationValue(JsonPresentationFields.TO_NODE, toNode);
72 public String getFromCP() {
73 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP);
76 public void setFromCP(String fromCP) {
77 setToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP, fromCP);
80 public String getToCP() {
81 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_TO_CP);
84 public void setToCP(String toCP) {
85 setToscaPresentationValue(JsonPresentationFields.PATH_TO_CP, toCP);
88 public String getToCPOriginId() {
89 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_TO_CP_ORIGIN);
92 public void setToCPOriginId(String toCPOriginId) {
93 setToscaPresentationValue(JsonPresentationFields.PATH_TO_CP_ORIGIN, toCPOriginId);
96 public String getFromCPOriginId() {
97 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP_ORIGIN);
100 public void setFromCPOriginId(String fromCPOriginId) {
101 setToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP_ORIGIN, fromCPOriginId);
105 public boolean equals(Object o) {
106 if (this == o) return true;
107 if (o == null || getClass() != o.getClass()) return false;
108 ForwardingPathElementDataDefinition that = (ForwardingPathElementDataDefinition) o;
109 return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode())
110 && Objects.equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId());
114 public int hashCode() {
115 return Objects.hash(getFromNode(), getToNode(), getFromCP(),getToCP(), getFromCPOriginId(), getToCPOriginId());
119 public String toString() {
120 return MoreObjects.toStringHelper(this)
121 .add("fromNode", getFromNode()).add("toNode", getToNode())
122 .add("fromCPOriginId", getFromCPOriginId()).add("toCPOriginId", getToCPOriginId())
123 .add("fromCPName", getFromCP()).add("toCPName", getToCP()).toString();