diff options
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnf.java')
-rw-r--r-- | appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnf.java | 60 |
1 files changed, 43 insertions, 17 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnf.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnf.java index 9f75779cd..87e528b78 100644 --- a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnf.java +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnf.java @@ -24,49 +24,75 @@ package org.onap.appc.domainmodel; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; +import java.util.Set; public class Vnf { + private String vnfId; private String vnfType; private String vnfVersion; + private List <Vserver> vservers; - private List<Vnfc> vnfcs; + public Vnf(){ + vservers = new LinkedList<>(); + } - public Vnf(String vnfId,String vnfType,String vnfVersion){ + public String getVnfId() { + return vnfId; + } + + public void setVnfId(String vnfId) { this.vnfId = vnfId; + } + + public String getVnfType() { + return vnfType; + } + + public void setVnfType(String vnfType) { this.vnfType = vnfType; - this.vnfVersion = vnfVersion; - this.vnfcs = new LinkedList<>(); } public String getVnfVersion() { return vnfVersion; } - public String getVnfId() { - return vnfId; - } - - public String getVnfType() { - return vnfType; + public void setVnfVersion(String vnfVersion) { + this.vnfVersion = vnfVersion; } - public void addVnfc(Vnfc vnfc){ - this.vnfcs.add(vnfc); + public List<Vserver> getVservers() { + return vservers; } - public List<Vnfc> getVnfcs() { - return vnfcs; + public void setVservers(List<Vserver> vservers) { + this.vservers = vservers; } @Override public String toString() { - StringBuilder stringBuilder = new StringBuilder("Vnf : vnfId = " + vnfId +" , vnfType = " + vnfType); - for(Vnfc vnfc:vnfcs){ - stringBuilder.append(vnfc.toString()).append(","); + StringBuilder stringBuilder = new StringBuilder().append("Vnf : vnfId = ").append(vnfId ).append(" , vnfType = ").append( vnfType); + for(Vserver vserver:vservers){ + stringBuilder.append(vserver.toString()).append(","); } return stringBuilder.toString(); } + + public void addVserver(Vserver vserver) { + this.vservers.add(vserver); + } + + public List<Vnfc> getVnfcs(){ + Set<Vnfc> vnfcs = new HashSet<>(); + for(Vserver vserver:vservers){ + if(vserver.getVnfc() != null) + vnfcs.add(vserver.getVnfc()); + } + return new LinkedList<>(vnfcs); + } + + } |