aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-09 20:36:18 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-03-12 13:37:02 -0400
commitaa7e2b46bd85fd17c0981fa5a67c5c447c698a49 (patch)
treee1da3c40309b46efd33e6dba2d50babe892127e9 /mso-catalog-db
parent308c3c2085864e04848e53a589773ff2e6e2c76a (diff)
Remove service recipes from service object
- Added back in the @MapKey = action for the Map. - Added test methods back in for the ServiceRecipe. - Added getter and setter for Service object. - Added code to reference the Service object from ServiceRecipe. - Remove service recipes from service object since service_recipes are manually managed. Change-Id: Ife50d4e6e46da95e0b6f964fdcfda8084da38dea Issue-ID: SO-1612 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java17
2 files changed, 18 insertions, 2 deletions
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 e0b783fd9e..428736eddc 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
@@ -123,9 +123,8 @@ public class Service implements Serializable {
@JoinTable(name = "pnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
private List<PnfResourceCustomization> pnfCustomizations;
- @OneToMany(cascade = CascadeType.ALL)
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "service")
@MapKey(name = "action")
- @JoinColumn(name = "SERVICE_MODEL_UUID")
private Map<String, ServiceRecipe> recipes;
@ManyToOne(cascade = CascadeType.ALL)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java
index d063ea4809..79b27e7deb 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java
@@ -23,9 +23,13 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
@@ -74,6 +78,11 @@ public class ServiceRecipe implements Serializable, Recipe {
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
+
+ @BusinessKey
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "SERVICE_MODEL_UUID", referencedColumnName = "MODEL_UUID",insertable = false, updatable = false)
+ private Service service;
@PrePersist
protected void onCreate() {
@@ -177,6 +186,14 @@ public class ServiceRecipe implements Serializable, Recipe {
public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) {
this.serviceTimeoutInterim = serviceTimeoutInterim;
}
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
public Date getCreated() {
return created;