2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 * ============LICENSE_END=========================================================
24 package org.onap.appc.domainmodel;
26 import java.util.LinkedList;
27 import java.util.List;
32 private String vnfcType;
33 private String resilienceType;
34 private boolean mandatory;
35 private String vnfcName;
36 private List<Vserver> vserverList;
39 this.vserverList = new LinkedList<>();
43 public String toString() {
44 StringBuilder stringBuilder = new StringBuilder().append("Vnfc : vnfcType = ").append(vnfcType).append(", vnfcName = ").append(vnfcName).append(", resilienceType = " ).append(resilienceType).append(", mandatory = ").append(mandatory);
45 for(Vserver vserver:vserverList){
46 stringBuilder.append(vserver.toString()).append(", \n");
48 return stringBuilder.toString();
52 public int hashCode(){
55 result = result * prime + (this.vnfcType == null ? 0 :this.vnfcType.hashCode());
56 result = result * prime + (this.resilienceType == null ? 0 :this.resilienceType.hashCode());
57 result = result * prime + (this.vnfcName == null ? 0 :this.vnfcName.hashCode());
58 result = result * prime + (Boolean.valueOf(this.mandatory).hashCode());
62 public boolean equals(Object object){
66 if(!(object instanceof Vnfc)){
69 Vnfc vnfc = (Vnfc)object;
71 if(this.vnfcType == null){
72 if(vnfc.vnfcType !=null)
75 else if(!this.vnfcType.equals(vnfc.vnfcType))
78 if(this.resilienceType == null){
79 if(vnfc.resilienceType !=null)
82 else if(!this.resilienceType.equals(vnfc.resilienceType))
85 if(this.vnfcName == null){
86 if(vnfc.vnfcName !=null)
89 else if(!this.vnfcName.equals(vnfc.vnfcName))
91 if (this.mandatory != vnfc.mandatory)
96 public String getVnfcType() {
100 public void setVnfcType(String vnfcType) {
101 this.vnfcType = vnfcType;
104 public String getResilienceType() {
105 return resilienceType;
108 public void setResilienceType(String resilienceType) {
109 this.resilienceType = resilienceType;
112 public boolean isMandatory() {
116 public void setMandatory(boolean mandatory) {
117 this.mandatory = mandatory;
120 public String getVnfcName() {
124 public void setVnfcName(String vnfcName) {
125 this.vnfcName = vnfcName;
128 public List<Vserver> getVserverList() {
132 public void setVserverList(List<Vserver> vserverList) {
133 this.vserverList = vserverList;
136 public void addVservers(List<Vserver> vserverList){
137 this.vserverList.addAll(vserverList);
140 public void addVserver(Vserver vm) {
141 this.vserverList.add(vm);