Updated SDC listener and dependent bundles
[appc.git] / appc-dg / appc-dg-shared / appc-dg-domain-model-lib / src / main / java / org / onap / appc / domainmodel / Vnfc.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Copyright (C) 2017 Amdocs
8  * =============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.domainmodel;
26
27 import java.util.LinkedList;
28 import java.util.List;
29
30
31 public class Vnfc {
32
33     private String vnfcType;
34     private String resilienceType;
35     private boolean mandatory;
36     private String vnfcName;
37     private List<Vserver> vserverList;
38
39     public Vnfc(){
40         this.vserverList = new LinkedList<>();
41     }
42
43     @Override
44     public String toString() {
45         StringBuilder stringBuilder = new StringBuilder().append("Vnfc : vnfcType = ").append(vnfcType).append(", vnfcName = ").append(vnfcName).append(", resilienceType = " ).append(resilienceType).append(", mandatory = ").append(mandatory);
46         for(Vserver vserver:vserverList){
47             stringBuilder.append(vserver.toString()).append(", \n");
48         }
49         return stringBuilder.toString();
50     }
51
52     @Override
53     public int hashCode(){
54         final int prime = 31;
55         int result = 1;
56         result = result * prime + (this.vnfcType == null ? 0 :this.vnfcType.hashCode());
57         result = result * prime + (this.resilienceType == null ? 0 :this.resilienceType.hashCode());
58         result = result * prime + (this.vnfcName == null ? 0 :this.vnfcName.hashCode());
59         result = result * prime + (Boolean.valueOf(this.mandatory).hashCode());
60         return result;
61     }
62     @Override
63     public boolean equals(Object object){
64         if(object == null){
65             return false;
66         }
67         if(!(object instanceof Vnfc)){
68             return false;
69         }
70         Vnfc vnfc = (Vnfc)object;
71
72         if(this.vnfcType == null){
73             if(vnfc.vnfcType !=null)
74                 return false;
75         }
76         else if(!this.vnfcType.equals(vnfc.vnfcType))
77             return false;
78
79         if(this.resilienceType == null){
80             if(vnfc.resilienceType !=null)
81                 return false;
82         }
83         else if(!this.resilienceType.equals(vnfc.resilienceType))
84             return false;
85
86         if(this.vnfcName == null){
87             if(vnfc.vnfcName !=null)
88                 return false;
89         }
90         else if(!this.vnfcName.equals(vnfc.vnfcName))
91             return false;
92         if (this.mandatory != vnfc.mandatory)
93             return false;
94         return true;
95     }
96
97     public String getVnfcType() {
98         return vnfcType;
99     }
100
101     public void setVnfcType(String vnfcType) {
102         this.vnfcType = vnfcType;
103     }
104
105     public String getResilienceType() {
106         return resilienceType;
107     }
108
109     public void setResilienceType(String resilienceType) {
110         this.resilienceType = resilienceType;
111     }
112
113     public boolean isMandatory() {
114         return mandatory;
115     }
116
117     public void setMandatory(boolean mandatory) {
118         this.mandatory = mandatory;
119     }
120
121     public String getVnfcName() {
122         return vnfcName;
123     }
124
125     public void setVnfcName(String vnfcName) {
126         this.vnfcName = vnfcName;
127     }
128
129     public List<Vserver> getVserverList() {
130         return vserverList;
131     }
132
133     public void setVserverList(List<Vserver> vserverList) {
134         this.vserverList = vserverList;
135     }
136
137     public void addVservers(List<Vserver> vserverList){
138         this.vserverList.addAll(vserverList);
139     }
140
141     public void addVserver(Vserver vm) {
142         this.vserverList.add(vm);
143     }
144
145
146 }