summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java/org
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-11 21:14:32 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-01-11 21:14:46 -0500
commita85dc14805068ac6ab6eab7efd5d10459ee3ebc2 (patch)
tree534d0ff4078ec82b21e4fe21c639722ebf4ac1a0 /mso-catalog-db/src/main/java/org
parentde5958dddd97b086ec8b603974f434fd814386ac (diff)
Service Proxy Consolidation
- Updated ServiceProxyResourceCustomization to remove the ID column - Removed setConfigurationResourceCustomization from serviceProxyResource since that relationship doesn't exist anymore - Updated ServiceProxy resource to remove the object dependencies between ServiceProxyCustomization and ConfigurationResourceCustomization - Removed the delete statement since this is causing the test to fail because the service table doesn't exist yet - Updated configuration_customization to drop the serviceProxyCustomization FK - Added migration script to consolidate the ServiceProxy and ServiceProxyCustomization into a single table and migrate the data. - Code changes to support consolidating the ServiceProxy and ServiceProxyCustomization table into a single table Change-Id: I1e49cb22c8b667f157dd1c349b5e36fd06236630 Issue-ID: SO-1380 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java/org')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java26
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java158
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java83
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java29
5 files changed, 75 insertions, 223 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
index 4f21580b9c..0b02c11701 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -30,6 +31,8 @@ import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.MapsId;
+import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@@ -74,10 +77,9 @@ public class ConfigurationResourceCustomization implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created;
- @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @JoinColumn(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
- private ServiceProxyResourceCustomization serviceProxyResourceCustomization;
-
+ @Column(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
+ private String serviceProxyResourceCustomizationUUID;
+
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
private ConfigurationResourceCustomization configResourceCustomization;
@@ -134,22 +136,20 @@ public class ConfigurationResourceCustomization implements Serializable {
public Date getCreated() {
return created;
}
-
- @LinkedResource
- public ServiceProxyResourceCustomization getServiceProxyResourceCustomization() {
- return serviceProxyResourceCustomization;
+
+ public String getServiceProxyResourceCustomizationUUID() {
+ return serviceProxyResourceCustomizationUUID;
}
- public void setServiceProxyResourceCustomization(
- ServiceProxyResourceCustomization serviceProxyResourceCustomization) {
- this.serviceProxyResourceCustomization = serviceProxyResourceCustomization;
+ public void setServiceProxyResourceCustomizationUUID(String serviceProxyResourceCustomizationUUID) {
+ this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
}
@LinkedResource
public ConfigurationResourceCustomization getConfigResourceCustomization() {
return configResourceCustomization;
}
-
+
public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
this.configResourceCustomization = configResourceCustomization;
}
@@ -168,7 +168,7 @@ public class ConfigurationResourceCustomization implements Serializable {
return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
.append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction)
.append("nfType", nfType).append("nfRole", nfRole).append("created", created)
- .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
+ //.append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
.append("configResourceCustomization", configResourceCustomization)
.append("configurationResource", configurationResource).toString();
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java
deleted file mode 100644
index a3f12edef4..0000000000
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResource.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.onap.so.db.catalog.beans;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.Set;
-
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.PrePersist;
-import javax.persistence.Table;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.openpojo.business.annotation.BusinessKey;
-
-import uk.co.blackpepper.bowman.annotation.LinkedResource;
-
-@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
-@Entity
-@Table(name = "service_proxy")
-public class ServiceProxyResource implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 8113564204017394906L;
-
- @BusinessKey
- @Id
- @Column(name = "MODEL_UUID")
- private String modelUUID;
-
- @Column(name = "MODEL_INVARIANT_UUID")
- private String modelInvariantUUID;
-
- @Column(name = "MODEL_VERSION")
- private String modelVersion;
-
- @Column(name = "MODEL_NAME")
- private String modelName;
-
- @Column(name = "DESCRIPTION")
- private String description;
-
- @Column(name = "CREATION_TIMESTAMP", updatable = false)
- @Temporal(TemporalType.TIMESTAMP)
- private Date created;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "serviceProxyResource")
- private Set<ServiceProxyResourceCustomization> serviceProxyCustomization;
-
- @PrePersist
- protected void onCreate() {
- this.created = new Date();
- }
-
- public String getModelUUID() {
- return modelUUID;
- }
-
- public void setModelUUID(String modelUUID) {
- this.modelUUID = modelUUID;
- }
-
- public String getModelInvariantUUID() {
- return modelInvariantUUID;
- }
-
- public void setModelInvariantUUID(String modelInvariantUUID) {
- this.modelInvariantUUID = modelInvariantUUID;
- }
-
- public String getModelVersion() {
- return modelVersion;
- }
-
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- public String getModelName() {
- return modelName;
- }
-
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Date getCreated() {
- return created;
- }
-
- @LinkedResource
- public Set<ServiceProxyResourceCustomization> getServiceProxyCustomization() {
- return serviceProxyCustomization;
- }
-
- public void setServiceProxyCustomization(Set<ServiceProxyResourceCustomization> serviceProxyCustomization) {
- this.serviceProxyCustomization = serviceProxyCustomization;
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
- .append("modelVersion", modelVersion).append("modelName", modelName).append("description", description)
- .append("created", created).append("serviceProxyCustomization", serviceProxyCustomization).toString();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof ServiceProxyResource)) {
- return false;
- }
- ServiceProxyResource castOther = (ServiceProxyResource) other;
- return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(modelUUID).toHashCode();
- }
-}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java
index 3df22bc716..d725c505ff 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceProxyResourceCustomization.java
@@ -22,14 +22,19 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@@ -52,7 +57,7 @@ public class ServiceProxyResourceCustomization implements Serializable {
*
*/
private static final long serialVersionUID = -2822457299134903084L;
-
+
@BusinessKey
@Id
@Column(name = "MODEL_CUSTOMIZATION_UUID")
@@ -60,9 +65,24 @@ public class ServiceProxyResourceCustomization implements Serializable {
@Column(name = "MODEL_INSTANCE_NAME")
private String modelInstanceName;
+
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
@Column(name = "TOSCA_NODE_TYPE")
private String toscaNodeType;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
@@ -71,19 +91,12 @@ public class ServiceProxyResourceCustomization implements Serializable {
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "SOURCE_SERVICE_MODEL_UUID")
private Service sourceService;
-
- @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @JoinColumn(name = "SERVICE_PROXY_MODEL_UUID")
- private ServiceProxyResource serviceProxyResource;
-
- @OneToOne(mappedBy = "serviceProxyResourceCustomization")
- private ConfigurationResourceCustomization configResourceCustomization;
-
+
@PrePersist
protected void onCreate() {
this.created = new Date();
}
-
+
public String getModelCustomizationUUID() {
return modelCustomizationUUID;
}
@@ -120,32 +133,56 @@ public class ServiceProxyResourceCustomization implements Serializable {
public void setSourceService(Service sourceService) {
this.sourceService = sourceService;
}
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
- @LinkedResource
- public ServiceProxyResource getServiceProxyResource() {
- return serviceProxyResource;
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
}
- public void setServiceProxyResource(ServiceProxyResource serviceProxyResource) {
- this.serviceProxyResource = serviceProxyResource;
+ public String getModelInvariantUUID() {
+ return modelInvariantUUID;
}
- @LinkedResource
- public ConfigurationResourceCustomization getConfigResourceCustomization() {
- return configResourceCustomization;
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
}
- public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
- this.configResourceCustomization = configResourceCustomization;
+ public String getModelVersion() {
+ return modelVersion;
}
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
.append("modelInstanceName", modelInstanceName).append("toscaNodeType", toscaNodeType)
- .append("created", created).append("sourceService", sourceService)
- .append("serviceProxyResource", serviceProxyResource)
- .append("configResourceCustomization", configResourceCustomization).toString();
+ .append("modelUUID", modelUUID)
+ .append("modelInvariantUUID",modelInvariantUUID).append("modelName",modelName)
+ .append("description",description)
+ .append("created", created).append("sourceService", sourceService).toString();
}
@Override
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java
index c90fd8965a..cb98c8a709 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceCustomizationRepository.java
@@ -26,4 +26,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "serviceProxyResourceCustomization", path = "serviceProxyResourceCustomization")
public interface ServiceProxyResourceCustomizationRepository
extends JpaRepository<ServiceProxyResourceCustomization, String> {
+
+ ServiceProxyResourceCustomization findResourceByModelCustomizationUUID(String modelCustomizationUUID);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java
deleted file mode 100644
index e6ec3b04d1..0000000000
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceProxyResourceRepository.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.onap.so.db.catalog.data.repository;
-
-import org.onap.so.db.catalog.beans.ServiceProxyResource;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-
-@RepositoryRestResource(collectionResourceRel = "serviceProxyResource", path = "serviceProxyResource")
-public interface ServiceProxyResourceRepository extends JpaRepository<ServiceProxyResource, Long> {
- ServiceProxyResource findResourceByModelUUID(String modelUUID);
-} \ No newline at end of file