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=========================================================
20 package org.openecomp.sdc.be.datatypes.elements;
22 import com.fasterxml.jackson.annotation.JsonCreator;
23 import com.google.common.base.MoreObjects;
24 import java.util.Objects;
25 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
26 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
28 public class ForwardingPathElementDataDefinition extends ToscaDataDefinition {
31 public ForwardingPathElementDataDefinition() {
34 public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName, String fromCPOriginId,
35 String toCPOriginId) {
37 setFromNode(fromNode);
39 setFromCP(fromCPName);
41 setFromCPOriginId(fromCPOriginId);
42 setToCPOriginId(toCPOriginId);
45 public ForwardingPathElementDataDefinition(ForwardingPathElementDataDefinition pathElement) {
47 setFromNode(pathElement.getFromNode());
48 setToNode(pathElement.getToNode());
49 setFromCP(pathElement.getFromCP());
50 setToCP(pathElement.getToCP());
51 setFromCPOriginId(pathElement.getFromCPOriginId());
52 setToCPOriginId(pathElement.getToCPOriginId());
55 public String getFromNode() {
56 return (String) getToscaPresentationValue(JsonPresentationFields.FROM_NODE);
59 public void setFromNode(String fromNode) {
60 setToscaPresentationValue(JsonPresentationFields.FROM_NODE, fromNode);
63 public String getToNode() {
64 return (String) getToscaPresentationValue(JsonPresentationFields.TO_NODE);
67 public void setToNode(String toNode) {
68 setToscaPresentationValue(JsonPresentationFields.TO_NODE, toNode);
71 public String getFromCP() {
72 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP);
75 public void setFromCP(String fromCP) {
76 setToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP, fromCP);
79 public String getToCP() {
80 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_TO_CP);
83 public void setToCP(String toCP) {
84 setToscaPresentationValue(JsonPresentationFields.PATH_TO_CP, toCP);
87 public String getToCPOriginId() {
88 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_TO_CP_ORIGIN);
91 public void setToCPOriginId(String toCPOriginId) {
92 setToscaPresentationValue(JsonPresentationFields.PATH_TO_CP_ORIGIN, toCPOriginId);
95 public String getFromCPOriginId() {
96 return (String) getToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP_ORIGIN);
99 public void setFromCPOriginId(String fromCPOriginId) {
100 setToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP_ORIGIN, fromCPOriginId);
104 public boolean equals(Object o) {
108 if (o == null || getClass() != o.getClass()) {
111 ForwardingPathElementDataDefinition that = (ForwardingPathElementDataDefinition) o;
112 return Objects.equals(getFromNode(), that.getFromNode()) && Objects.equals(getToNode(), that.getToNode()) && Objects
113 .equals(getFromCPOriginId(), that.getFromCPOriginId()) && Objects.equals(getToCPOriginId(), that.getToCPOriginId());
117 public int hashCode() {
118 return Objects.hash(getFromNode(), getToNode(), getFromCP(), getToCP(), getFromCPOriginId(), getToCPOriginId());
122 public String toString() {
123 return MoreObjects.toStringHelper(this).add("fromNode", getFromNode()).add("toNode", getToNode()).add("fromCPOriginId", getFromCPOriginId())
124 .add("toCPOriginId", getToCPOriginId()).add("fromCPName", getFromCP()).add("toCPName", getToCP()).toString();