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.openecomp.appc.domainmodel;
27 import java.util.LinkedList;
28 import java.util.List;
33 private String vnfcType;
35 public void setResilienceType(String resilienceType) {
36 this.resilienceType = resilienceType;
39 private String resilienceType;
40 private boolean mandatory;
41 private String vnfcName;
42 private List<Vserver> vserverList;
44 public Vnfc(String vnfcType,String resilienceType){
45 this(vnfcType,resilienceType,null, false);
48 public Vnfc(String vnfcType,String resilienceType,String vnfcName){
49 this(vnfcType,resilienceType,vnfcName, false);
52 public Vnfc(String vnfcType,String resilienceType,String vnfcName, boolean mandatory){
53 this.vnfcName = vnfcName;
54 this.vnfcType = vnfcType;
55 this.resilienceType = resilienceType;
56 this.mandatory = mandatory;
57 this.vserverList = new LinkedList<>();
61 public String toString() {
62 StringBuilder stringBuilder = new StringBuilder("Vnfc : vnfcType = " + vnfcType + ", vnfcName = " +vnfcName + ", resilienceType = " + resilienceType+", mandatory = " + mandatory);
63 for(Vserver vserver:vserverList){
64 stringBuilder.append(vserver.toString()).append(", \n");
66 return stringBuilder.toString();
70 public int hashCode(){
73 result = result * prime + (this.vnfcType == null ? 0 :this.vnfcType.hashCode());
74 result = result * prime + (this.resilienceType == null ? 0 :this.resilienceType.hashCode());
75 result = result * prime + (this.vnfcName == null ? 0 :this.vnfcName.hashCode());
76 result = result * prime + (Boolean.valueOf(this.mandatory).hashCode());
80 public boolean equals(Object object){
84 if(!(object instanceof Vnfc)){
87 Vnfc vnfc = (Vnfc)object;
89 if(this.vnfcType == null){
90 if(vnfc.vnfcType !=null)
93 else if(!this.vnfcType.equals(vnfc.vnfcType))
96 if(this.resilienceType == null){
97 if(vnfc.resilienceType !=null)
100 else if(!this.resilienceType.equals(vnfc.resilienceType))
103 if(this.vnfcName == null){
104 if(vnfc.vnfcName !=null)
107 else if(!this.vnfcName.equals(vnfc.vnfcName))
109 if (this.mandatory != vnfc.mandatory)
114 public void addVm(Vserver vserver){
115 this.vserverList.add(vserver);
117 public void addVms(List<Vserver> vserverList){
118 this.vserverList.addAll(vserverList);
121 public void setVnfcName(String vnfcName) {
122 this.vnfcName = vnfcName;
125 public String getVnfcType() {
129 public String getResilienceType() {
130 return resilienceType;
133 public String getVnfcName() {
137 public List<Vserver> getVserverList() {
141 public boolean isMandatory() {
145 public void setMandatory(boolean mandatory) {
146 this.mandatory = mandatory;