diff options
author | liamfallon <liam.fallon@est.tech> | 2022-02-04 10:34:28 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2022-02-04 10:45:06 +0000 |
commit | def44b294fa00bb5470e977eef9a05e5087035f0 (patch) | |
tree | fe328c7c770d01fd0fa8e28c10bfe7cbebee4f3c /model/event-model/src/main/java/org | |
parent | de18be8467912348ea73c7f5557397bab9ba86b3 (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/event-model/src/main/java/org')
6 files changed, 7 insertions, 91 deletions
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java index e3663e702..8128b3d9a 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-2020,2022 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,12 +31,6 @@ import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import java.util.TreeSet; -import javax.persistence.CascadeType; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -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; @@ -75,9 +69,6 @@ import org.onap.policy.common.utils.validation.Assertions; * is checked to ensure it matches the event parameter key on the event. Finally, the parent key of each parameter is * checked to ensure it matches the event key. */ -@Entity -@Table(name = "AxEvent") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexEvent", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = @@ -89,29 +80,23 @@ public class AxEvent extends AxConcept { private static final String WHITESPACE_REGEXP = "\\s+$"; /** The key of the event, unique in the Apex system. */ - @EmbeddedId @XmlElement(name = "key", required = true) // CHECKSTYLE:OFF: checkstyle:VisibilityMonitor protected AxArtifactKey key; // CHECKSTYLE:ON: checkstyle:VisibilityMonitor - @Column(name = "nameSpace") @XmlElement(required = true) private String nameSpace; - @Column(name = "source") @XmlElement(required = true) private String source; - @Column(name = "target") @XmlElement(required = true) private String target; - @OneToMany(cascade = CascadeType.ALL) @XmlElement(name = "parameter", required = true) private Map<String, AxField> parameterMap; - @Column(name = "toscaPolicyState") @XmlElement(required = false) private String toscaPolicyState; @@ -581,4 +566,4 @@ public class AxEvent extends AxConcept { return 0; } -}
\ No newline at end of file +} diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java index 511d4f3d0..bb4307604 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 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.eventmodel.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; @@ -52,9 +47,6 @@ import org.onap.policy.common.utils.validation.Assertions; * {@link AxEvents} validation is run on the context schemas and events in the model. */ -@Entity -@Table(name = "AxEventModel") - @XmlRootElement(name = "apexEventModel", namespace = "http://www.onap.org/policy/apex-pdp") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxEventModel", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "schemas", "events" }) @@ -62,19 +54,11 @@ import org.onap.policy.common.utils.validation.Assertions; public class AxEventModel 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 = "eventsName", referencedColumnName = "name") - @JoinColumn(name = "eventsVersion", referencedColumnName = "version") @XmlElement(name = "events", required = true) private AxEvents events; - // @formatter:on /** * The Default Constructor creates a {@link AxEventModel} object with a null artifact key and creates an empty event diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java index ea4ec57a4..26275a157 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-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. @@ -27,13 +27,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; @@ -59,9 +52,6 @@ import org.onap.policy.common.utils.validation.Assertions; * container. Each event 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 event entry is then validated individually. */ -@Entity -@Table(name = "AxEvents") - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "eventMap" }) @@ -69,20 +59,11 @@ import org.onap.policy.common.utils.validation.Assertions; public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> { private static final long serialVersionUID = 4290442590545820316L; - @EmbeddedId @XmlElement(name = "key", required = true) private AxArtifactKey key; - // @formatter:off - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable( - joinColumns = { @JoinColumn(name = "eventMapName", referencedColumnName = "name"), - @JoinColumn(name = "eventMapVersion", referencedColumnName = "version") }, - inverseJoinColumns = { @JoinColumn(name = "eventName", referencedColumnName = "name"), - @JoinColumn(name = "eventVersion", referencedColumnName = "version") }) @XmlElement(required = true) private Map<AxArtifactKey, AxEvent> eventMap; - // @formatter:on /** * The Default Constructor creates a {@link AxEvents} object with a null artifact key and creates an empty event diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java index 654a83ced..9f98a6253 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 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,14 +23,6 @@ package org.onap.policy.apex.model.eventmodel.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.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -58,10 +50,6 @@ import org.onap.policy.common.utils.validation.Assertions; * * <p>Validation checks that the field key and the field schema reference key are not null. */ -@Entity -@Table(name = "AxField") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexField", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = @@ -76,21 +64,13 @@ public class AxField extends AxConcept { private static final int HASH_PRIME_0 = 1231; private static final int HASH_PRIME_1 = 1237; - @EmbeddedId() @XmlElement(name = "key", required = true) @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class) private AxReferenceKey key; - // @formatter:off - @Embedded - @AttributeOverride(name = "name", column = @Column(name = "fieldSchemaName")) - @AttributeOverride(name = "version", column = @Column(name = "fieldSchemaVersion")) - @Column(name = "fieldSchemaKey") @XmlElement(required = true) private AxArtifactKey fieldSchemaKey; - // @formatter:on - @Column(name = "optional") @XmlElement(required = false) private boolean optional; diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java index 176699184..2626e8b25 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxInputField.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 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. @@ -20,10 +21,6 @@ package org.onap.policy.apex.model.eventmodel.concepts; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @@ -34,10 +31,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class specializes the {@link AxField} class for use as input fields on events. */ -@Entity -@Table(name = "AxInputField") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexInputField", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxInputField", namespace = "http://www.onap.org/policy/apex-pdp") diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java index f224739eb..a3e835202 100644 --- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java +++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxOutputField.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 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. @@ -20,10 +21,6 @@ package org.onap.policy.apex.model.eventmodel.concepts; -import javax.persistence.Entity; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @@ -34,10 +31,6 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class specializes the {@link AxField} class for use as output fields on events. */ -@Entity -@Table(name = "AxOutputField") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexOutputField", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxOutputField", namespace = "http://www.onap.org/policy/apex-pdp") |