summaryrefslogtreecommitdiffstats
path: root/model/basic-model/src
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/basic-model/src
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/basic-model/src')
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java7
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java10
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java21
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java18
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java9
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java9
6 files changed, 5 insertions, 69 deletions
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java
index 1edbc9be9..f5d421956 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxArtifactKey.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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +23,6 @@ package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -41,7 +39,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* <p>Key validation checks that the name and version fields match the NAME_REGEXP and VERSION_REGEXP
* regular expressions respectively.
*/
-@Embeddable
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexArtifactKey", namespace = "http://www.onap.org/policy/apex-pdp")
@@ -54,11 +51,9 @@ public class AxArtifactKey extends AxKey {
private static final String NAME_TOKEN = "name";
private static final String VERSION_TOKEN = "version";
- @Column(name = NAME_TOKEN)
@XmlElement(required = true)
private String name;
- @Column(name = VERSION_TOKEN)
@XmlElement(required = true)
private String version;
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
index 2e788a3d5..9b96d3398 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInfo.java
@@ -25,10 +25,6 @@ package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.List;
import java.util.Random;
import java.util.UUID;
-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;
@@ -46,9 +42,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* blank and warns if the UUID is a zero UUID.
*/
-@Entity
-@Table(name = "AxKeyInfo")
-
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexKeyInfo", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlType(name = "AxKeyInfo", namespace = "http://www.onap.org/policy/apex-pdp",
@@ -65,15 +58,12 @@ public class AxKeyInfo extends AxConcept {
*/
private static final Random sharedRandom = new Random(); // NOSONAR
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
- @Column(name = "uuid")
@XmlElement(name = "UUID", required = true)
private UUID uuid;
- @Column(name = "description", length = MAX_DESCRIPTION_LENGTH_8192)
@XmlElement(required = true)
private String description;
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java
index 6da5ab3a8..d1cc99a22 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyInformation.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");
@@ -30,13 +30,6 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.UUID;
-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;
@@ -55,9 +48,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* the map is defined, that the key in each map entry matches the key if each entry value, and that no duplicate UUIDs
* exist. Each key information entry is then validated individually.
*/
-@Entity
-@Table(name = "AxKeyInformation")
-
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AxKeyInformation", namespace = "http://www.onap.org/policy/apex-pdp",
propOrder = { "key", "keyInfoMap" })
@@ -65,19 +55,10 @@ import org.onap.policy.common.utils.validation.Assertions;
public class AxKeyInformation extends AxConcept implements AxConceptGetter<AxKeyInfo> {
private static final long serialVersionUID = -2746380769017043888L;
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
- // @formatter:off
- @ManyToMany(cascade = CascadeType.ALL)
- @JoinTable(
- joinColumns = { @JoinColumn(name = "keyInfoMapName", referencedColumnName = "name"),
- @JoinColumn(name = "keyInfoMapVersion", referencedColumnName = "version"), },
- inverseJoinColumns = { @JoinColumn(name = "keyInfoName", referencedColumnName = "name"),
- @JoinColumn(name = "keyInfoVersion", referencedColumnName = "version") })
private Map<AxArtifactKey, AxKeyInfo> keyInfoMap;
- // @formatter:on
/**
* The Default Constructor creates this concept with a null key.
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java
index b29743c0b..5f63b9a3e 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxModel.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");
@@ -25,14 +25,6 @@ package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import javax.persistence.CascadeType;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-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;
@@ -56,10 +48,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* ensure that an {@link AxArtifactKey} instance exists for every {@link AxKeyInfo} instance.
*/
-@Entity
-@Table(name = "AxModel")
-@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
-
@XmlRootElement(name = "apexModel", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AxModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
@@ -70,14 +58,10 @@ public class AxModel extends AxConcept {
private static final long serialVersionUID = -771659065637205430L;
- @EmbeddedId
@XmlElement(name = "key", required = true)
private AxArtifactKey key;
// @formatter:off
- @OneToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "keyInformationName", referencedColumnName = "name")
- @JoinColumn(name = "keyInformationVersion", referencedColumnName = "version")
@XmlElement(name = "keyInformation", required = true)
@XmlJavaTypeAdapter(KeyInfoMarshalFilter.class)
private AxKeyInformation keyInformation;
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java
index 03a75a7fb..6c671d3e6 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxReferenceKey.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.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +23,6 @@ package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -50,7 +48,6 @@ import org.onap.policy.common.utils.validation.Assertions;
* VERSION_REGEXP regular expressions respectively and that the local name fields match the
* LOCAL_NAME_REGEXP regular expression.
*/
-@Embeddable
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexReferenceKey", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlType(name = "AxReferenceKey", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "parentKeyName",
@@ -76,19 +73,15 @@ public class AxReferenceKey extends AxKey {
private static final int PARENT_LOCAL_NAME_FIELD = 2;
private static final int LOCAL_NAME_FIELD = 3;
- @Column(name = PARENT_KEY_NAME)
@XmlElement(required = true)
private String parentKeyName;
- @Column(name = PARENT_KEY_VERSION)
@XmlElement(required = true)
private String parentKeyVersion;
- @Column(name = PARENT_LOCAL_NAME)
@XmlElement(required = true)
private String parentLocalName;
- @Column(name = LOCAL_NAME)
@XmlElement(required = true)
private String localName;
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java
index 2407dab38..cd8b52ce6 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java
@@ -1,7 +1,7 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020,2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,20 +23,13 @@ package org.onap.policy.apex.model.basicmodel.concepts;
import java.util.Arrays;
import java.util.List;
-import javax.persistence.EmbeddedId;
-import javax.persistence.Entity;
-import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
-@Entity
-@Table(name = "TestEntity")
-
public class DummyEntity extends AxConcept {
private static final long serialVersionUID = -2962570563281067894L;
- @EmbeddedId()
@XmlElement(name = "key", required = true)
@XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
protected AxReferenceKey key;