aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-11 13:33:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-04-12 20:58:34 -0400
commit52039edadd2f35c2de12878ea939742773fac87d (patch)
treec6587ebc43b9e6dbca38685b4be30f2bdcb4893e /mso-catalog-db/src/main/java
parent48478b9531fb2901c392ce1142f9443b5d805148 (diff)
vnr vrf fk issue
Updated flyway migration script to rename object as per review comments. Used Tosca node type for determining VRF and VNF nodes updated code based on review comments for schema.sql Altered ConfigurationCustomizationResource for VRF-VNF to have bidirectional relationship ToscaResourceInstaller ConfigurationResourceCustomization was made bidrectional Change-Id: Ib45151ff7a40edca38d512ae76f8889b1cc4d0c4 Issue-ID: SO-1777 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java39
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java4
2 files changed, 34 insertions, 9 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 059935fff3..1117648a7f 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
@@ -27,6 +27,8 @@ 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.ManyToOne;
@@ -52,8 +54,12 @@ public class ConfigurationResourceCustomization implements Serializable {
*/
private static final long serialVersionUID = 1230671937560638856L;
- @BusinessKey
@Id
+ @BusinessKey
+ @Column(name = "ID")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
@Column(name = "MODEL_CUSTOMIZATION_UUID")
private String modelCustomizationUUID;
@@ -77,18 +83,30 @@ public class ConfigurationResourceCustomization implements Serializable {
private String serviceProxyResourceCustomizationUUID;
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
- @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
+ @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID")
private ConfigurationResourceCustomization configResourceCustomization;
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "CONFIGURATION_MODEL_UUID")
private ConfigurationResource configurationResource;
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "SERVICE_MODEL_UUID")
+ private Service service;
+
@PrePersist
protected void onCreate() {
this.created = new Date();
}
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
public String getModelCustomizationUUID() {
return modelCustomizationUUID;
}
@@ -141,6 +159,7 @@ public class ConfigurationResourceCustomization implements Serializable {
this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
}
+
@LinkedResource
public ConfigurationResourceCustomization getConfigResourceCustomization() {
return configResourceCustomization;
@@ -159,14 +178,22 @@ public class ConfigurationResourceCustomization implements Serializable {
this.configurationResource = configurationResource;
}
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
@Override
public String toString() {
- return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
.append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction)
.append("nfType", nfType).append("nfRole", nfRole).append("created", created)
// .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
.append("configResourceCustomization", configResourceCustomization)
- .append("configurationResource", configurationResource).toString();
+ .append("configurationResource", configurationResource).append("service", service).toString();
}
@Override
@@ -175,12 +202,12 @@ public class ConfigurationResourceCustomization implements Serializable {
return false;
}
ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other;
- return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ return new EqualsBuilder().append(id, castOther.id).isEquals();
}
@Override
public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ return new HashCodeBuilder().append(id).toHashCode();
}
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index c333033ba2..ffcc8e9717 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -119,9 +119,7 @@ public class Service implements Serializable {
inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
private List<ServiceProxyResourceCustomization> serviceProxyCustomizations;
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"),
- inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
private List<ConfigurationResourceCustomization> configurationCustomizations;
@OneToMany(cascade = CascadeType.ALL)