2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright (C) 2017 Amdocs
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=========================================================
20 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.openecomp.appc.domainmodel;
25 import java.util.LinkedList;
26 import java.util.List;
31 private String vnfcType;
33 public void setResilienceType(String resilienceType) {
34 this.resilienceType = resilienceType;
37 private String resilienceType;
38 private boolean mandatory;
39 private String vnfcName;
40 private List<Vserver> vserverList;
42 public Vnfc(String vnfcType,String resilienceType){
43 this(vnfcType,resilienceType,null, false);
46 public Vnfc(String vnfcType,String resilienceType,String vnfcName){
47 this(vnfcType,resilienceType,vnfcName, false);
50 public Vnfc(String vnfcType,String resilienceType,String vnfcName, boolean mandatory){
51 this.vnfcName = vnfcName;
52 this.vnfcType = vnfcType;
53 this.resilienceType = resilienceType;
54 this.mandatory = mandatory;
55 this.vserverList = new LinkedList<>();
59 public String toString() {
60 StringBuilder stringBuilder = new StringBuilder("Vnfc : vnfcType = " + vnfcType + ", vnfcName = " +vnfcName + ", resilienceType = " + resilienceType+", mandatory = " + mandatory);
61 for(Vserver vserver:vserverList){
62 stringBuilder.append(vserver.toString()).append(", \n");
64 return stringBuilder.toString();
68 public int hashCode(){
71 result = result * prime + (this.vnfcType == null ? 0 :this.vnfcType.hashCode());
72 result = result * prime + (this.resilienceType == null ? 0 :this.resilienceType.hashCode());
73 result = result * prime + (this.vnfcName == null ? 0 :this.vnfcName.hashCode());
74 result = result * prime + (Boolean.valueOf(this.mandatory).hashCode());
78 public boolean equals(Object object){
82 if(!(object instanceof Vnfc)){
85 Vnfc vnfc = (Vnfc)object;
87 if(this.vnfcType == null){
88 if(vnfc.vnfcType !=null)
91 else if(!this.vnfcType.equals(vnfc.vnfcType))
94 if(this.resilienceType == null){
95 if(vnfc.resilienceType !=null)
98 else if(!this.resilienceType.equals(vnfc.resilienceType))
101 if(this.vnfcName == null){
102 if(vnfc.vnfcName !=null)
105 else if(!this.vnfcName.equals(vnfc.vnfcName))
107 if (this.mandatory != vnfc.mandatory)
112 public void addVm(Vserver vserver){
113 this.vserverList.add(vserver);
115 public void addVms(List<Vserver> vserverList){
116 this.vserverList.addAll(vserverList);
119 public void setVnfcName(String vnfcName) {
120 this.vnfcName = vnfcName;
123 public String getVnfcType() {
127 public String getResilienceType() {
128 return resilienceType;
131 public String getVnfcName() {
135 public List<Vserver> getVserverList() {
139 public boolean isMandatory() {
143 public void setMandatory(boolean mandatory) {
144 this.mandatory = mandatory;