2 * ============LICENSE_START=======================================================
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
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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 * ============LICENSE_END=========================================================
25 package org.onap.appc.domainmodel;
27 import java.util.LinkedList;
28 import java.util.List;
33 private String vnfcType;
34 private String resilienceType;
35 private boolean mandatory;
36 private String vnfcName;
37 private List<Vserver> vserverList;
40 this.vserverList = new LinkedList<>();
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");
49 return stringBuilder.toString();
53 public int hashCode(){
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());
63 public boolean equals(Object object){
67 if(!(object instanceof Vnfc)){
70 Vnfc vnfc = (Vnfc)object;
72 if(this.vnfcType == null){
73 if(vnfc.vnfcType !=null)
76 else if(!this.vnfcType.equals(vnfc.vnfcType))
79 if(this.resilienceType == null){
80 if(vnfc.resilienceType !=null)
83 else if(!this.resilienceType.equals(vnfc.resilienceType))
86 if(this.vnfcName == null){
87 if(vnfc.vnfcName !=null)
90 else if(!this.vnfcName.equals(vnfc.vnfcName))
92 if (this.mandatory != vnfc.mandatory)
97 public String getVnfcType() {
101 public void setVnfcType(String vnfcType) {
102 this.vnfcType = vnfcType;
105 public String getResilienceType() {
106 return resilienceType;
109 public void setResilienceType(String resilienceType) {
110 this.resilienceType = resilienceType;
113 public boolean isMandatory() {
117 public void setMandatory(boolean mandatory) {
118 this.mandatory = mandatory;
121 public String getVnfcName() {
125 public void setVnfcName(String vnfcName) {
126 this.vnfcName = vnfcName;
129 public List<Vserver> getVserverList() {
133 public void setVserverList(List<Vserver> vserverList) {
134 this.vserverList = vserverList;
137 public void addVservers(List<Vserver> vserverList){
138 this.vserverList.addAll(vserverList);
141 public void addVserver(Vserver vm) {
142 this.vserverList.add(vm);