Reformat catalog-model
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / RelationshipInfo.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 package org.openecomp.sdc.be.model;
21
22 import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
23
24 public class RelationshipInfo {
25
26     private String requirement;
27     private String capabilityOwnerId;
28     private String requirementOwnerId;
29     private String id;
30     private RelationshipImpl relationship;
31     private String capability;
32     private String capabilityUid;
33     private String requirementUid;
34
35     public RelationshipInfo() {
36         super();
37     }
38
39     public RelationshipInfo(String requirement, RelationshipImpl relationship) {
40         super();
41         this.requirement = requirement;
42         this.relationship = relationship;
43     }
44
45     public RelationshipInfo(String requirement, RelationshipImpl relationship, String capability) {
46         super();
47         this.requirement = requirement;
48         this.relationship = relationship;
49         this.capability = capability;
50     }
51
52     public String getRequirement() {
53         return requirement;
54     }
55
56     public void setRequirement(String requirement) {
57         this.requirement = requirement;
58     }
59
60     public String getCapabilityOwnerId() {
61         return capabilityOwnerId;
62     }
63
64     public void setCapabilityOwnerId(String capabilityOwnerId) {
65         this.capabilityOwnerId = capabilityOwnerId;
66     }
67
68     public String getRequirementOwnerId() {
69         return requirementOwnerId;
70     }
71
72     public void setRequirementOwnerId(String requirementOwnerId) {
73         this.requirementOwnerId = requirementOwnerId;
74     }
75
76     public RelationshipImpl getRelationship() {
77         return relationship;
78     }
79
80     public void setRelationships(RelationshipImpl relationship) {
81         this.relationship = relationship;
82     }
83
84     public String getCapability() {
85         return capability;
86     }
87
88     public void setCapability(String capability) {
89         this.capability = capability;
90     }
91
92     public String getCapabilityUid() {
93         return capabilityUid;
94     }
95
96     public void setCapabilityUid(String capabilityUid) {
97         this.capabilityUid = capabilityUid;
98     }
99
100     public String getRequirementUid() {
101         return requirementUid;
102     }
103
104     public void setRequirementUid(String requirementUid) {
105         this.requirementUid = requirementUid;
106     }
107
108     public String getId() {
109         return id;
110     }
111
112     public void setId(String id) {
113         this.id = id;
114     }
115
116     @Override
117     public String toString() {
118         return "RequirementAndRelationshipPair [requirement=" + requirement + ", relationship=" + relationship + ", capability=" + capability + "]";
119     }
120
121     public boolean equalsTo(RelationshipInstDataDefinition savedRelation) {
122         if (savedRelation == null) {
123             return false;
124         }
125         if (getRelationship().getType() == null) {
126             if (savedRelation.getType() != null) {
127                 return false;
128             }
129         } else {
130             if (!savedRelation.getType().equals(this.getRelationship().getType())) {
131                 return false;
132             }
133         }
134         if (!savedRelation.getCapabilityOwnerId().equals(this.getCapabilityOwnerId())) {
135             return false;
136         }
137         if (!savedRelation.getRequirementOwnerId().equals(this.getRequirementOwnerId())) {
138             return false;
139         }
140         if (!savedRelation.getRequirementId().equals(this.getRequirementUid())) {
141             return false;
142         }
143         if (!savedRelation.getCapabilityId().equals(this.getCapabilityUid())) {
144             return false;
145         }
146         if (!savedRelation.getRequirement().equals(this.getRequirement())) {
147             return false;
148         }
149         return true;
150     }
151 }