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/policy-model/src | |
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/policy-model/src')
13 files changed, 27 insertions, 305 deletions
diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java index 4cb55e1d7..a7cb97a46 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxLogic.java @@ -22,12 +22,6 @@ package org.onap.policy.apex.model.policymodel.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 javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -56,10 +50,6 @@ import org.onap.policy.common.utils.validation.Assertions; * the {@code LOGIC_FLAVOUR_REGEXP} regular expression, and that the specified logic string is not null or blank. */ -@Entity -@Table(name = "AxLogic") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexLogic", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxLogic", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = @@ -84,16 +74,13 @@ public class AxLogic extends AxConcept { /** The maximum permissible size of a logic definition. */ public static final int MAX_LOGIC_SIZE = 32672; // The maximum size supported by Apache Derby - @EmbeddedId() @XmlElement(name = "key", required = true) @XmlJavaTypeAdapter(AxReferenceKeyAdapter.class) private AxReferenceKey key; - @Column(name = LOGIC_FLAVOUR_TOKEN) @XmlElement(required = true) private String logicFlavour; - @Column(name = "logic", length = MAX_LOGIC_SIZE) @XmlElement(required = true) private String logic; diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java index 922cc247a..4073046ab 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicies.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 policy 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 policy entry is then validated individually. */ -@Entity -@Table(name = "AxPolicies") - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxPolicies", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "policyMap" }) @@ -69,20 +59,11 @@ import org.onap.policy.common.utils.validation.Assertions; public class AxPolicies extends AxConcept implements AxConceptGetter<AxPolicy> { 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 = "policyMapName", referencedColumnName = "name"), - @JoinColumn(name = "policyMapVersion", referencedColumnName = "version")}, - inverseJoinColumns = {@JoinColumn(name = "policyName", referencedColumnName = "name"), - @JoinColumn(name = "policyVersion", referencedColumnName = "version")}) @XmlElement(required = true) private Map<AxArtifactKey, AxPolicy> policyMap; - // @formatter:on /** * The Default Constructor creates a {@link AxPolicies} object with a null artifact key and creates an empty event diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java index 4baba0029..64785daef 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicy.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,14 +27,6 @@ import java.util.Map.Entry; import java.util.Set; 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.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.OneToMany; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -79,8 +71,6 @@ import org.slf4j.ext.XLoggerFactory; * </ol> */ -@Entity -@Table(name = "AxPolicy") @XmlRootElement(name = "apexPolicy", namespace = "http://www.onap.org/policy/apex-pdp") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxPolicy", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = @@ -92,23 +82,15 @@ public class AxPolicy extends AxConcept { // Logger for this class private static final XLogger LOGGER = XLoggerFactory.getXLogger(AxPolicy.class); - @EmbeddedId @XmlElement(name = "policyKey", required = true) private AxArtifactKey key; - @Column(name = "template") @XmlElement(required = true) private String template; - // @formatter:off - @OneToMany(cascade = CascadeType.ALL) - @JoinTable(joinColumns = {@JoinColumn(name = "parentKeyName", referencedColumnName = "name"), - @JoinColumn(name = "parentKeyVersion", referencedColumnName = "version")}) @XmlElement(name = "state", required = true) private Map<String, AxState> stateMap; - // @formatter:on - @Column(name = "firstState") @XmlElement(required = true) private String firstState; diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java index aec144a46..38c08ed94 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxPolicyModel.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. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ @@ -25,11 +25,6 @@ package org.onap.policy.apex.model.policymodel.concepts; import java.util.List; import java.util.Map.Entry; -import javax.persistence.CascadeType; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.OneToOne; -import javax.persistence.Table; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; @@ -103,9 +98,6 @@ import org.onap.policy.common.utils.validation.Assertions; * <li>All events referred to on direct state outputs must exist * </ol> */ -@Entity -@Table(name = "AxPolicyModel") - @XmlRootElement(name = "apexPolicyModel", namespace = "http://www.onap.org/policy/apex-pdp") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxPolicyModel", namespace = "http://www.onap.org/policy/apex-pdp", @@ -116,38 +108,21 @@ public class AxPolicyModel extends AxModel { private static final long serialVersionUID = 8800599637708309945L; - // @formatter:off - @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "policiesName", referencedColumnName = "name") - @JoinColumn(name = "policiesVersion", referencedColumnName = "version") @XmlElement(name = "policies", required = true) private AxPolicies policies; - @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "tasksName", referencedColumnName = "name") - @JoinColumn(name = "tasksVersion", referencedColumnName = "version") @XmlElement(name = "tasks", required = true) private AxTasks tasks; - @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "eventsName", referencedColumnName = "name") - @JoinColumn(name = "eventsVersion", referencedColumnName = "version") @XmlElement(name = "events", required = true) private AxEvents events; - @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "albumsName", referencedColumnName = "name") - @JoinColumn(name = "albumsVersion", referencedColumnName = "version") @XmlElement(name = "albums", required = false) @XmlJavaTypeAdapter(EmptyAlbumsAdapter.class) private AxContextAlbums albums; - @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "schemasName", referencedColumnName = "name") - @JoinColumn(name = "schemasVersion", referencedColumnName = "version") @XmlElement(name = "schemas", required = true) private AxContextSchemas schemas; - // @formatter:on /** * The Default Constructor creates a policy model with a null key and empty containers for diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java index 78a96a1f2..df07b0ea3 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxState.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2018 Samsung Electronics Co., Ltd. - * 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"); @@ -29,19 +29,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; -import javax.persistence.AttributeOverride; -import javax.persistence.CascadeType; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Embedded; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.ManyToMany; -import javax.persistence.OneToOne; -import javax.persistence.Table; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -120,9 +107,6 @@ import org.onap.policy.common.utils.validation.Assertions; * </ol> */ -@Entity -@Table(name = "AxState") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexState", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxState", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = @@ -134,86 +118,29 @@ public class AxState extends AxConcept { private static final long serialVersionUID = 8041771382337655535L; - @EmbeddedId @XmlElement(name = "stateKey", required = true) private AxReferenceKey key; - // @formatter:off - @Embedded - @AttributeOverride(name = "name", column = @Column(name = "inTriggerName")) - @AttributeOverride(name = "version", column = @Column(name = "inTriggerVersion")) - @Column(name = "trigger") @XmlElement(required = true) private AxArtifactKey trigger; - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable( - joinColumns = {@JoinColumn(name = "soParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "soParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "soParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "soLocalName", referencedColumnName = "localName")}, - inverseJoinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")}) @XmlElement(name = "stateOutputs", required = true) private Map<String, AxStateOutput> stateOutputs; - @ElementCollection - @CollectionTable(joinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")}) @XmlElement(name = "contextAlbumReference") private Set<AxArtifactKey> contextAlbumReferenceSet; - @OneToOne - @JoinTable(name = "STATE_TSL_JT", - joinColumns = { - @JoinColumn(name = "tslParentKeyName", referencedColumnName = "parentKeyName", updatable = false, - insertable = false), - @JoinColumn(name = "tslParentKeyVersion", referencedColumnName = "parentKeyVersion", - updatable = false, insertable = false), - @JoinColumn(name = "tslParentLocalName ", referencedColumnName = "parentLocalName", - updatable = false, insertable = false), - @JoinColumn(name = "tslLocalName", referencedColumnName = "localName", updatable = false, - insertable = false)}) @XmlElement(required = true) private AxTaskSelectionLogic taskSelectionLogic; - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable( - joinColumns = {@JoinColumn(name = "sflParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "sflParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "sflParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "sflLocalName", referencedColumnName = "localName")}, - inverseJoinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")}) @XmlElement(name = "stateFinalizerLogicMap", required = true) private Map<String, AxStateFinalizerLogic> stateFinalizerLogicMap; - @Embedded - @AttributeOverride(name = "name", column = @Column(name = "defaultTaskName")) - @AttributeOverride(name = "version", column = @Column(name = "defaultTaskVersion")) - @Column(name = "defaultTask") @XmlElement(required = true) private AxArtifactKey defaultTask; - @ManyToMany(cascade = CascadeType.ALL) - @JoinTable( - joinColumns = {@JoinColumn(name = "trmParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "trmParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "trmParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "trmLocalName", referencedColumnName = "localName")}, - inverseJoinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")}) @XmlElement(name = "taskReferences", required = true) private Map<AxArtifactKey, AxStateTaskReference> taskReferenceMap; - // @formatter:on /** * The Default Constructor creates a state with a null reference key and with default values for all other fields. diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java index 0b5d9751e..51ec51a8f 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateFinalizerLogic.java @@ -1,29 +1,26 @@ /*- * ============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. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.model.policymodel.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; @@ -33,19 +30,15 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class holds State Finalizer Logic for {@link AxState} states in Apex. It is a specialization * of the {@link AxLogic} class, so that State Finalizer Logic in Apex states can be strongly typed. - * + * * <p>State Finalizer Logic is used to select the output {@link AxStateOutput} that a state will use. * The logic uses fields emitted by the executed {@link AxTask} task and information from the * context albums available on a state to decide what state output {@link AxStateOutput} to select * in a given context. State Finalizer Logic must marshal the output fields from the task onto the * output event in whatever manner is appropriate for the domain being handled. - * + * * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. */ -@Entity -@Table(name = "AxStateFinalizerLogic") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexStateFinalizerLogic", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxStateFinalizerLogic", namespace = "http://www.onap.org/policy/apex-pdp") diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java index 59433dccd..b90f2c84d 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateOutput.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. * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. * ================================================================================ @@ -25,15 +25,6 @@ package org.onap.policy.apex.model.policymodel.concepts; import java.util.List; import java.util.Set; -import javax.persistence.AttributeOverride; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Embedded; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -70,9 +61,6 @@ import org.onap.policy.common.utils.validation.Assertions; * </ol> */ -@Entity -@Table(name = "AxStateOutput") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexStateOutput", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxStateOutput", namespace = "http://www.onap.org/policy/apex-pdp", @@ -82,34 +70,17 @@ import org.onap.policy.common.utils.validation.Assertions; public class AxStateOutput extends AxConcept { private static final long serialVersionUID = 8041771382337655535L; - @EmbeddedId @XmlElement(name = "key", required = true) @NonNull private AxReferenceKey key; - // @formatter:off - @Embedded - @AttributeOverride(name = "name", column = @Column(name = "outgoingEventName")) - @AttributeOverride(name = "version", column = @Column(name = "outgoingEventVersion")) - @Column(name = "outgoingEvent") @XmlElement(required = true) @NonNull private AxArtifactKey outgoingEvent; - @ElementCollection - @CollectionTable(joinColumns = {@JoinColumn(name = "stateParentKeyName", referencedColumnName = "parentKeyName"), - @JoinColumn(name = "stateParentKeyVersion", referencedColumnName = "parentKeyVersion"), - @JoinColumn(name = "stateParentLocalName", referencedColumnName = "parentLocalName"), - @JoinColumn(name = "stateLocalName", referencedColumnName = "localName")}) @XmlElement(name = "outgoingEventReference", required = false) private Set<AxArtifactKey> outgoingEventSet; - @Embedded - @AttributeOverride(name = "parentKeyName", column = @Column(name = "nextStateParentKeyName")) - @AttributeOverride(name = "parentKeyVersion", column = @Column(name = "nextStateParentKeyVersion")) - @AttributeOverride(name = "parentLocalName", column = @Column(name = "nextStateParentLocalName")) - @AttributeOverride(name = "localName", column = @Column(name = "nextStateLocalName")) - @Column(name = "nextState") @XmlElement(required = true) @NonNull private AxReferenceKey nextState; diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java index c98e38fbf..711e1842b 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxStateTaskReference.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,13 +23,6 @@ package org.onap.policy.apex.model.policymodel.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.Enumerated; -import javax.persistence.Table; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -69,9 +62,6 @@ import org.onap.policy.common.utils.validation.Assertions; * </ol> */ -@Entity -@Table(name = "AxStateTaskReference") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexStateTaskReference", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxStateTaskReference", namespace = "http://www.onap.org/policy/apex-pdp", @@ -80,25 +70,14 @@ import org.onap.policy.common.utils.validation.Assertions; public class AxStateTaskReference extends AxConcept { private static final long serialVersionUID = 8041771382337655535L; - @EmbeddedId @XmlElement(name = "key", required = true) private AxReferenceKey key; - @Enumerated - @Column(name = "outputType") @XmlElement(required = true) private AxStateTaskOutputType outputType; - // @formatter:off - @Embedded - @AttributeOverride(name = "parentKeyName", column = @Column(name = "outputParentKeyName")) - @AttributeOverride(name = "parentKeyVersion", column = @Column(name = "outputParentKeyVersion")) - @AttributeOverride(name = "parentLocalName", column = @Column(name = "outputParentLocalName")) - @AttributeOverride(name = "localName", column = @Column(name = "outputLocalName")) - @Column(name = "output") @XmlElement(required = true) private AxReferenceKey output; - // @formatter:on /** * The Default Constructor creates a state task reference with a null reference key, an diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java index 7eba99af0..3911a1f97 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTask.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 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,16 +28,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; -import javax.persistence.CascadeType; -import javax.persistence.CollectionTable; -import javax.persistence.ElementCollection; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.JoinColumn; -import javax.persistence.JoinTable; -import javax.persistence.OneToMany; -import javax.persistence.OneToOne; -import javax.persistence.Table; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -82,9 +72,6 @@ import org.onap.policy.common.utils.validation.Assertions; * </ol> */ -@Entity -@Table(name = "AxTask") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexTask", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType( @@ -99,41 +86,23 @@ public class AxTask extends AxConcept { private static final long serialVersionUID = 5374237330697362762L; - @EmbeddedId @XmlElement(name = "key", required = true) @NonNull private AxArtifactKey key; - @OneToOne(cascade = CascadeType.ALL) - @JoinTable( - name = "INPUT_EVENT_JT", - joinColumns = {@JoinColumn(name = "inEventTaskName", referencedColumnName = "name", updatable = false), - @JoinColumn(name = "inEventTaskVersion", referencedColumnName = "version", updatable = false)}) @XmlElement(name = "inputEvent", required = false) private AxEvent inputEvent; - @OneToMany(cascade = CascadeType.ALL) - @JoinTable( - name = "OUTPUT_EVENT_JT", - joinColumns = {@JoinColumn(name = "outEventTaskName", referencedColumnName = "name", updatable = false), - @JoinColumn(name = "outEventTaskVersion", referencedColumnName = "version", updatable = false)}) @XmlElement(name = "outputEvents", required = false) private Map<String, AxEvent> outputEvents; - @OneToMany(cascade = CascadeType.ALL) @XmlElement(name = "taskParameters", required = true) private Map<String, AxTaskParameter> taskParameters; - // @formatter:off - @ElementCollection - @CollectionTable(joinColumns = {@JoinColumn(name = "contextAlbumName", referencedColumnName = "name"), - @JoinColumn(name = "contextAlbumVersion", referencedColumnName = "version")}) @XmlElement(name = "contextAlbumReference") @NonNull private Set<AxArtifactKey> contextAlbumReferenceSet; - // @formatter:on - @OneToOne(cascade = CascadeType.ALL) @XmlElement(required = true) @NonNull private AxTaskLogic taskLogic; diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java index 70b19ec48..38c0d6daf 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskLogic.java @@ -1,29 +1,26 @@ /*- * ============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. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.model.policymodel.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,17 +31,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class holds Task Logic for {@link AxTask} tasks in Apex. It is a specialization of the * {@link AxLogic} class, so that Task Logic in Apex states can be strongly typed. - * + * * <p>Task Logic is used to execute tasks {@link AxTask} in Apex. The logic uses fields on the incoming * trigger event and information from the context albums available on a task to get context during * execution. The task logic populates the output fields of the task. - * + * * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. */ -@Entity -@Table(name = "AxTaskLogic") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexLogic", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxTaskLogic", namespace = "http://www.onap.org/policy/apex-pdp") diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java index 47c62e6ae..7cb052a7f 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskParameter.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. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,6 @@ package org.onap.policy.apex.model.policymodel.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; @@ -47,9 +43,6 @@ import org.onap.policy.common.utils.validation.Assertions; * default value. */ -@Entity -@Table(name = "AxTaskParameter") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexTaskParameter", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxTaskParameter", namespace = "http://www.onap.org/policy/apex-pdp", @@ -58,11 +51,9 @@ import org.onap.policy.common.utils.validation.Assertions; public class AxTaskParameter extends AxConcept { private static final long serialVersionUID = 7351688156934099977L; - @EmbeddedId @XmlElement(name = "key", required = true) private AxReferenceKey key; - @Column(name = "defaultValue") @XmlElement private String defaultValue; diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java index 5d6441a4d..43b8f11a6 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTaskSelectionLogic.java @@ -1,29 +1,26 @@ /*- * ============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. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * + * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.apex.model.policymodel.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; @@ -33,17 +30,13 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey; /** * This class holds Task Selection Logic for {@link AxState} states in Apex. It is a specialization * of the {@link AxLogic} class, so that Task Selection Logic in Apex states can be strongly typed. - * + * * <p>Task Selection Logic is used to select the task {@link AxTask} that a state will execute. The * logic uses fields on the incoming trigger event and information from the context albums available * on a state to decide what task {@link AxTask} to select for execution in a given context. - * + * * <p>Validation uses standard Apex Logic validation, see validation in {@link AxLogic}. */ -@Entity -@Table(name = "AxTaskSelectionLogic") -@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxTaskSelectionLogic", namespace = "http://www.onap.org/policy/apex-pdp") diff --git a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java index 73012d8bc..bae50e061 100644 --- a/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.java +++ b/model/policy-model/src/main/java/org/onap/policy/apex/model/policymodel/concepts/AxTasks.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,28 +52,16 @@ import org.onap.policy.common.utils.validation.Assertions; * in the container. Each task 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 task entry is then validated individually. */ -@Entity -@Table(name = "AxTasks") - @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxTasks", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "taskMap"}) public class AxTasks extends AxConcept implements AxConceptGetter<AxTask> { 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 = "taskMapName", referencedColumnName = "name"), - @JoinColumn(name = "taskMapVersion", referencedColumnName = "version")}, - inverseJoinColumns = {@JoinColumn(name = "taskName", referencedColumnName = "name"), - @JoinColumn(name = "taskVersion", referencedColumnName = "version")}) @XmlElement(required = true) private Map<AxArtifactKey, AxTask> taskMap; - // @formatter:on /** * The Default Constructor creates a {@link AxTasks} object with a null artifact key and creates |