From 0c6057ea8f21c63af4791107c2440a6ed992f5f0 Mon Sep 17 00:00:00 2001 From: "Smokowski, Steven" Date: Thu, 19 Mar 2020 17:57:25 -0400 Subject: mso to add support for creating the cloud region mso to add support for creating the cloud region Updated tag name to msoRequest on deletes. Issue-ID: SO-2753 Signed-off-by: Benjamin, Max (mb388a) Change-Id: I80e318ce34f5938a42896398eb1a38b5c5f6e831 --- .../org/onap/so/db/catalog/beans/CloudSite.java | 15 ++- .../catalog/beans/NetworkTechnologyReference.java | 101 +++++++++++++++++++++ .../NetworkTechnologyReferenceRepository.java | 32 +++++++ 3 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java create mode 100644 mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java (limited to 'mso-catalog-db/src/main') diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java index deaa2a3221..0d7fe7d38f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CloudSite.java @@ -93,6 +93,11 @@ public class CloudSite { @Column(name = "CLOUDIFY_ID") private String cloudifyId; + @JsonProperty("cloud_owner") + @BusinessKey + @Column(name = "CLOUD_OWNER") + private String cloudOwner; + // Derived property (set by CloudConfig loader based on identityServiceId) @BusinessKey @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @@ -266,12 +271,20 @@ public class CloudSite { this.identityServiceId = identityServiceId; } + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("regionId", getRegionId()) .append("identityServiceId", getIdentityServiceId()).append("cloudVersion", getCloudVersion()) .append("clli", getClli()).append("cloudifyId", getCloudifyId()).append("platform", getPlatform()) - .append("orchestrator", getOrchestrator()).toString(); + .append("orchestrator", getOrchestrator()).append("cloud-owner", getCloudOwner()).toString(); } @Override diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java new file mode 100644 index 0000000000..1f19dcc1dd --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkTechnologyReference.java @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Tech Mahindra + * ================================================================================ + * 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.onap.so.db.catalog.beans; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "network_technology_reference") +public class NetworkTechnologyReference implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "ID", nullable = false, updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @BusinessKey + @Column(name = "cloud_owner") + private String cloudOwner; + + @BusinessKey + @Column(name = "network_technology") + private String networkTechnology; + + @Override + public String toString() { + return new ToStringBuilder(this).append("id", id).append("cloudOwner", cloudOwner) + .append("networkTechnology", networkTechnology).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkTechnologyReference)) { + return false; + } + NetworkTechnologyReference castOther = (NetworkTechnologyReference) other; + return new EqualsBuilder().append(cloudOwner, castOther.cloudOwner) + .append(networkTechnology, castOther.networkTechnology).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(cloudOwner).append(networkTechnology).toHashCode(); + } + + public static long getSerialversionuid() { + return serialVersionUID; + } + + public Integer getId() { + return id; + } + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getNetworkTechnology() { + return networkTechnology; + } + + public void setNetworkTechnology(String networkTechnology) { + this.networkTechnology = networkTechnology; + } + + + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java new file mode 100644 index 0000000000..0b7065490b --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkTechnologyReferenceRepository.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Tech Mahindra + * ================================================================================ + * 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.onap.so.db.catalog.data.repository; + + +import java.util.List; +import org.onap.so.db.catalog.beans.NetworkTechnologyReference; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface NetworkTechnologyReferenceRepository extends JpaRepository { + + List findAllByCloudOwner(String cloudOwner); +} -- cgit 1.2.3-korg