diff options
author | Patrick Brady <pb071s@att.com> | 2017-06-01 10:45:37 -0700 |
---|---|---|
committer | Patrick Brady <pb071s@att.com> | 2017-06-02 13:05:15 -0700 |
commit | c7d0075d223eab9f89fd28853c4b138792059be9 (patch) | |
tree | 40aa3e41e598ea7a59bcf6899a2004c1abab11c2 /appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main | |
parent | 8aac2df744820304ee29354333661699e9695939 (diff) |
Merge of new rebased code
Change-Id: I9b8d1f69eb3e0af1935ed8304fea4bf54c1aac47
Signed-off-by: Patrick Brady <pb071s@att.com>
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main')
3 files changed, 289 insertions, 0 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vnf.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vnf.java new file mode 100644 index 000000000..60e9a9fb2 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vnf.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.domainmodel; + +import java.util.LinkedList; +import java.util.List; + +public class Vnf { + private String vnfId; + private String vnfType; + private String vnfVersion; + + private List<Vnfc> vnfcs; + + public Vnf(String vnfId,String vnfType,String vnfVersion){ + this.vnfId = vnfId; + 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 addVnfc(Vnfc vnfc){ + this.vnfcs.add(vnfc); + } + + public List<Vnfc> getVnfcs() { + return vnfcs; + } + + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder("Vnf : vnfId = " + vnfId +" , vnfType = " + vnfType); + for(Vnfc vnfc:vnfcs){ + stringBuilder.append(vnfc.toString()).append(","); + } + return stringBuilder.toString(); + } +} diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vnfc.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vnfc.java new file mode 100644 index 000000000..0064ed62f --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vnfc.java @@ -0,0 +1,145 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.domainmodel; + +import java.util.LinkedList; +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; + this.vserverList = new LinkedList<>(); + } + + @Override + public String toString() { + StringBuilder stringBuilder = new StringBuilder("Vnfc : vnfcType = " + vnfcType + ", vnfcName = " +vnfcName + ", resilienceType = " + resilienceType+", mandatory = " + mandatory); + for(Vserver vserver:vserverList){ + stringBuilder.append(vserver.toString()).append(", \n"); + } + return stringBuilder.toString(); + } + + @Override + public int hashCode(){ + final int prime = 31; + int result = 1; + result = result * prime + (this.vnfcType == null ? 0 :this.vnfcType.hashCode()); + result = result * prime + (this.resilienceType == null ? 0 :this.resilienceType.hashCode()); + result = result * prime + (this.vnfcName == null ? 0 :this.vnfcName.hashCode()); + result = result * prime + (Boolean.valueOf(this.mandatory).hashCode()); + return result; + } + @Override + public boolean equals(Object object){ + if(object == null){ + return false; + } + if(!(object instanceof Vnfc)){ + return false; + } + Vnfc vnfc = (Vnfc)object; + + if(this.vnfcType == null){ + if(vnfc.vnfcType !=null) + return false; + } + else if(!this.vnfcType.equals(vnfc.vnfcType)) + return false; + + if(this.resilienceType == null){ + if(vnfc.resilienceType !=null) + return false; + } + else if(!this.resilienceType.equals(vnfc.resilienceType)) + return false; + + if(this.vnfcName == null){ + if(vnfc.vnfcName !=null) + return false; + } + else if(!this.vnfcName.equals(vnfc.vnfcName)) + return false; + if (this.mandatory != vnfc.mandatory) + return false; + return true; + } + + public void addVm(Vserver vserver){ + this.vserverList.add(vserver); + } + public void addVms(List<Vserver> vserverList){ + this.vserverList.addAll(vserverList); + } + + public void setVnfcName(String vnfcName) { + this.vnfcName = vnfcName; + } + + public String getVnfcType() { + return vnfcType; + } + + public String getResilienceType() { + return resilienceType; + } + + public String getVnfcName() { + return vnfcName; + } + + public List<Vserver> getVserverList() { + return vserverList; + } + + public boolean isMandatory() { + return mandatory; + } + + public void setMandatory(boolean mandatory) { + this.mandatory = mandatory; + } +} diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vserver.java b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vserver.java new file mode 100644 index 000000000..e536535cb --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/src/main/java/org/openecomp/appc/domainmodel/Vserver.java @@ -0,0 +1,75 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : APP-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.domainmodel; + + +public class Vserver { + + private String url; + + private String tenantId; + private String id; + private String relatedLink; + private String name; + + public Vserver(String url){ + this(url,null,null,null,null); + } + + 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; + + } + + public String getUrl() { + return url; + } + + @Override + public String toString() { + return "Vserver : url = " +url + ", tenantId = " +tenantId +", id = " +id + " ,relatedLink = " +relatedLink +" , name = "+name; + } + + public String getTenantId() { + return tenantId; + } + + public String getId() { + return id; + } + + public String getRelatedLink() { + return relatedLink; + } + + public String getName() { + return name; + } +} |