summaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main/java/org/onap
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2022-01-06 14:52:15 +0000
committera.sreekumar <ajith.sreekumar@bell.ca>2022-01-11 17:04:05 +0000
commit7a718bd9b82ac16e5d49a1a2fb2256682f020656 (patch)
tree4497fd1e56e60bec736fe4f2d30680e795560de8 /models-tosca/src/main/java/org/onap
parent5da73554e8fdc16864338f9b796418777cacb660 (diff)
Fix issues in existing entity classes
Issues identified in the entity classes are fixed in this review. Some fixes doesn't affect the table structure at all. Tables actually affected by some of these fixes are not really used today, and doesn't contain any data. A separate review is raised for the db-migrator changes. Change-Id: I0efdf2c5f17e12225f1b443b5fe8e27c578229f7 Issue-ID: POLICY-3871 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'models-tosca/src/main/java/org/onap')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java8
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java7
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java9
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java8
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java8
6 files changed, 23 insertions, 21 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
index cd6656b4c..09c406ea6 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -27,6 +28,7 @@ import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import lombok.Data;
@@ -55,6 +57,8 @@ public class JpaToscaModel extends PfModel {
private static final long serialVersionUID = 8800599637708309945L;
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true)
+ @JoinColumn(name = "serviceTemplatesName", referencedColumnName = "name")
+ @JoinColumn(name = "serviceTemplatesVersion", referencedColumnName = "version")
@Valid
private JpaToscaServiceTemplates serviceTemplates;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
index 9b023dcba..552d9c15c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaParameter.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
* Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -24,10 +25,6 @@ package org.onap.policy.models.tosca.simple.concepts;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@@ -45,9 +42,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaParameter;
/**
* Class to represent the parameter in TOSCA definition.
*/
-@Entity
-@Table(name = "ToscaParameter")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
public class JpaToscaParameter extends PfConcept implements PfAuthorative<ToscaParameter> {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index 76861d294..feae48e1a 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -25,10 +26,12 @@ package org.onap.policy.models.tosca.simple.concepts;
import java.util.LinkedHashMap;
import java.util.List;
+import javax.persistence.CollectionTable;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.ws.rs.core.Response;
import lombok.Data;
@@ -67,6 +70,10 @@ public class JpaToscaPolicy extends JpaToscaWithTypeAndStringProperties<ToscaPol
private static final StandardCoder STANDARD_CODER = new StandardCoder();
@ElementCollection
+ @CollectionTable(joinColumns = {
+ @JoinColumn(name = "toscaPolicyName", referencedColumnName = "name"),
+ @JoinColumn(name = "toscaPolicyVersion", referencedColumnName = "version")
+ })
private List<@NotNull @Valid PfConceptKey> targets;
/**
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
index f6c1a7c4e..dfdf7ed9b 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -24,10 +25,13 @@
package org.onap.policy.models.tosca.simple.concepts;
import java.util.List;
+import javax.persistence.CollectionTable;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.Lob;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -59,9 +63,14 @@ public class JpaToscaPolicyType extends JpaToscaWithToscaProperties<ToscaPolicyT
private static final long serialVersionUID = -563659852901842616L;
@ElementCollection
+ @CollectionTable(joinColumns = {
+ @JoinColumn(name = "toscaPolicyTypeName", referencedColumnName = "name"),
+ @JoinColumn(name = "toscaPolicyTypeVersion", referencedColumnName = "version")
+ })
private List<@NotNull @Valid PfConceptKey> targets;
@ElementCollection
+ @Lob
private List<@NotNull @Valid JpaToscaTrigger> triggers;
/**
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
index f49c0ea81..73b9faba8 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -30,10 +31,6 @@ import java.util.Map;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@@ -58,9 +55,6 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty.Status;
* @author Chenfei Gao (cgao@research.att.com)
* @author Liam Fallon (liam.fallon@est.tech)
*/
-@Entity
-@Table(name = "ToscaProperty")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
public class JpaToscaProperty extends PfConcept implements PfAuthorative<ToscaProperty> {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
index 546ea073f..1e13b225c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2022 Bell Canada. 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.
@@ -28,10 +29,6 @@ import java.time.Duration;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
@@ -51,9 +48,6 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey;
* @author Chenfei Gao (cgao@research.att.com)
* @author Liam Fallon (liam.fallon@est.tech)
*/
-@Entity
-@Table(name = "ToscaTrigger")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
public class JpaToscaTrigger extends PfConcept {