diff options
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-domain-model-lib')
8 files changed, 330 insertions, 0 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.gitignore b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.core.resources.prefs b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000..e9441bb12 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding/<project>=UTF-8 diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.m2e.core.prefs b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 000000000..f897a7f1c --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.wst.common.project.facet.core.xml b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 000000000..f4ef8aa0a --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> + <installed facet="java" version="1.8"/> +</faceted-project> diff --git a/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/pom.xml b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/pom.xml new file mode 100644 index 000000000..640a4b7e9 --- /dev/null +++ b/appc-dg/appc-dg-shared/appc-dg-domain-model-lib/pom.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-dg-shared</artifactId> + <version>1.1.0-SNAPSHOT</version> + </parent> + + <groupId>org.openecomp.appc</groupId> + <artifactId>appc-dg-domain-model-lib</artifactId> + + <name>appc-dg-domain-model-lib</name> + <url>http://maven.apache.org</url> + + <packaging>jar</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> 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; + } +} |