42e9c78313fa839a3c9355ac5fa756ad18e2cf51
[sdc.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
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 package org.openecomp.sdc.be.datatypes.elements;
21
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;
27
28 public class ForwardingPathElementDataDefinition extends ToscaDataDefinition {
29
30     @JsonCreator
31     public ForwardingPathElementDataDefinition() {
32     }
33
34     public ForwardingPathElementDataDefinition(String fromNode, String toNode, String fromCPName, String toCPName, String fromCPOriginId,
35                                                String toCPOriginId) {
36         super();
37         setFromNode(fromNode);
38         setToNode(toNode);
39         setFromCP(fromCPName);
40         setToCP(toCPName);
41         setFromCPOriginId(fromCPOriginId);
42         setToCPOriginId(toCPOriginId);
43     }
44
45     public ForwardingPathElementDataDefinition(ForwardingPathElementDataDefinition pathElement) {
46         super();
47         setFromNode(pathElement.getFromNode());
48         setToNode(pathElement.getToNode());
49         setFromCP(pathElement.getFromCP());
50         setToCP(pathElement.getToCP());
51         setFromCPOriginId(pathElement.getFromCPOriginId());
52         setToCPOriginId(pathElement.getToCPOriginId());
53     }
54
55     public String getFromNode() {
56         return (String) getToscaPresentationValue(JsonPresentationFields.FROM_NODE);
57     }
58
59     public void setFromNode(String fromNode) {
60         setToscaPresentationValue(JsonPresentationFields.FROM_NODE, fromNode);
61     }
62
63     public String getToNode() {
64         return (String) getToscaPresentationValue(JsonPresentationFields.TO_NODE);
65     }
66
67     public void setToNode(String toNode) {
68         setToscaPresentationValue(JsonPresentationFields.TO_NODE, toNode);
69     }
70
71     public String getFromCP() {
72         return (String) getToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP);
73     }
74
75     public void setFromCP(String fromCP) {
76         setToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP, fromCP);
77     }
78
79     public String getToCP() {
80         return (String) getToscaPresentationValue(JsonPresentationFields.PATH_TO_CP);
81     }
82
83     public void setToCP(String toCP) {
84         setToscaPresentationValue(JsonPresentationFields.PATH_TO_CP, toCP);
85     }
86
87     public String getToCPOriginId() {
88         return (String) getToscaPresentationValue(JsonPresentationFields.PATH_TO_CP_ORIGIN);
89     }
90
91     public void setToCPOriginId(String toCPOriginId) {
92         setToscaPresentationValue(JsonPresentationFields.PATH_TO_CP_ORIGIN, toCPOriginId);
93     }
94
95     public String getFromCPOriginId() {
96         return (String) getToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP_ORIGIN);
97     }
98
99     public void setFromCPOriginId(String fromCPOriginId) {
100         setToscaPresentationValue(JsonPresentationFields.PATH_FROM_CP_ORIGIN, fromCPOriginId);
101     }
102
103     @Override
104     public boolean equals(Object o) {
105         if (this == o) {
106             return true;
107         }
108         if (o == null || getClass() != o.getClass()) {
109             return false;
110         }
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());
114     }
115
116     @Override
117     public int hashCode() {
118         return Objects.hash(getFromNode(), getToNode(), getFromCP(), getToCP(), getFromCPOriginId(), getToCPOriginId());
119     }
120
121     @Override
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();
125     }
126 }