summaryrefslogtreecommitdiffstats
path: root/model/context-model
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2022-02-04 10:34:28 +0000
committerliamfallon <liam.fallon@est.tech>2022-02-04 10:45:06 +0000
commitdef44b294fa00bb5470e977eef9a05e5087035f0 (patch)
treefe328c7c770d01fd0fa8e28c10bfe7cbebee4f3c /model/context-model
parentde18be8467912348ea73c7f5557397bab9ba86b3 (diff)
Remove JPA annotations from apex-pdp code
This review is part of a series of reviews to move the apex-pdp state machine model to use the base model types in policy models. Persistence of policies for apex-pdp is now implemented in PAP and API. The historic direct load and save functionality for APEX policy state machine models to and from databases is no longer used and no longer supported. This commit removes JPA annotations form apex-pdp code. Subsequent reviews will mvoe the mdoel across to use the policy models base model types. Issue-ID: POLICY-1820 Change-Id: I91a45a0ca6c88f9ba4b201bad920065f95ffb31e Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/context-model')
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java19
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java18
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java18
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java10
-rw-r--r--model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java21
5 files changed, 4 insertions, 82 deletions
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
index b3880bd8c..d7d8a1d96 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbum.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,12 +23,6 @@
package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
-import javax.persistence.AttributeOverride;
-import javax.persistence.Column;
-import javax.persistence.Embedded;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -67,8 +61,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* <p>Validation checks that the album key and the context schema key are not null and that the scope field is not
* undefined and matches the regular expression SCOPE_REGEXP.
*/
-@Entity
-@Table(name = "AxContextAlbum")
@Getter
@ToString
@@ -92,27 +84,18 @@ public class AxContextAlbum extends AxConcept {
/** The value of scope for a context album for which a scope has not been specified. */
public static final String SCOPE_UNDEFINED = "UNDEFINED";
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
- @Column(name = SCOPE_STRING)
@XmlElement(name = SCOPE_STRING, required = true)
private String scope;
- @Column(name = "isWritable")
@XmlElement(name = "isWritable", required = true)
@Setter
private boolean isWritable;
- // @formatter:off
- @Embedded
- @AttributeOverride(name = "name", column = @Column(name = "itemSchemaName"))
- @AttributeOverride(name = "version", column = @Column(name = "itemSchemaVersion"))
- @Column(name = "itemSchema")
@XmlElement(name = "itemSchema", required = true)
private AxArtifactKey itemSchema;
- // @formatter:on
/**
* The default constructor creates a context album with a null artifact key. The scope of the context album is set
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
index aa5a89a4d..65247ab80 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextAlbums.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,13 +28,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
-import javax.persistence.CascadeType;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -65,9 +58,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* map key matches the key in the map value for all album entries. Each context album entry is then validated
* individually.
*/
-@Entity
-@Table(name = "AxContextAlbums")
-
@Getter
@ToString
@EqualsAndHashCode(callSuper = false)
@@ -79,18 +69,12 @@ import org.onap.policy.common.utils.validation.Assertions;
public final class AxContextAlbums extends AxConcept implements AxConceptGetter<AxContextAlbum> {
private static final long serialVersionUID = -4844259809024470975L;
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
- // @formatter:off
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(joinColumns = {@JoinColumn(name = "contextName", referencedColumnName = "name"),
- @JoinColumn(name = "contextVersion", referencedColumnName = "version")})
@XmlElement(name = "albums", required = true)
@Getter(AccessLevel.NONE)
private Map<AxArtifactKey, AxContextAlbum> albums;
- // @formatter:on
/**
* The Default Constructor creates a {@link AxContextAlbums} object with a null artifact key and creates an empty
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
index 9796fa625..e17149336 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextModel.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,11 +23,6 @@
package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
-import javax.persistence.CascadeType;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -54,9 +49,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
* {@link AxContextAlbums} validation is run on the context schemas and albums in the model.
*/
-@Entity
-@Table(name = "AxContextModel")
-
@Getter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@@ -69,19 +61,11 @@ import org.onap.policy.common.utils.validation.Assertions;
public class AxContextModel extends AxModel {
private static final long serialVersionUID = 8800599637708309945L;
- // @formatter:off
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "schemasName", referencedColumnName = "name")
- @JoinColumn(name = "schemasVersion", referencedColumnName = "version")
@XmlElement(name = "schemas", required = true)
private AxContextSchemas schemas;
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "albumsName", referencedColumnName = "name")
- @JoinColumn(name = "albumsVersion", referencedColumnName = "version")
@XmlElement(name = "albums", required = true)
private AxContextAlbums albums;
- // @formatter:on
/**
* The Default Constructor creates a {@link AxContextModel} object with a null artifact key and creates an empty
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
index def22f434..a1560c07b 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchema.java
@@ -23,10 +23,6 @@
package org.onap.policy.apex.model.contextmodel.concepts;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -61,9 +57,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* the regular expression SCHEMA_FLAVOUR_REGEXP. Finally, validation checks that the defined schema is not a blank or
* empty string.
*/
-@Entity
-@Table(name = "AxContextSchema")
-
@Getter
@ToString
@@ -87,15 +80,12 @@ public class AxContextSchema extends AxConcept {
/** The maximum permissible size of a schema definition. */
public static final int MAX_SCHEMA_SIZE = 32672; // The maximum size supported by Apache Derby
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
- @Column(name = SCHEMA_FLAVOUR)
@XmlElement(required = true)
private String schemaFlavour;
- @Column(name = "schemaDefinition", length = MAX_SCHEMA_SIZE)
@XmlElement(name = "schemaDefinition", required = true)
@Getter(AccessLevel.NONE)
private String schemaDefinition;
diff --git a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
index 1fa0cf57a..a5b56f244 100644
--- a/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
+++ b/model/context-model/src/main/java/org/onap/policy/apex/model/contextmodel/concepts/AxContextSchemas.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,13 +28,6 @@ import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Set;
import java.util.TreeMap;
-import javax.persistence.CascadeType;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.Table;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -64,9 +57,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* container. Each context schema entry is checked to ensure that its key and value are not null and that the key
* matches the key in the map value. Each context schema entry is then validated individually.
*/
-@Entity
-@Table(name = "AxContextSchemas")
-
@Getter
@ToString
@EqualsAndHashCode(callSuper = false)
@@ -78,21 +68,12 @@ import org.onap.policy.common.utils.validation.Assertions;
public class AxContextSchemas extends AxConcept implements AxConceptGetter<AxContextSchema> {
private static final long serialVersionUID = -3203734282886453582L;
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
- // @formatter:off
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = {@JoinColumn(name = "contextSchemasName", referencedColumnName = "name"),
- @JoinColumn(name = "contextSchemasVersion", referencedColumnName = "version")},
- inverseJoinColumns = {@JoinColumn(name = "contextSchemaName", referencedColumnName = "name"),
- @JoinColumn(name = "contextSchemaVersion", referencedColumnName = "version")})
@XmlElement(name = "schemas", required = true)
@Getter(AccessLevel.NONE)
private Map<AxArtifactKey, AxContextSchema> schemas;
- // @formatter:on
/**
* The Default Constructor creates a {@link AxContextSchemas} object with a null artifact key and creates an empty