diff options
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java')
3 files changed, 107 insertions, 67 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); + } + + } diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnfc.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnfc.java index de075f085..6e7d24158 100644 --- a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnfc.java +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vnfc.java @@ -31,35 +31,18 @@ import java.util.List; public class Vnfc { private String vnfcType; - - public void setResilienceType(String resilienceType) { - this.resilienceType = resilienceType; - } - private String resilienceType; private boolean mandatory; private String vnfcName; private List<Vserver> vserverList; - public Vnfc(String vnfcType,String resilienceType){ - this(vnfcType,resilienceType,null, false); - } - - public Vnfc(String vnfcType,String resilienceType,String vnfcName){ - this(vnfcType,resilienceType,vnfcName, false); - } - - public Vnfc(String vnfcType,String resilienceType,String vnfcName, boolean mandatory){ - this.vnfcName = vnfcName; - this.vnfcType = vnfcType; - this.resilienceType = resilienceType; - this.mandatory = mandatory; + public Vnfc(){ this.vserverList = new LinkedList<>(); } @Override public String toString() { - StringBuilder stringBuilder = new StringBuilder("Vnfc : vnfcType = " + vnfcType + ", vnfcName = " +vnfcName + ", resilienceType = " + resilienceType+", mandatory = " + mandatory); + StringBuilder stringBuilder = new StringBuilder().append("Vnfc : vnfcType = ").append(vnfcType).append(", vnfcName = ").append(vnfcName).append(", resilienceType = " ).append(resilienceType).append(", mandatory = ").append(mandatory); for(Vserver vserver:vserverList){ stringBuilder.append(vserver.toString()).append(", \n"); } @@ -111,38 +94,53 @@ public class Vnfc { return true; } - public void addVm(Vserver vserver){ - this.vserverList.add(vserver); + public String getVnfcType() { + return vnfcType; } - public void addVms(List<Vserver> vserverList){ - this.vserverList.addAll(vserverList); + + public void setVnfcType(String vnfcType) { + this.vnfcType = vnfcType; } - public void setVnfcName(String vnfcName) { - this.vnfcName = vnfcName; + public String getResilienceType() { + return resilienceType; } - public String getVnfcType() { - return vnfcType; + public void setResilienceType(String resilienceType) { + this.resilienceType = resilienceType; } - public String getResilienceType() { - return resilienceType; + public boolean isMandatory() { + return mandatory; + } + + public void setMandatory(boolean mandatory) { + this.mandatory = mandatory; } public String getVnfcName() { return vnfcName; } + public void setVnfcName(String vnfcName) { + this.vnfcName = vnfcName; + } + public List<Vserver> getVserverList() { return vserverList; } - public boolean isMandatory() { - return mandatory; + public void setVserverList(List<Vserver> vserverList) { + this.vserverList = vserverList; } - public void setMandatory(boolean mandatory) { - this.mandatory = mandatory; + public void addVservers(List<Vserver> vserverList){ + this.vserverList.addAll(vserverList); + } + + public void addVserver(Vserver vm) { + this.vserverList.add(vm); } + + } diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vserver.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vserver.java index 0840bd91e..ce89c2ed4 100644 --- a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vserver.java +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/onap/appc/domainmodel/Vserver.java @@ -28,51 +28,67 @@ package org.onap.appc.domainmodel; public class Vserver { private String url; - private String tenantId; private String id; private String relatedLink; private String name; + private Vnfc vnfc; - public Vserver(String url){ - this(url,null,null,null,null); - } + public Vserver(){ - public Vserver(String url, - String tenantId, - String id, - String relatedLink, - String name){ - this.url = url; - this.tenantId =tenantId; - this.id = id; - this.relatedLink =relatedLink; - this.name = name; + } + @Override + public String toString() { + return new StringBuilder().append("Vserver : url = ").append(url).append(", tenantId = ").append(tenantId).append(", id = ").append(id).append(" ,relatedLink = ").append(relatedLink).append(" , name = ").append(name).toString(); } public String getUrl() { return url; } - @Override - public String toString() { - return "Vserver : url = " +url + ", tenantId = " +tenantId +", id = " +id + " ,relatedLink = " +relatedLink +" , name = "+name; + public void setUrl(String url) { + this.url = url; } public String getTenantId() { return tenantId; } + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + public String getId() { return id; } + public void setId(String id) { + this.id = id; + } + public String getRelatedLink() { return relatedLink; } + public void setRelatedLink(String relatedLink) { + this.relatedLink = relatedLink; + } + public String getName() { return name; } + + public void setName(String name) { + this.name = name; + } + + public Vnfc getVnfc() { + return vnfc; + } + + public void setVnfc(Vnfc vnfc) { + this.vnfc = vnfc; + } + } |