diff options
author | liamfallon <liam.fallon@est.tech> | 2023-02-02 14:43:12 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2023-02-07 09:17:33 +0000 |
commit | e53df8d3f8ab0464b0876bdb339fa91dc9085cd2 (patch) | |
tree | e01029186ff980f7e00901c28aba09b80a85f8e8 /models-tosca/src/main/java/org/onap | |
parent | e3938e43b8a1f02f74368ecb75c38530285feac0 (diff) |
Replace Eclipselink with Hibernate
Issue-ID: POLICY-4533
Change-Id: I77a6c44c96013963e141265758629cae83e49876
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca/src/main/java/org/onap')
7 files changed, 73 insertions, 37 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java index 14c8ca4a3..b9acde26c 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020,2022 Nordix Foundation. + * Copyright (C) 2019-2020,2022-2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.EmbeddedId; @@ -67,8 +68,10 @@ public class JpaToscaEntityType<T extends ToscaEntity> extends PfConcept impleme // @formatter:off @Column - @AttributeOverride(name = "name", column = @Column(name = "derived_from_name")) - @AttributeOverride(name = "version", column = @Column(name = "derived_from_version")) + @AttributeOverrides({ + @AttributeOverride(name = "name", column = @Column(name = "derived_from_name")), + @AttributeOverride(name = "version", column = @Column(name = "derived_from_version")) + }) @VerifyKey private PfConceptKey derivedFrom; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java index 09c406ea6..5f72e2ba8 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020,2023 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ @@ -29,6 +29,7 @@ import javax.persistence.FetchType; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; import javax.persistence.OneToOne; import javax.persistence.Table; import lombok.Data; @@ -57,8 +58,10 @@ public class JpaToscaModel extends PfModel { private static final long serialVersionUID = 8800599637708309945L; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "serviceTemplatesName", referencedColumnName = "name") - @JoinColumn(name = "serviceTemplatesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "serviceTemplatesName", referencedColumnName = "name"), + @JoinColumn(name = "serviceTemplatesVersion", referencedColumnName = "version") + }) @Valid private JpaToscaServiceTemplates serviceTemplates; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java index bd1dfd4d5..0a5f0c688 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeTemplate.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020-2021 Nordix Foundation. + * Copyright (C) 2020-2021,2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,6 +31,7 @@ import javax.persistence.FetchType; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; import javax.persistence.OneToOne; import javax.persistence.Table; import javax.ws.rs.core.Response; @@ -63,14 +64,18 @@ public class JpaToscaNodeTemplate extends JpaToscaWithTypeAndStringProperties<To // formatter:off @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "requirementsName", referencedColumnName = "name") - @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "requirementsName", referencedColumnName = "name"), + @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") + }) @Valid private JpaToscaRequirements requirements; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "capabilitiesName", referencedColumnName = "name") - @JoinColumn(name = "capabilitiesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "capabilitiesName", referencedColumnName = "name"), + @JoinColumn(name = "capabilitiesVersion", referencedColumnName = "version") + }) @Valid private JpaToscaCapabilityAssignments capabilities; // @formatter:on diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java index 512abb75b..f295accab 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaNodeType.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2020 Nordix Foundation. + * Copyright (C) 2020,2023 Nordix Foundation. * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,6 +28,7 @@ import javax.persistence.FetchType; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; import javax.persistence.OneToOne; import javax.persistence.Table; import lombok.Data; @@ -58,8 +59,10 @@ public class JpaToscaNodeType extends JpaToscaWithToscaProperties<ToscaNodeType> // formatter:off @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "requirementsName", referencedColumnName = "name") - @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "requirementsName", referencedColumnName = "name"), + @JoinColumn(name = "requirementsVersion", referencedColumnName = "version") + }) // @formatter:on @Valid private JpaToscaRequirements requirements; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java index 769b623c7..109f1f0a8 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021,2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ import javax.persistence.FetchType; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; import javax.persistence.OneToOne; import javax.persistence.Table; import lombok.Data; @@ -78,45 +79,57 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp private String toscaDefinitionsVersion; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "dataTypesName", referencedColumnName = "name") - @JoinColumn(name = "dataTypesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "dataTypesName", referencedColumnName = "name"), + @JoinColumn(name = "dataTypesVersion", referencedColumnName = "version") + }) @SerializedName("data_types") @Valid private JpaToscaDataTypes dataTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "capabilityTypesName", referencedColumnName = "name") - @JoinColumn(name = "capabilityTypesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "capabilityTypesName", referencedColumnName = "name"), + @JoinColumn(name = "capabilityTypesVersion", referencedColumnName = "version") + }) @SerializedName("capability_types") @Valid private JpaToscaCapabilityTypes capabilityTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "relationshipTypesName", referencedColumnName = "name") - @JoinColumn(name = "relationshipTypesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "relationshipTypesName", referencedColumnName = "name"), + @JoinColumn(name = "relationshipTypesVersion", referencedColumnName = "version") + }) @SerializedName("relationship_types") @Valid private JpaToscaRelationshipTypes relationshipTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "nodeTypesName", referencedColumnName = "name") - @JoinColumn(name = "nodeTypesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "nodeTypesName", referencedColumnName = "name"), + @JoinColumn(name = "nodeTypesVersion", referencedColumnName = "version") + }) @SerializedName("node_types") @Valid private JpaToscaNodeTypes nodeTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "policyTypesName", referencedColumnName = "name") - @JoinColumn(name = "policyTypesVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "policyTypesName", referencedColumnName = "name"), + @JoinColumn(name = "policyTypesVersion", referencedColumnName = "version") + }) @SerializedName("policy_types") @Valid private JpaToscaPolicyTypes policyTypes; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "topologyTemplateParentKeyName", referencedColumnName = "parentKeyName") - @JoinColumn(name = "topologyTemplateParentKeyVersion", referencedColumnName = "parentKeyVersion") - @JoinColumn(name = "topologyTemplateParentLocalName", referencedColumnName = "parentLocalName") - @JoinColumn(name = "topologyTemplateLocalName", referencedColumnName = "localName") + @JoinColumns({ + @JoinColumn(name = "topologyTemplateParentKeyName", referencedColumnName = "parentKeyName"), + @JoinColumn(name = "topologyTemplateParentKeyVersion", referencedColumnName = "parentKeyVersion"), + @JoinColumn(name = "topologyTemplateParentLocalName", referencedColumnName = "parentLocalName"), + @JoinColumn(name = "topologyTemplateLocalName", referencedColumnName = "localName") + }) @SerializedName("topology_template") @Valid private JpaToscaTopologyTemplate topologyTemplate; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java index af6f512dd..629e14a84 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2020,2023 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,6 +35,7 @@ import javax.persistence.FetchType; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; import javax.persistence.Lob; import javax.persistence.OneToOne; import javax.persistence.Table; @@ -86,15 +87,20 @@ public class JpaToscaTopologyTemplate extends PfConcept implements PfAuthorative private Map<@NotNull String, @NotNull @Valid JpaToscaParameter> inputs; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "nodeTemplatesName", referencedColumnName = "name") - @JoinColumn(name = "nodeTemplatessVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "nodeTemplatesName", referencedColumnName = "name"), + @JoinColumn(name = "nodeTemplatessVersion", referencedColumnName = "version") + }) @SerializedName("data_types") @Valid private JpaToscaNodeTemplates nodeTemplates; @OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL, orphanRemoval = true) - @JoinColumn(name = "policyName", referencedColumnName = "name") - @JoinColumn(name = "policyVersion", referencedColumnName = "version") + @JoinColumns({ + @JoinColumn(name = "policyName", referencedColumnName = "name"), + @JoinColumn(name = "policyVersion", referencedColumnName = "version") + + }) // @formatter:on @Valid private JpaToscaPolicies policies; diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java index 55acc0653..cb0ff4e5d 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaWithTypeAndStringProperties.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications Copyright (C) 2021,2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javax.persistence.AttributeOverride; +import javax.persistence.AttributeOverrides; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Lob; @@ -56,8 +57,10 @@ public abstract class JpaToscaWithTypeAndStringProperties<T extends ToscaWithTyp private static final long serialVersionUID = 2785481541573683089L; @Column - @AttributeOverride(name = "name", column = @Column(name = "type_name")) - @AttributeOverride(name = "version", column = @Column(name = "type_version")) + @AttributeOverrides ({ + @AttributeOverride(name = "name", column = @Column(name = "type_name")), + @AttributeOverride(name = "version", column = @Column(name = "type_version")) + }) @VerifyKey @NotNull private PfConceptKey type; |