diff options
Diffstat (limited to 'model')
33 files changed, 47 insertions, 588 deletions
diff --git a/model/basic-model/pom.xml b/model/basic-model/pom.xml index a0b9f085d..4d7930298 100644 --- a/model/basic-model/pom.xml +++ b/model/basic-model/pom.xml @@ -1,6 +1,6 @@ <!-- ============LICENSE_START======================================================= - Copyright (c) 2020 Nordix Foundation. + 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. @@ -52,10 +52,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>org.eclipse.persistence</groupId> - <artifactId>eclipselink</artifactId> - </dependency> - <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>${version.javax.bind}</version> 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; 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 diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java index 23310b219..97e85c596 100644 --- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.java +++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineModel.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"); @@ -24,11 +24,6 @@ package org.onap.policy.apex.model.enginemodel.concepts; import java.text.SimpleDateFormat; import java.util.List; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Enumerated; -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; @@ -58,8 +53,6 @@ import org.onap.policy.common.utils.validation.Assertions; * <p>Validation checks that the current state {@link AxEngineState} is defined and that the time stamp * is set on the engine model. */ -@Entity -@Table(name = "AxEngineModel") @XmlRootElement(name = "apexEngineModel", namespace = "http://www.onap.org/policy/apex-pdp") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "AxEngineModel", namespace = "http://www.onap.org/policy/apex-pdp", @@ -69,21 +62,11 @@ public class AxEngineModel extends AxContextModel { private static final long serialVersionUID = 6381235864606564046L; private static final int HASH_CODE_PRIME = 32; - @Column(name = "timestamp") private long timestamp; - @Enumerated - @Column(name = "state") @XmlElement(required = true) private AxEngineState state; - @JoinColumn(name = "statsParentKeyName", referencedColumnName = "parentKeyName", updatable = false, - insertable = false) - @JoinColumn(name = "statsParentKeyVersion", referencedColumnName = "parentKeyVersion", updatable = false, - insertable = false) - @JoinColumn(name = "statsParentLocalName ", referencedColumnName = "parentLocalName", updatable = false, - insertable = false) - @JoinColumn(name = "statsLocalName", referencedColumnName = "localName", updatable = false, insertable = false) private AxEngineStats stats; /** diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java index 39a90800d..af5e8d458 100644 --- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java +++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.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"); @@ -26,11 +26,6 @@ import io.prometheus.client.Gauge; import io.prometheus.client.Histogram; import java.text.SimpleDateFormat; import java.util.List; -import javax.persistence.Column; -import javax.persistence.EmbeddedId; -import javax.persistence.Entity; -import javax.persistence.Table; -import javax.persistence.Transient; 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; * engine, and the time stamp of the last engine start are recorded. */ -@Entity -@Table(name = "AxEngineStats") - @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "apexEngineStats", namespace = "http://www.onap.org/policy/apex-pdp") @XmlType(name = "AxEngineStats", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "timeStamp", @@ -79,35 +71,27 @@ public class AxEngineStats extends AxConcept { .name("apex_engine_last_execution_time").labelNames(ENGINE_INSTANCE_ID) .help("Time taken to execute the last APEX policy in seconds.").register(); - @EmbeddedId @XmlElement(name = "key", required = true) private AxReferenceKey key; - @Column @XmlElement(required = true) private long timeStamp; - @Column @XmlElement(required = true) private long eventCount; - @Column @XmlElement(required = true) private long lastExecutionTime; - @Column @XmlElement(required = true) private double averageExecutionTime; - @Column @XmlElement(required = true) private long upTime; - @Transient @Getter private transient long lastEnterTime; - @Column @XmlElement(required = true) private long lastStart; @@ -566,4 +550,4 @@ public class AxEngineStats extends AxConcept { return Long.compare(lastStart, other.lastStart); } -}
\ No newline at end of file +} 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") 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 |