2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.openecomp.appc.domainmodel;
24 import java.util.LinkedList;
25 import java.util.List;
30 private String vnfcType;
32 public void setResilienceType(String resilienceType) {
33 this.resilienceType = resilienceType;
36 private String resilienceType;
37 private boolean mandatory;
38 private String vnfcName;
39 private List<Vserver> vserverList;
41 public Vnfc(String vnfcType,String resilienceType){
42 this(vnfcType,resilienceType,null, false);
45 public Vnfc(String vnfcType,String resilienceType,String vnfcName){
46 this(vnfcType,resilienceType,vnfcName, false);
49 public Vnfc(String vnfcType,String resilienceType,String vnfcName, boolean mandatory){
50 this.vnfcName = vnfcName;
51 this.vnfcType = vnfcType;
52 this.resilienceType = resilienceType;
53 this.mandatory = mandatory;
54 this.vserverList = new LinkedList<>();
58 public String toString() {
59 StringBuilder stringBuilder = new StringBuilder("Vnfc : vnfcType = " + vnfcType + ", vnfcName = " +vnfcName + ", resilienceType = " + resilienceType+", mandatory = " + mandatory);
60 for(Vserver vserver:vserverList){
61 stringBuilder.append(vserver.toString()).append(", \n");
63 return stringBuilder.toString();
67 public int hashCode(){
70 result = result * prime + (this.vnfcType == null ? 0 :this.vnfcType.hashCode());
71 result = result * prime + (this.resilienceType == null ? 0 :this.resilienceType.hashCode());
72 result = result * prime + (this.vnfcName == null ? 0 :this.vnfcName.hashCode());
73 result = result * prime + (Boolean.valueOf(this.mandatory).hashCode());
77 public boolean equals(Object object){
81 if(!(object instanceof Vnfc)){
84 Vnfc vnfc = (Vnfc)object;
86 if(this.vnfcType == null){
87 if(vnfc.vnfcType !=null)
90 else if(!this.vnfcType.equals(vnfc.vnfcType))
93 if(this.resilienceType == null){
94 if(vnfc.resilienceType !=null)
97 else if(!this.resilienceType.equals(vnfc.resilienceType))
100 if(this.vnfcName == null){
101 if(vnfc.vnfcName !=null)
104 else if(!this.vnfcName.equals(vnfc.vnfcName))
106 if (this.mandatory != vnfc.mandatory)
111 public void addVm(Vserver vserver){
112 this.vserverList.add(vserver);
114 public void addVms(List<Vserver> vserverList){
115 this.vserverList.addAll(vserverList);
118 public void setVnfcName(String vnfcName) {
119 this.vnfcName = vnfcName;
122 public String getVnfcType() {
126 public String getResilienceType() {
127 return resilienceType;
130 public String getVnfcName() {
134 public List<Vserver> getVserverList() {
138 public boolean isMandatory() {
142 public void setMandatory(boolean mandatory) {
143 this.mandatory = mandatory;