Updated SDC listener and dependent bundles
[appc.git] / appc-dg / appc-dg-shared / appc-dg-domain-model-lib / src / main / java / org / onap / appc / domainmodel / Vnf.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APPC
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
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
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.
20  * 
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  * ============LICENSE_END=========================================================
23  */
24
25 package org.onap.appc.domainmodel;
26
27 import java.util.HashSet;
28 import java.util.LinkedList;
29 import java.util.List;
30 import java.util.Set;
31
32 public class Vnf {
33
34     private String vnfId;
35     private String vnfType;
36     private String vnfVersion;
37     private  List <Vserver> vservers;
38
39     public Vnf(){
40         vservers = new LinkedList<>();
41     }
42
43     public String getVnfId() {
44         return vnfId;
45     }
46
47     public void setVnfId(String vnfId) {
48         this.vnfId = vnfId;
49     }
50
51     public String getVnfType() {
52         return vnfType;
53     }
54
55     public void setVnfType(String vnfType) {
56         this.vnfType = vnfType;
57     }
58
59     public String getVnfVersion() {
60         return vnfVersion;
61     }
62
63     public void setVnfVersion(String vnfVersion) {
64         this.vnfVersion = vnfVersion;
65     }
66
67     public List<Vserver> getVservers() {
68         return vservers;
69     }
70
71     public void setVservers(List<Vserver> vservers) {
72         this.vservers = vservers;
73     }
74
75     @Override
76     public String toString() {
77         StringBuilder stringBuilder = new StringBuilder().append("Vnf : vnfId = ").append(vnfId ).append(" , vnfType = ").append( vnfType);
78         for(Vserver vserver:vservers){
79             stringBuilder.append(vserver.toString()).append(",");
80         }
81         return stringBuilder.toString();
82     }
83
84     public void addVserver(Vserver vserver) {
85         this.vservers.add(vserver);
86     }
87
88     public List<Vnfc> getVnfcs(){
89         Set<Vnfc> vnfcs = new HashSet<>();
90         for(Vserver vserver:vservers){
91             if(vserver.getVnfc() != null)
92                 vnfcs.add(vserver.getVnfc());
93         }
94         return new LinkedList<>(vnfcs);
95     }
96
97
98 }