<!--
============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.
<artifactId>utilities</artifactId>
<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>
/*-
* ============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.
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;
* <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")
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;
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;
* 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",
*/
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;
/*-
* ============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");
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;
* 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" })
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.
/*-
* ============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");
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;
* 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 =
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;
/*-
* ============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.
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;
* 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",
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;
/*
* ============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.
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;
/*-
* ============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");
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;
* <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
/** 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
/*-
* ============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");
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;
* 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)
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
/*-
* ============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");
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;
* <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)
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
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;
* 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
/** 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;
/*-
* ============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");
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;
* 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)
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
/*-
* ============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");
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;
* <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",
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;
/**
/*-
* ============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");
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;
* 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",
.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;
return Long.compare(lastStart, other.lastStart);
}
-}
\ No newline at end of file
+}
/*-
* ============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");
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;
* 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 =
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;
return 0;
}
-}
\ No newline at end of file
+}
/*-
* ============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");
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;
* {@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" })
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
/*-
* ============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.
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;
* 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" })
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
/*-
* ============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");
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;
*
* <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 =
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;
/*-
* ============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.
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;
/**
* 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")
/*-
* ============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.
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;
/**
* 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")
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;
* 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 =
/** 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;
/*-
* ============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.
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;
* 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" })
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
/*-
* ============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.
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;
* </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 =
// 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;
/*-
* ============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.
* ================================================================================
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;
* <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",
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
* ============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");
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;
* </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 =
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.
/*-
* ============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;
/**
* 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")
/*-
* ============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.
* ================================================================================
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;
* </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",
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;
/*-
* ============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");
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;
* </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",
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
/*-
* ============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");
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;
* </ol>
*/
-@Entity
-@Table(name = "AxTask")
-
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexTask", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlType(
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;
/*-
* ============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;
/**
* 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")
/*-
* ============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.
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;
* 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",
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;
/*-
* ============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;
/**
* 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")
/*-
* ============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.
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;
* 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
/*-
* ============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");
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 lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
/**
* The Class ArtifactKeyTestEntity is an entity for testing artifact keys.
*/
-@Entity
-@Table(name = "ArtifactKeyTestEntity")
@Getter
@Setter
@ToString
public class ArtifactKeyTestEntity extends AxConcept {
private static final long serialVersionUID = -2962570563281067896L;
- @EmbeddedId()
@XmlElement(name = "key", required = true)
protected AxArtifactKey key;
/*-
* ============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");
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 lombok.AllArgsConstructor;
/**
* The Class ReferenceKeyTestEntity provides a reference key test concept.
*/
-@Entity
-@Table(name = "ReferenceKeyTestEntity")
@Getter
@Setter
@ToString
public class ReferenceKeyTestEntity extends AxConcept {
private static final long serialVersionUID = -2962570563281067895L;
- @EmbeddedId()
@XmlElement(name = "key", required = true)
@XmlJavaTypeAdapter(AxReferenceKeyAdapter.class)
protected AxReferenceKey key;