aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-03-29 10:31:22 +0000
committerliamfallon <liam.fallon@est.tech>2019-03-29 10:31:22 +0000
commitcc5b96bfd33cd7d91fe6994d348e8d6a0ebb54fa (patch)
tree2fee38b739094176421927052b65ce6d9ffd5098 /models-tosca/src/main
parent6ccec5265d3431a1ca3265876b3df7bb422d9b62 (diff)
Restructure for authorative models
Use authorative models instead of the JPA stored models as the venacular models in the Policy Framework. The next step is to pass the authorative objects over the provider interface rather than the JPA obejcts. This change will be made in the next review. Minor changes to pdp objects to remove JPA things from them. These object will be the authorative in-memory obejcts on the PDP side and new JPA entity object will be introduced in a future review to persist them. Issue-ID: POLICY-1095 Change-Id: I40e7b713903980cb41bb315417111b67a9b17307 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca/src/main')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConstraint.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaConstraint.java)2
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaDataType.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaDataType.java)4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntrySchema.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaEntrySchema.java)4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaPolicy.java)19
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaPolicyType.java)4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaProperty.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaProperty.java)6
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaServiceTemplate.java)8
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTopologyTemplate.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaTopologyTemplate.java)4
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapper.java16
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapper.java28
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java26
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java80
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraint.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraint.java)14
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogical.java)18
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalKey.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalKey.java)18
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalString.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalString.java)18
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintValidValues.java)18
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataType.java)42
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypes.java)16
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntityType.java)16
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchema.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntrySchema.java)34
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEventFilter.java)22
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaModel.java)30
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicies.java)16
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicy.java)20
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyType.java)44
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypes.java)16
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaProperty.java)36
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplate.java)32
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplates.java)21
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTimeInterval.java)22
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTopologyTemplate.java)22
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTrigger.java)36
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/mapping/JpaToscaServiceTemplateMapper.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/simple/mapping/ToscaServiceTemplateMapper.java)8
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java87
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypeJsonAdapter.java14
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypesJsonAdapter.java21
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPoliciesJsonAdapter.java18
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyJsonAdapter.java10
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypeJsonAdapter.java29
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypesJsonAdapter.java20
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPropertiesJsonAdapter.java52
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateJsonAdapter.java24
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateMessageBodyHandler.java32
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaTopologyTemplateJsonAdapter.java14
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java6
46 files changed, 535 insertions, 512 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaConstraint.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConstraint.java
index 85d0b5009..13b4adf23 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaConstraint.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConstraint.java
@@ -32,7 +32,7 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaConstraint {
+public class ToscaConstraint {
@SerializedName("valid_values")
private List<String> validValues;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaDataType.java
index 0581a7da1..9aae32040 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaDataType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaDataType.java
@@ -32,7 +32,7 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaDataType {
+public class ToscaDataType {
@SerializedName("derived_from")
private String derivedFrom;
@@ -43,5 +43,5 @@ public class PlainToscaDataType {
private String description;
- private Map<String, PlainToscaProperty> properties;
+ private Map<String, ToscaProperty> properties;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaEntrySchema.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntrySchema.java
index ab9051aa9..a3526f757 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaEntrySchema.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntrySchema.java
@@ -31,11 +31,11 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaEntrySchema {
+public class ToscaEntrySchema {
private String type;
private String description;
- private List<PlainToscaConstraint> constraints;
+ private List<ToscaConstraint> constraints;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
index 02ebe6537..e8616061d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
@@ -22,8 +22,11 @@
package org.onap.policy.models.tosca.authorative.concepts;
+import java.util.LinkedHashMap;
import java.util.Map;
import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
/**
* Class to represent TOSCA policy matching input/output from/to client.
@@ -31,7 +34,8 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaPolicy {
+@NoArgsConstructor
+public class ToscaPolicy {
private String type;
@@ -42,4 +46,17 @@ public class PlainToscaPolicy {
private Map<String, String> metadata;
private Map<String, Object> properties;
+
+ /**
+ * Copy constructor.
+ *
+ * @param copyObject the obejct to copy from.
+ */
+ public ToscaPolicy(@NonNull ToscaPolicy copyObject) {
+ this.type = copyObject.type;
+ this.version = copyObject.version;
+ this.description = copyObject.description;
+ this.metadata = (metadata != null ? new LinkedHashMap<>(copyObject.metadata) : null);
+ this.properties = (properties != null ? new LinkedHashMap<>(copyObject.properties) : null);
+ }
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java
index 499e2dd25..c46402ba1 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaPolicyType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyType.java
@@ -32,7 +32,7 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaPolicyType {
+public class ToscaPolicyType {
@SerializedName("derived_from")
private String derivedFrom;
@@ -43,5 +43,5 @@ public class PlainToscaPolicyType {
private String description;
- private Map<String, PlainToscaProperty> properties;
+ private Map<String, ToscaProperty> properties;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaProperty.java
index e5e282a95..9eda83b90 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaProperty.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaProperty.java
@@ -32,7 +32,7 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaProperty {
+public class ToscaProperty {
private String type;
@@ -44,7 +44,7 @@ public class PlainToscaProperty {
private String defaultValue;
@SerializedName("entry_schema")
- private PlainToscaEntrySchema entrySchema;
+ private ToscaEntrySchema entrySchema;
- private List<PlainToscaConstraint> constraints;
+ private List<ToscaConstraint> constraints;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java
index cf5e2d9d6..3d1b96313 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaServiceTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java
@@ -33,17 +33,17 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaServiceTemplate {
+public class ToscaServiceTemplate {
@SerializedName("tosca_definitions_version")
private String toscaDefinitionsVersion;
@SerializedName("topology_template")
- private PlainToscaTopologyTemplate toscaTopologyTemplate;
+ private ToscaTopologyTemplate toscaTopologyTemplate;
@SerializedName("policy_types")
- private List<Map<String, PlainToscaPolicyType>> policyTypes;
+ private List<Map<String, ToscaPolicyType>> policyTypes;
@SerializedName("data_types")
- private List<Map<String, PlainToscaDataType>> dataTypes;
+ private List<Map<String, ToscaDataType>> dataTypes;
} \ No newline at end of file
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTopologyTemplate.java
index 16c1da05e..ebb53e177 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/PlainToscaTopologyTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTopologyTemplate.java
@@ -32,9 +32,9 @@ import lombok.Data;
* @author Chenfei Gao (cgao@research.att.com)
*/
@Data
-public class PlainToscaTopologyTemplate {
+public class ToscaTopologyTemplate {
private String description;
- private List<Map<String, PlainToscaPolicy>> policies;
+ private List<Map<String, ToscaPolicy>> policies;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapper.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapper.java
index aa7ca23b2..cef83486d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapper.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/mapping/PlainToscaServiceTemplateMapper.java
@@ -23,9 +23,9 @@
package org.onap.policy.models.tosca.authorative.mapping;
import com.google.gson.Gson;
-import org.onap.policy.models.tosca.authorative.concepts.PlainToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.mapping.ToscaServiceTemplateMapper;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.mapping.JpaToscaServiceTemplateMapper;
import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler;
/**
@@ -34,23 +34,23 @@ import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMes
* @author Chenfei Gao (cgao@research.att.com)
*/
public class PlainToscaServiceTemplateMapper
- implements ToscaServiceTemplateMapper<PlainToscaServiceTemplate, PlainToscaServiceTemplate> {
+ implements JpaToscaServiceTemplateMapper<ToscaServiceTemplate, ToscaServiceTemplate> {
private Gson defaultGson = new Gson();
private Gson customGson = new ToscaServiceTemplateMessageBodyHandler().getGson();
@Override
- public ToscaServiceTemplate toToscaServiceTemplate(PlainToscaServiceTemplate otherPolicy) {
+ public JpaToscaServiceTemplate toToscaServiceTemplate(ToscaServiceTemplate otherPolicy) {
String serializedServiceTemplate = defaultGson.toJson(otherPolicy);
- return customGson.fromJson(serializedServiceTemplate, ToscaServiceTemplate.class);
+ return customGson.fromJson(serializedServiceTemplate, JpaToscaServiceTemplate.class);
}
@Override
- public PlainToscaServiceTemplate fromToscaServiceTemplate(ToscaServiceTemplate serviceTemplate) {
+ public ToscaServiceTemplate fromToscaServiceTemplate(JpaToscaServiceTemplate serviceTemplate) {
String serializedServiceTemplate = customGson.toJson(serviceTemplate);
- return defaultGson.fromJson(serializedServiceTemplate, PlainToscaServiceTemplate.class);
+ return defaultGson.fromJson(serializedServiceTemplate, ToscaServiceTemplate.class);
}
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapper.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapper.java
index 141b4e783..cc37338e4 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapper.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyGuardPolicyMapper.java
@@ -30,11 +30,11 @@ import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyContent;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
-import org.onap.policy.models.tosca.simple.mapping.ToscaServiceTemplateMapper;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.mapping.JpaToscaServiceTemplateMapper;
import org.onap.policy.models.tosca.utils.ToscaUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +45,7 @@ import org.slf4j.LoggerFactory;
* @author Liam Fallon (liam.fallon@est.tech)
*/
public class LegacyGuardPolicyMapper
- implements ToscaServiceTemplateMapper<LegacyGuardPolicyInput, Map<String, LegacyGuardPolicyOutput>> {
+ implements JpaToscaServiceTemplateMapper<LegacyGuardPolicyInput, Map<String, LegacyGuardPolicyOutput>> {
private static final Logger LOGGER = LoggerFactory.getLogger(LegacyGuardPolicyMapper.class);
private static final Map<String, PfConceptKey> GUARD_POLICY_TYPE_MAP = new LinkedHashMap<>();
@@ -62,7 +62,7 @@ public class LegacyGuardPolicyMapper
}
@Override
- public ToscaServiceTemplate toToscaServiceTemplate(final LegacyGuardPolicyInput legacyGuardPolicyInput) {
+ public JpaToscaServiceTemplate toToscaServiceTemplate(final LegacyGuardPolicyInput legacyGuardPolicyInput) {
PfConceptKey guardPolicyType = GUARD_POLICY_TYPE_MAP.get(legacyGuardPolicyInput.getPolicyId());
if (guardPolicyType == null) {
String errorMessage =
@@ -80,28 +80,30 @@ public class LegacyGuardPolicyMapper
PfConceptKey policyKey = new PfConceptKey(legacyGuardPolicyInput.getPolicyId(), version);
- final ToscaPolicy toscaPolicy = new ToscaPolicy(policyKey);
+ final JpaToscaPolicy toscaPolicy = new JpaToscaPolicy(policyKey);
toscaPolicy.setType(guardPolicyType);
toscaPolicy.setProperties(legacyGuardPolicyInput.getContent().getAsPropertyMap());
- final ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
+ final JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
serviceTemplate.setToscaDefinitionsVersion("tosca_simimport java.util.HashMap;\n" + "ple_yaml_1_0");
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(policyKey, toscaPolicy);
return serviceTemplate;
}
@Override
- public Map<String, LegacyGuardPolicyOutput> fromToscaServiceTemplate(final ToscaServiceTemplate serviceTemplate) {
+ public Map<String, LegacyGuardPolicyOutput> fromToscaServiceTemplate(
+ final JpaToscaServiceTemplate serviceTemplate) {
ToscaUtils.assertPoliciesExist(serviceTemplate);
final Map<String, LegacyGuardPolicyOutput> legacyGuardPolicyOutputMap = new LinkedHashMap<>();
- for (ToscaPolicy toscaPolicy : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().values()) {
+ for (JpaToscaPolicy toscaPolicy : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap()
+ .values()) {
final LegacyGuardPolicyOutput legacyGuardPolicyOutput = new LegacyGuardPolicyOutput();
legacyGuardPolicyOutput.setType(toscaPolicy.getType().getName());
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java
index 65f477572..4ddcd60cc 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/mapping/LegacyOperationalPolicyMapper.java
@@ -28,11 +28,11 @@ import javax.ws.rs.core.Response;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
-import org.onap.policy.models.tosca.simple.mapping.ToscaServiceTemplateMapper;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.mapping.JpaToscaServiceTemplateMapper;
import org.onap.policy.models.tosca.utils.ToscaUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,14 +43,14 @@ import org.slf4j.LoggerFactory;
* @author Liam Fallon (liam.fallon@est.tech)
*/
public class LegacyOperationalPolicyMapper
- implements ToscaServiceTemplateMapper<LegacyOperationalPolicy, LegacyOperationalPolicy> {
+ implements JpaToscaServiceTemplateMapper<LegacyOperationalPolicy, LegacyOperationalPolicy> {
private static final Logger LOGGER = LoggerFactory.getLogger(LegacyOperationalPolicyMapper.class);
private static final PfConceptKey LEGACY_OPERATIONAL_TYPE =
new PfConceptKey("onap.policies.controlloop.Operational", "1.0.0");
@Override
- public ToscaServiceTemplate toToscaServiceTemplate(final LegacyOperationalPolicy legacyOperationalPolicy) {
+ public JpaToscaServiceTemplate toToscaServiceTemplate(final LegacyOperationalPolicy legacyOperationalPolicy) {
String incomingVersion = legacyOperationalPolicy.getPolicyVersion();
if (incomingVersion == null) {
incomingVersion = "1";
@@ -58,7 +58,7 @@ public class LegacyOperationalPolicyMapper
PfConceptKey policyKey = new PfConceptKey(legacyOperationalPolicy.getPolicyId(), incomingVersion + ".0.0");
- final ToscaPolicy toscaPolicy = new ToscaPolicy(policyKey);
+ final JpaToscaPolicy toscaPolicy = new JpaToscaPolicy(policyKey);
toscaPolicy.setType(LEGACY_OPERATIONAL_TYPE);
@@ -66,19 +66,19 @@ public class LegacyOperationalPolicyMapper
toscaPolicy.setProperties(propertyMap);
toscaPolicy.getProperties().put("Content", legacyOperationalPolicy.getContent());
- final ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
+ final JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
serviceTemplate.setToscaDefinitionsVersion("tosca_simple_yaml_1_0");
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(policyKey, toscaPolicy);
return serviceTemplate;
}
@Override
- public LegacyOperationalPolicy fromToscaServiceTemplate(final ToscaServiceTemplate serviceTemplate) {
+ public LegacyOperationalPolicy fromToscaServiceTemplate(final JpaToscaServiceTemplate serviceTemplate) {
ToscaUtils.assertPoliciesExist(serviceTemplate);
if (serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().size() > 1) {
@@ -88,7 +88,7 @@ public class LegacyOperationalPolicyMapper
}
// Get the policy
- final ToscaPolicy toscaPolicy =
+ final JpaToscaPolicy toscaPolicy =
serviceTemplate.getTopologyTemplate().getPolicies().getAll(null).iterator().next();
final LegacyOperationalPolicy legacyOperationalPolicy = new LegacyOperationalPolicy();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java
index 04a010f08..a394cec3e 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java
@@ -36,10 +36,10 @@ import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
import org.onap.policy.models.tosca.legacy.mapping.LegacyGuardPolicyMapper;
import org.onap.policy.models.tosca.legacy.mapping.LegacyOperationalPolicyMapper;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -68,7 +68,7 @@ public class LegacyProvider {
public LegacyOperationalPolicy getOperationalPolicy(@NonNull final PfDao dao, @NonNull final String policyId)
throws PfModelException {
- ToscaPolicy newestPolicy = getLatestPolicy(dao, policyId);
+ JpaToscaPolicy newestPolicy = getLatestPolicy(dao, policyId);
if (newestPolicy == null) {
String errorMessage = NO_POLICY_FOUND_FOR_POLICY_ID + policyId;
@@ -77,9 +77,9 @@ public class LegacyProvider {
}
// Create the structure of the TOSCA service template to contain the policy type
- ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(newestPolicy.getKey(), newestPolicy);
return new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(serviceTemplate);
@@ -98,7 +98,7 @@ public class LegacyProvider {
// We need to find the latest policy and update the major version, if there is no policy with this ID, then
// we set it to the first version
- ToscaPolicy newestPolicy = getLatestPolicy(dao, legacyOperationalPolicy.getPolicyId());
+ JpaToscaPolicy newestPolicy = getLatestPolicy(dao, legacyOperationalPolicy.getPolicyId());
if (newestPolicy == null) {
legacyOperationalPolicy.setPolicyVersion(FIRST_POLICY_VERSION);
@@ -106,9 +106,9 @@ public class LegacyProvider {
legacyOperationalPolicy.setPolicyVersion(Integer.toString(newestPolicy.getKey().getMajorVersion() + 1));
}
- ToscaServiceTemplate incomingServiceTemplate =
+ JpaToscaServiceTemplate incomingServiceTemplate =
new LegacyOperationalPolicyMapper().toToscaServiceTemplate(legacyOperationalPolicy);
- ToscaServiceTemplate outgoingingServiceTemplate =
+ JpaToscaServiceTemplate outgoingingServiceTemplate =
new SimpleToscaProvider().createPolicies(dao, incomingServiceTemplate);
return new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate);
@@ -127,7 +127,7 @@ public class LegacyProvider {
// We need to find the latest policy and use the major version, if there is no policy with this ID, then
// we have an error
- ToscaPolicy newestPolicy = getLatestPolicy(dao, legacyOperationalPolicy.getPolicyId());
+ JpaToscaPolicy newestPolicy = getLatestPolicy(dao, legacyOperationalPolicy.getPolicyId());
if (newestPolicy == null) {
String errorMessage = NO_POLICY_FOUND_FOR_POLICY_ID + legacyOperationalPolicy.getPolicyId();
@@ -137,9 +137,9 @@ public class LegacyProvider {
legacyOperationalPolicy.setPolicyVersion(Integer.toString(newestPolicy.getKey().getMajorVersion()));
}
- ToscaServiceTemplate incomingServiceTemplate =
+ JpaToscaServiceTemplate incomingServiceTemplate =
new LegacyOperationalPolicyMapper().toToscaServiceTemplate(legacyOperationalPolicy);
- ToscaServiceTemplate outgoingingServiceTemplate =
+ JpaToscaServiceTemplate outgoingingServiceTemplate =
new SimpleToscaProvider().createPolicies(dao, incomingServiceTemplate);
return new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate);
@@ -157,12 +157,12 @@ public class LegacyProvider {
throws PfModelException {
// Get all the policies in the database and check the policy ID against the policies returned
- List<ToscaPolicy> policyList = dao.getAll(ToscaPolicy.class);
+ List<JpaToscaPolicy> policyList = dao.getAll(JpaToscaPolicy.class);
// Find the latest policy that matches the ID
- List<ToscaPolicy> policyDeleteList = new ArrayList<>();
+ List<JpaToscaPolicy> policyDeleteList = new ArrayList<>();
- for (ToscaPolicy policy : policyList) {
+ for (JpaToscaPolicy policy : policyList) {
if (policyId.equals(policy.getKey().getName())) {
policyDeleteList.add(policy);
}
@@ -175,11 +175,11 @@ public class LegacyProvider {
}
// Create the structure of the TOSCA service template to contain the policy type
- ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
- for (ToscaPolicy deletePolicy : policyDeleteList) {
+ for (JpaToscaPolicy deletePolicy : policyDeleteList) {
dao.delete(deletePolicy);
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(deletePolicy.getKey(),
deletePolicy);
@@ -199,7 +199,7 @@ public class LegacyProvider {
public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final PfDao dao, @NonNull final String policyId)
throws PfModelException {
- ToscaPolicy newestPolicy = getLatestPolicy(dao, policyId);
+ JpaToscaPolicy newestPolicy = getLatestPolicy(dao, policyId);
if (newestPolicy == null) {
String errorMessage = NO_POLICY_FOUND_FOR_POLICY_ID + policyId;
@@ -208,9 +208,9 @@ public class LegacyProvider {
}
// Create the structure of the TOSCA service template to contain the policy type
- ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(newestPolicy.getKey(), newestPolicy);
return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(serviceTemplate);
@@ -227,9 +227,9 @@ public class LegacyProvider {
public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(@NonNull final PfDao dao,
@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
- ToscaServiceTemplate incomingServiceTemplate =
+ JpaToscaServiceTemplate incomingServiceTemplate =
new LegacyGuardPolicyMapper().toToscaServiceTemplate(legacyGuardPolicy);
- ToscaServiceTemplate outgoingingServiceTemplate =
+ JpaToscaServiceTemplate outgoingingServiceTemplate =
new SimpleToscaProvider().createPolicies(dao, incomingServiceTemplate);
return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate);
@@ -246,9 +246,9 @@ public class LegacyProvider {
public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(@NonNull final PfDao dao,
@NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
- ToscaServiceTemplate incomingServiceTemplate =
+ JpaToscaServiceTemplate incomingServiceTemplate =
new LegacyGuardPolicyMapper().toToscaServiceTemplate(legacyGuardPolicy);
- ToscaServiceTemplate outgoingingServiceTemplate =
+ JpaToscaServiceTemplate outgoingingServiceTemplate =
new SimpleToscaProvider().createPolicies(dao, incomingServiceTemplate);
return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate);
@@ -267,12 +267,12 @@ public class LegacyProvider {
@NonNull final String policyId) throws PfModelException {
// Get all the policies in the database and check the policy ID against the policies returned
- List<ToscaPolicy> policyList = dao.getAll(ToscaPolicy.class);
+ List<JpaToscaPolicy> policyList = dao.getAll(JpaToscaPolicy.class);
// Find the latest policy that matches the ID
- List<ToscaPolicy> policyDeleteList = new ArrayList<>();
+ List<JpaToscaPolicy> policyDeleteList = new ArrayList<>();
- for (ToscaPolicy policy : policyList) {
+ for (JpaToscaPolicy policy : policyList) {
if (policyId.equals(policy.getKey().getName())) {
policyDeleteList.add(policy);
}
@@ -285,11 +285,11 @@ public class LegacyProvider {
}
// Create the structure of the TOSCA service template to contain the policy type
- ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
- for (ToscaPolicy deletePolicy : policyDeleteList) {
+ for (JpaToscaPolicy deletePolicy : policyDeleteList) {
dao.delete(deletePolicy);
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(deletePolicy.getKey(),
deletePolicy);
@@ -305,14 +305,14 @@ public class LegacyProvider {
* @param policyId the ID of the policy
* @return the policy
*/
- private ToscaPolicy getLatestPolicy(final PfDao dao, final String policyId) {
+ private JpaToscaPolicy getLatestPolicy(final PfDao dao, final String policyId) {
// Get all the policies in the database and check the policy ID against the policies returned
- List<ToscaPolicy> policyList = dao.getAll(ToscaPolicy.class);
+ List<JpaToscaPolicy> policyList = dao.getAll(JpaToscaPolicy.class);
// Find the latest policy that matches the ID
- ToscaPolicy newestPolicy = null;
+ JpaToscaPolicy newestPolicy = null;
- for (ToscaPolicy policy : policyList) {
+ for (JpaToscaPolicy policy : policyList) {
if (!policyId.equals(policy.getKey().getName())) {
continue;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraint.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraint.java
index ee153a295..bde53c351 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraint.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraint.java
@@ -48,25 +48,25 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
*/
@Data
@EqualsAndHashCode(callSuper = false)
-public abstract class ToscaConstraint extends PfConcept {
+public abstract class JpaToscaConstraint extends PfConcept {
private static final long serialVersionUID = 6426438089914347734L;
@EmbeddedId
private final PfReferenceKey key;
/**
- * The Default Constructor creates a {@link ToscaConstraint} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaConstraint} object with a null key.
*/
- public ToscaConstraint() {
+ public JpaToscaConstraint() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaConstraint} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaConstraint} object with the given concept key.
*
* @param key the key
*/
- public ToscaConstraint(@NonNull final PfReferenceKey key) {
+ public JpaToscaConstraint(@NonNull final PfReferenceKey key) {
this.key = key;
}
@@ -75,7 +75,7 @@ public abstract class ToscaConstraint extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaConstraint(@NonNull final ToscaConstraint copyConcept) {
+ public JpaToscaConstraint(@NonNull final JpaToscaConstraint copyConcept) {
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
}
@@ -113,7 +113,7 @@ public abstract class ToscaConstraint extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaConstraint other = (ToscaConstraint) otherConcept;
+ final JpaToscaConstraint other = (JpaToscaConstraint) otherConcept;
return key.compareTo(other.key);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogical.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
index 25a03c9e1..231e26188 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogical.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogical.java
@@ -37,7 +37,7 @@ import org.onap.policy.models.base.PfReferenceKey;
*/
@EqualsAndHashCode(callSuper = false)
@ToString
-public class ToscaConstraintLogical extends ToscaConstraint {
+public class JpaToscaConstraintLogical extends JpaToscaConstraint {
private static final long serialVersionUID = 2562306457768745444L;
public enum Operation {
@@ -54,29 +54,29 @@ public class ToscaConstraintLogical extends ToscaConstraint {
private final Operation operation;
/**
- * The Default Constructor creates a {@link ToscaConstraintLogical} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaConstraintLogical} object with a null key.
*/
- public ToscaConstraintLogical() {
+ public JpaToscaConstraintLogical() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogical} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaConstraintLogical} object with the given concept key.
*
* @param key the key of the constraint
*/
- public ToscaConstraintLogical(final PfReferenceKey key) {
+ public JpaToscaConstraintLogical(final PfReferenceKey key) {
this(key, Operation.EQ);
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogical} object with the given concept key and operation.
+ * The Key Constructor creates a {@link JpaToscaConstraintLogical} object with the given concept key and operation.
*
* @param key the key of the constraint
* @param operation the logical operation of the constraint
*
*/
- public ToscaConstraintLogical(final PfReferenceKey key, @NonNull final Operation operation) {
+ public JpaToscaConstraintLogical(final PfReferenceKey key, @NonNull final Operation operation) {
super(key);
this.operation = operation;
}
@@ -86,7 +86,7 @@ public class ToscaConstraintLogical extends ToscaConstraint {
*
* @param copyConcept the concept to copy from
*/
- public ToscaConstraintLogical(@NonNull final ToscaConstraintLogical copyConcept) {
+ public JpaToscaConstraintLogical(@NonNull final JpaToscaConstraintLogical copyConcept) {
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
}
@@ -102,7 +102,7 @@ public class ToscaConstraintLogical extends ToscaConstraint {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaConstraintLogical other = (ToscaConstraintLogical) otherConcept;
+ final JpaToscaConstraintLogical other = (JpaToscaConstraintLogical) otherConcept;
int result = super.compareTo(other);
if (result != 0) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalKey.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalKey.java
index 0fe50dd71..13902db19 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalKey.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalKey.java
@@ -52,7 +52,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@EqualsAndHashCode(callSuper = false)
@ToString
-public final class ToscaConstraintLogicalKey extends ToscaConstraintLogical {
+public final class JpaToscaConstraintLogicalKey extends JpaToscaConstraintLogical {
private static final long serialVersionUID = -2420828090326264341L;
@Column
@@ -61,24 +61,24 @@ public final class ToscaConstraintLogicalKey extends ToscaConstraintLogical {
private final PfKey compareToKey;
/**
- * The Default Constructor creates a {@link ToscaConstraintLogicalKey} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaConstraintLogicalKey} object with a null key.
*/
- public ToscaConstraintLogicalKey() {
+ public JpaToscaConstraintLogicalKey() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogicalKey} object with the given concept
+ * The Key Constructor creates a {@link JpaToscaConstraintLogicalKey} object with the given concept
* key.
*
* @param key the key of the constraint
*/
- public ToscaConstraintLogicalKey(final PfReferenceKey key) {
+ public JpaToscaConstraintLogicalKey(final PfReferenceKey key) {
this(key, Operation.EQ, PfConceptKey.getNullKey());
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogicalKey} object with the given concept
+ * The Key Constructor creates a {@link JpaToscaConstraintLogicalKey} object with the given concept
* key, operation, and compare key.
*
* @param key the key of the constraint
@@ -86,7 +86,7 @@ public final class ToscaConstraintLogicalKey extends ToscaConstraintLogical {
* @param compareToKey the key of the object to which the object that owns this constraint will
* be compared
*/
- public ToscaConstraintLogicalKey(final PfReferenceKey key, @NonNull final Operation operation,
+ public JpaToscaConstraintLogicalKey(final PfReferenceKey key, @NonNull final Operation operation,
@NonNull final PfKey compareToKey) {
super(key, operation);
this.compareToKey = compareToKey;
@@ -97,7 +97,7 @@ public final class ToscaConstraintLogicalKey extends ToscaConstraintLogical {
*
* @param copyConcept the concept to copy from
*/
- public ToscaConstraintLogicalKey(@NonNull final ToscaConstraintLogical copyConcept) {
+ public JpaToscaConstraintLogicalKey(@NonNull final JpaToscaConstraintLogical copyConcept) {
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
}
@@ -138,7 +138,7 @@ public final class ToscaConstraintLogicalKey extends ToscaConstraintLogical {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaConstraintLogicalKey other = (ToscaConstraintLogicalKey) otherConcept;
+ final JpaToscaConstraintLogicalKey other = (JpaToscaConstraintLogicalKey) otherConcept;
int result = super.compareTo(other);
if (result != 0) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalString.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalString.java
index fbf036004..512127343 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintLogicalString.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintLogicalString.java
@@ -47,7 +47,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Table(name = "ToscaConstraintLogicalString")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@EqualsAndHashCode(callSuper = false)
-public class ToscaConstraintLogicalString extends ToscaConstraintLogical {
+public class JpaToscaConstraintLogicalString extends JpaToscaConstraintLogical {
private static final long serialVersionUID = 8167550632122339195L;
@Column
@@ -56,24 +56,24 @@ public class ToscaConstraintLogicalString extends ToscaConstraintLogical {
private final String compareToString;
/**
- * The Default Constructor creates a {@link ToscaConstraintLogicalString} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaConstraintLogicalString} object with a null key.
*/
- public ToscaConstraintLogicalString() {
+ public JpaToscaConstraintLogicalString() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogicalString} object with the given concept
+ * The Key Constructor creates a {@link JpaToscaConstraintLogicalString} object with the given concept
* key.
*
* @param key the key of the constraint
*/
- public ToscaConstraintLogicalString(final PfReferenceKey key) {
+ public JpaToscaConstraintLogicalString(final PfReferenceKey key) {
this(key, Operation.EQ, "");
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogicalString} object with the given concept
+ * The Key Constructor creates a {@link JpaToscaConstraintLogicalString} object with the given concept
* key, operation, and compare string.
*
* @param key the key of the constraint
@@ -81,7 +81,7 @@ public class ToscaConstraintLogicalString extends ToscaConstraintLogical {
* @param compareToString the key of the object to which the object that owns this constraint will
* be compared
*/
- public ToscaConstraintLogicalString(final PfReferenceKey key, @NonNull final Operation operation,
+ public JpaToscaConstraintLogicalString(final PfReferenceKey key, @NonNull final Operation operation,
@NonNull final String compareToString) {
super(key, operation);
this.compareToString = compareToString.trim();
@@ -92,7 +92,7 @@ public class ToscaConstraintLogicalString extends ToscaConstraintLogical {
*
* @param copyConcept the concept to copy from
*/
- public ToscaConstraintLogicalString(@NonNull final ToscaConstraintLogical copyConcept) {
+ public JpaToscaConstraintLogicalString(@NonNull final JpaToscaConstraintLogical copyConcept) {
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
}
@@ -120,7 +120,7 @@ public class ToscaConstraintLogicalString extends ToscaConstraintLogical {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaConstraintLogicalString other = (ToscaConstraintLogicalString) otherConcept;
+ final JpaToscaConstraintLogicalString other = (JpaToscaConstraintLogicalString) otherConcept;
int result = super.compareTo(other);
if (result != 0) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintValidValues.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
index 98629a603..608605f4e 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaConstraintValidValues.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaConstraintValidValues.java
@@ -42,7 +42,7 @@ import org.onap.policy.models.base.PfReferenceKey;
*/
@EqualsAndHashCode(callSuper = false)
@Data
-public class ToscaConstraintValidValues extends ToscaConstraint {
+public class JpaToscaConstraintValidValues extends JpaToscaConstraint {
private static final long serialVersionUID = 3152323457560746844L;
@SerializedName("valid_values")
@@ -51,31 +51,31 @@ public class ToscaConstraintValidValues extends ToscaConstraint {
private final List<String> validValues;
/**
- * The Default Constructor creates a {@link ToscaConstraintValidValues} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaConstraintValidValues} object with a null key.
*/
- public ToscaConstraintValidValues() {
+ public JpaToscaConstraintValidValues() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaConstraintValidValues} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaConstraintValidValues} object with the given concept key.
*
* @param key the key of the constraint
*/
- public ToscaConstraintValidValues(final PfReferenceKey key) {
+ public JpaToscaConstraintValidValues(final PfReferenceKey key) {
super(key);
validValues = new LinkedList<>();
}
/**
- * The Key Constructor creates a {@link ToscaConstraintLogical} object with the given concept key
+ * The Key Constructor creates a {@link JpaToscaConstraintLogical} object with the given concept key
* and valid values list.
*
* @param key the key of the constraint
* @param validValues the valid values list of the constraint
*
*/
- public ToscaConstraintValidValues(final PfReferenceKey key, @NonNull final List<String> validValues) {
+ public JpaToscaConstraintValidValues(final PfReferenceKey key, @NonNull final List<String> validValues) {
super(key);
this.validValues = validValues;
}
@@ -85,7 +85,7 @@ public class ToscaConstraintValidValues extends ToscaConstraint {
*
* @param copyConcept the concept to copy from
*/
- public ToscaConstraintValidValues(@NonNull final ToscaConstraintValidValues copyConcept) {
+ public JpaToscaConstraintValidValues(@NonNull final JpaToscaConstraintValidValues copyConcept) {
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, "cannot copy an immutable constraint");
}
@@ -101,7 +101,7 @@ public class ToscaConstraintValidValues extends ToscaConstraint {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaConstraintValidValues other = (ToscaConstraintValidValues) otherConcept;
+ final JpaToscaConstraintValidValues other = (JpaToscaConstraintValidValues) otherConcept;
int result = super.compareTo(other);
if (result != 0) {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
index e7d91ea40..0035eb015 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataType.java
@@ -56,28 +56,28 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaDataType extends ToscaEntityType {
+public class JpaToscaDataType extends JpaToscaEntityType {
private static final long serialVersionUID = -3922690413436539164L;
@ElementCollection
- private List<ToscaConstraint> constraints;
+ private List<JpaToscaConstraint> constraints;
@ElementCollection
- private List<ToscaProperty> properties;
+ private List<JpaToscaProperty> properties;
/**
- * The Default Constructor creates a {@link ToscaDataType} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaDataType} object with a null key.
*/
- public ToscaDataType() {
+ public JpaToscaDataType() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaDataType} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaDataType} object with the given concept key.
*
* @param key the key
*/
- public ToscaDataType(@NonNull final PfConceptKey key) {
+ public JpaToscaDataType(@NonNull final PfConceptKey key) {
super(key);
}
@@ -86,7 +86,7 @@ public class ToscaDataType extends ToscaEntityType {
*
* @param copyConcept the concept to copy from
*/
- public ToscaDataType(final ToscaDataType copyConcept) {
+ public JpaToscaDataType(final JpaToscaDataType copyConcept) {
super(copyConcept);
}
@@ -95,13 +95,13 @@ public class ToscaDataType extends ToscaEntityType {
final List<PfKey> keyList = super.getKeys();
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
keyList.addAll(constraint.getKeys());
}
}
if (properties != null) {
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
keyList.addAll(property.getKeys());
}
}
@@ -114,13 +114,13 @@ public class ToscaDataType extends ToscaEntityType {
super.clean();
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
constraint.clean();
}
}
if (properties != null) {
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
property.clean();
}
}
@@ -150,7 +150,7 @@ public class ToscaDataType extends ToscaEntityType {
private PfValidationResult validateConstraints(@NonNull final PfValidationResult resultIn) {
PfValidationResult result = resultIn;
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
if (constraint == null) {
result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
"data type constraint may not be null "));
@@ -170,7 +170,7 @@ public class ToscaDataType extends ToscaEntityType {
private PfValidationResult validateProperties(final PfValidationResult resultIn) {
PfValidationResult result = resultIn;
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
if (property == null) {
result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
"data type property may not be null "));
@@ -193,7 +193,7 @@ public class ToscaDataType extends ToscaEntityType {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaDataType other = (ToscaDataType) otherConcept;
+ final JpaToscaDataType other = (JpaToscaDataType) otherConcept;
if (!super.equals(other)) {
return super.compareTo(other);
}
@@ -216,15 +216,15 @@ public class ToscaDataType extends ToscaEntityType {
final Object copyObject = target;
Assertions.instanceOf(copyObject, PfConcept.class);
- final ToscaDataType copy = ((ToscaDataType) copyObject);
+ final JpaToscaDataType copy = ((JpaToscaDataType) copyObject);
super.copyTo(target);
if (constraints == null) {
copy.setConstraints(null);
}
else {
- final List<ToscaConstraint> newConstraints = new ArrayList<>();
- for (final ToscaConstraint constraint : constraints) {
+ final List<JpaToscaConstraint> newConstraints = new ArrayList<>();
+ for (final JpaToscaConstraint constraint : constraints) {
newConstraints.add(constraint); // Constraints are immutable
}
copy.setConstraints(newConstraints);
@@ -234,9 +234,9 @@ public class ToscaDataType extends ToscaEntityType {
copy.setProperties(null);
}
else {
- final List<ToscaProperty> newProperties = new ArrayList<>();
- for (final ToscaProperty property : properties) {
- newProperties.add(new ToscaProperty(property));
+ final List<JpaToscaProperty> newProperties = new ArrayList<>();
+ for (final JpaToscaProperty property : properties) {
+ newProperties.add(new JpaToscaProperty(property));
}
copy.setProperties(newProperties);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java
index eae98a1bc..7fedd063c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaDataTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaDataTypes.java
@@ -44,28 +44,28 @@ import org.onap.policy.models.base.PfConceptKey;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaDataTypes extends PfConceptContainer<ToscaDataType> {
+public class JpaToscaDataTypes extends PfConceptContainer<JpaToscaDataType> {
private static final long serialVersionUID = 2941102271022190348L;
public static final String DEFAULT_NAME = "ToscaDataTypesSimple";
public static final String DEFAULT_VERSION = "1.0.0";
/**
- * The Default Constructor creates a {@link ToscaDataTypes} object with a null artifact key
+ * The Default Constructor creates a {@link JpaToscaDataTypes} object with a null artifact key
* and creates an empty concept map.
*/
- public ToscaDataTypes() {
+ public JpaToscaDataTypes() {
super(new PfConceptKey(DEFAULT_NAME, DEFAULT_VERSION));
}
/**
- * The Key Constructor creates a {@link ToscaDataTypes} object with the given artifact key
+ * The Key Constructor creates a {@link JpaToscaDataTypes} object with the given artifact key
* and creates an empty concept map.
*
* @param key the concept key
*/
- public ToscaDataTypes(final PfConceptKey key) {
- super(key, new TreeMap<PfConceptKey, ToscaDataType>());
+ public JpaToscaDataTypes(final PfConceptKey key) {
+ super(key, new TreeMap<PfConceptKey, JpaToscaDataType>());
}
/**
@@ -74,7 +74,7 @@ public class ToscaDataTypes extends PfConceptContainer<ToscaDataType> {
* @param key the concept container key
* @param conceptMap the concepts to be stored in the concept container
*/
- public ToscaDataTypes(final PfConceptKey key, final Map<PfConceptKey, ToscaDataType> conceptMap) {
+ public JpaToscaDataTypes(final PfConceptKey key, final Map<PfConceptKey, JpaToscaDataType> conceptMap) {
super(key, conceptMap);
}
@@ -83,7 +83,7 @@ public class ToscaDataTypes extends PfConceptContainer<ToscaDataType> {
*
* @param copyConcept the concept to copy from
*/
- public ToscaDataTypes(final ToscaDataTypes copyConcept) {
+ public JpaToscaDataTypes(final JpaToscaDataTypes copyConcept) {
super(copyConcept);
}
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntityType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
index f2ae05119..e7d51a500 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntityType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntityType.java
@@ -53,7 +53,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@MappedSuperclass
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaEntityType extends PfConcept {
+public class JpaToscaEntityType extends PfConcept {
private static final long serialVersionUID = -1330661834220739393L;
@EmbeddedId
@@ -77,18 +77,18 @@ public class ToscaEntityType extends PfConcept {
// @formatter:on
/**
- * The Default Constructor creates a {@link ToscaEntityType} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaEntityType} object with a null key.
*/
- public ToscaEntityType() {
+ public JpaToscaEntityType() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaEntityType} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaEntityType} object with the given concept key.
*
* @param key the key
*/
- public ToscaEntityType(@NonNull final PfConceptKey key) {
+ public JpaToscaEntityType(@NonNull final PfConceptKey key) {
this.key = key;
}
@@ -97,7 +97,7 @@ public class ToscaEntityType extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaEntityType(final ToscaEntityType copyConcept) {
+ public JpaToscaEntityType(final JpaToscaEntityType copyConcept) {
super(copyConcept);
}
@@ -176,7 +176,7 @@ public class ToscaEntityType extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaEntityType other = (ToscaEntityType) otherConcept;
+ final JpaToscaEntityType other = (JpaToscaEntityType) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -199,7 +199,7 @@ public class ToscaEntityType extends PfConcept {
final Object copyObject = target;
Assertions.instanceOf(copyObject, PfConcept.class);
- final ToscaEntityType copy = ((ToscaEntityType) copyObject);
+ final JpaToscaEntityType copy = ((JpaToscaEntityType) copyObject);
copy.setKey(new PfConceptKey(key));
copy.setDerivedFrom(derivedFrom != null ? new PfConceptKey(derivedFrom) : null);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntrySchema.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchema.java
index 2dca1ef55..e5ae20e84 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEntrySchema.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEntrySchema.java
@@ -61,7 +61,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaEntrySchema extends PfConcept {
+public class JpaToscaEntrySchema extends PfConcept {
private static final long serialVersionUID = 3645882081163287058L;
@EmbeddedId
@@ -74,31 +74,31 @@ public class ToscaEntrySchema extends PfConcept {
private String description;
@ElementCollection
- private List<ToscaConstraint> constraints;
+ private List<JpaToscaConstraint> constraints;
/**
- * The Default Constructor creates a {@link ToscaEntrySchema} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaEntrySchema} object with a null key.
*/
- public ToscaEntrySchema() {
+ public JpaToscaEntrySchema() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaEntrySchema} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaEntrySchema} object with the given concept key.
*
* @param key the key
*/
- public ToscaEntrySchema(@NonNull final PfReferenceKey key) {
+ public JpaToscaEntrySchema(@NonNull final PfReferenceKey key) {
this(key, new PfConceptKey());
}
/**
- * The full constructor creates a {@link ToscaEntrySchema} object with mandatory fields.
+ * The full constructor creates a {@link JpaToscaEntrySchema} object with mandatory fields.
*
* @param key the key
* @param type the type of the entry schema
*/
- public ToscaEntrySchema(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey type) {
+ public JpaToscaEntrySchema(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey type) {
this.key = key;
this.type = type;
}
@@ -108,7 +108,7 @@ public class ToscaEntrySchema extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaEntrySchema(final ToscaEntrySchema copyConcept) {
+ public JpaToscaEntrySchema(final JpaToscaEntrySchema copyConcept) {
super(copyConcept);
}
@@ -119,7 +119,7 @@ public class ToscaEntrySchema extends PfConcept {
keyList.addAll(type.getKeys());
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
keyList.addAll(constraint.getKeys());
}
}
@@ -135,7 +135,7 @@ public class ToscaEntrySchema extends PfConcept {
description = (description != null ? description.trim() : null);
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
constraint.clean();
}
}
@@ -164,7 +164,7 @@ public class ToscaEntrySchema extends PfConcept {
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
if (constraint == null) {
result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
"property constraint may not be null "));
@@ -189,7 +189,7 @@ public class ToscaEntrySchema extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaEntrySchema other = (ToscaEntrySchema) otherConcept;
+ final JpaToscaEntrySchema other = (JpaToscaEntrySchema) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -208,16 +208,16 @@ public class ToscaEntrySchema extends PfConcept {
@Override
public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, ToscaEntrySchema.class);
+ Assertions.instanceOf(target, JpaToscaEntrySchema.class);
- final ToscaEntrySchema copy = ((ToscaEntrySchema) target);
+ final JpaToscaEntrySchema copy = ((JpaToscaEntrySchema) target);
copy.setKey(new PfReferenceKey(key));
copy.setType(new PfConceptKey(type));
copy.setDescription(description);
if (constraints != null) {
- final List<ToscaConstraint> newConstraints = new ArrayList<>();
- for (final ToscaConstraint constraint : constraints) {
+ final List<JpaToscaConstraint> newConstraints = new ArrayList<>();
+ for (final JpaToscaConstraint constraint : constraints) {
newConstraints.add(constraint); // Constraints are immutable
}
copy.setConstraints(newConstraints);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEventFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
index e2e5488e0..3907a1b0c 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaEventFilter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaEventFilter.java
@@ -57,7 +57,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaEventFilter extends PfConcept {
+public class JpaToscaEventFilter extends PfConcept {
private static final long serialVersionUID = 8769020537228210247L;
@EmbeddedId
@@ -73,27 +73,27 @@ public class ToscaEventFilter extends PfConcept {
private String capability;
/**
- * The Default Constructor creates a {@link ToscaEventFilter} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaEventFilter} object with a null key.
*/
- public ToscaEventFilter() {
+ public JpaToscaEventFilter() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaEventFilter} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaEventFilter} object with the given concept key.
*
* @param key the key
*/
- public ToscaEventFilter(@NonNull final PfReferenceKey key) {
+ public JpaToscaEventFilter(@NonNull final PfReferenceKey key) {
this(key, new PfConceptKey());
}
/**
- * The full Constructor creates a {@link ToscaEventFilter} object with the given concept key and node.
+ * The full Constructor creates a {@link JpaToscaEventFilter} object with the given concept key and node.
*
* @param key the key
*/
- public ToscaEventFilter(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey node) {
+ public JpaToscaEventFilter(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey node) {
this.key = key;
this.node = node;
}
@@ -103,7 +103,7 @@ public class ToscaEventFilter extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaEventFilter(final ToscaEventFilter copyConcept) {
+ public JpaToscaEventFilter(final JpaToscaEventFilter copyConcept) {
super(copyConcept);
}
@@ -164,7 +164,7 @@ public class ToscaEventFilter extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaEventFilter other = (ToscaEventFilter) otherConcept;
+ final JpaToscaEventFilter other = (JpaToscaEventFilter) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -184,9 +184,9 @@ public class ToscaEventFilter extends PfConcept {
@Override
public PfConcept copyTo(@NonNull final PfConcept target) {
final Object copyObject = target;
- Assertions.instanceOf(copyObject, ToscaEventFilter.class);
+ Assertions.instanceOf(copyObject, JpaToscaEventFilter.class);
- final ToscaEventFilter copy = ((ToscaEventFilter) copyObject);
+ final JpaToscaEventFilter copy = ((JpaToscaEventFilter) copyObject);
copy.setKey(new PfReferenceKey(key));
copy.setNode(new PfConceptKey(node));
copy.setRequirement(requirement);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaModel.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
index a7852976d..a322c167f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaModel.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaModel.java
@@ -46,7 +46,7 @@ import org.onap.policy.models.base.PfValidationResult;
* class that allows a model with many service templates to be constructed that contains a well
* formed overall TOSCA model.
*
- * <p>Validation runs {@link ToscaModel} validation on the model and all its sub concepts.
+ * <p>Validation runs {@link JpaToscaModel} validation on the model and all its sub concepts.
*/
@Entity
@@ -54,37 +54,37 @@ import org.onap.policy.models.base.PfValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaModel extends PfModel {
+public class JpaToscaModel extends PfModel {
private static final long serialVersionUID = 8800599637708309945L;
@OneToOne(cascade = CascadeType.ALL)
- private ToscaServiceTemplates serviceTemplates;
+ private JpaToscaServiceTemplates serviceTemplates;
/**
- * The Default Constructor creates a {@link ToscaModel} object with a null concept key and
+ * The Default Constructor creates a {@link JpaToscaModel} object with a null concept key and
* creates an empty TOSCA model.
*/
- public ToscaModel() {
+ public JpaToscaModel() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaModel} object with the given concept key and
+ * The Key Constructor creates a {@link JpaToscaModel} object with the given concept key and
* creates an empty TOSCA model.
*
* @param key the TOSCA model key
*/
- public ToscaModel(final PfConceptKey key) {
- this(key, new ToscaServiceTemplates(new PfConceptKey()));
+ public JpaToscaModel(final PfConceptKey key) {
+ this(key, new JpaToscaServiceTemplates(new PfConceptKey()));
}
/**
- * Constructor that initiates a {@link ToscaModel} with all its fields.
+ * Constructor that initiates a {@link JpaToscaModel} with all its fields.
*
* @param key the TOSCA model key
* @param serviceTemplates the service templates in the event model
*/
- public ToscaModel(@NonNull final PfConceptKey key, @NonNull final ToscaServiceTemplates serviceTemplates) {
+ public JpaToscaModel(@NonNull final PfConceptKey key, @NonNull final JpaToscaServiceTemplates serviceTemplates) {
super(key);
this.serviceTemplates = serviceTemplates;
}
@@ -94,7 +94,7 @@ public class ToscaModel extends PfModel {
*
* @param copyConcept the concept to copy from
*/
- public ToscaModel(@NonNull final ToscaModel copyConcept) {
+ public JpaToscaModel(@NonNull final JpaToscaModel copyConcept) {
super(copyConcept);
}
@@ -139,7 +139,7 @@ public class ToscaModel extends PfModel {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaModel other = (ToscaModel) otherConcept;
+ final JpaToscaModel other = (JpaToscaModel) otherConcept;
if (!super.equals(other)) {
return super.compareTo(other);
}
@@ -149,11 +149,11 @@ public class ToscaModel extends PfModel {
@Override
public PfConcept copyTo(@NonNull final PfConcept targetObject) {
- Assertions.instanceOf(targetObject, ToscaModel.class);
+ Assertions.instanceOf(targetObject, JpaToscaModel.class);
- final ToscaModel copy = ((ToscaModel) targetObject);
+ final JpaToscaModel copy = ((JpaToscaModel) targetObject);
super.copyTo(targetObject);
- copy.setServiceTemplates(new ToscaServiceTemplates(serviceTemplates));
+ copy.setServiceTemplates(new JpaToscaServiceTemplates(serviceTemplates));
return copy;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicies.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java
index f318bb6be..d59f470dd 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicies.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicies.java
@@ -44,28 +44,28 @@ import org.onap.policy.models.base.PfConceptKey;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaPolicies extends PfConceptContainer<ToscaPolicy> {
+public class JpaToscaPolicies extends PfConceptContainer<JpaToscaPolicy> {
private static final long serialVersionUID = -7526648702327776101L;
public static final String DEFAULT_NAME = "ToscaPoliciesSimple";
public static final String DEFAULT_VERSION = "1.0.0";
/**
- * The Default Constructor creates a {@link ToscaPolicies} object with a null artifact key and
+ * The Default Constructor creates a {@link JpaToscaPolicies} object with a null artifact key and
* creates an empty concept map.
*/
- public ToscaPolicies() {
+ public JpaToscaPolicies() {
super(new PfConceptKey(DEFAULT_NAME, DEFAULT_VERSION));
}
/**
- * The Key Constructor creates a {@link ToscaPolicies} object with the given artifact key and
+ * The Key Constructor creates a {@link JpaToscaPolicies} object with the given artifact key and
* creates an empty concept map.
*
* @param key the concept key
*/
- public ToscaPolicies(final PfConceptKey key) {
- super(key, new TreeMap<PfConceptKey, ToscaPolicy>());
+ public JpaToscaPolicies(final PfConceptKey key) {
+ super(key, new TreeMap<PfConceptKey, JpaToscaPolicy>());
}
/**
@@ -74,7 +74,7 @@ public class ToscaPolicies extends PfConceptContainer<ToscaPolicy> {
* @param key the concept container key
* @param conceptMap the concepts to be stored in the concept container
*/
- public ToscaPolicies(final PfConceptKey key, final Map<PfConceptKey, ToscaPolicy> conceptMap) {
+ public JpaToscaPolicies(final PfConceptKey key, final Map<PfConceptKey, JpaToscaPolicy> conceptMap) {
super(key, conceptMap);
}
@@ -83,7 +83,7 @@ public class ToscaPolicies extends PfConceptContainer<ToscaPolicy> {
*
* @param copyConcept the concept to copy from
*/
- public ToscaPolicies(final ToscaPolicies copyConcept) {
+ public JpaToscaPolicies(final JpaToscaPolicies copyConcept) {
super(copyConcept);
}
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index e08079c40..e889192d8 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -62,7 +62,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaPolicy extends ToscaEntityType {
+public class JpaToscaPolicy extends JpaToscaEntityType {
private static final long serialVersionUID = 3265174757061982805L;
// @formatter:off
@@ -84,28 +84,28 @@ public class ToscaPolicy extends ToscaEntityType {
// @formatter:on
/**
- * The Default Constructor creates a {@link ToscaPolicy} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaPolicy} object with a null key.
*/
- public ToscaPolicy() {
+ public JpaToscaPolicy() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaPolicy} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaPolicy} object with the given concept key.
*
* @param key the key
*/
- public ToscaPolicy(@NonNull final PfConceptKey key) {
+ public JpaToscaPolicy(@NonNull final PfConceptKey key) {
this(key, new PfConceptKey());
}
/**
- * The full Constructor creates a {@link ToscaPolicy} object with all mandatory fields.
+ * The full Constructor creates a {@link JpaToscaPolicy} object with all mandatory fields.
*
* @param key the key
* @param type the type of the policy
*/
- public ToscaPolicy(@NonNull final PfConceptKey key, @NonNull final PfConceptKey type) {
+ public JpaToscaPolicy(@NonNull final PfConceptKey key, @NonNull final PfConceptKey type) {
super(key);
this.type = type;
}
@@ -115,7 +115,7 @@ public class ToscaPolicy extends ToscaEntityType {
*
* @param copyConcept the concept to copy from
*/
- public ToscaPolicy(@NonNull final ToscaPolicy copyConcept) {
+ public JpaToscaPolicy(@NonNull final JpaToscaPolicy copyConcept) {
super(copyConcept);
}
@@ -223,7 +223,7 @@ public class ToscaPolicy extends ToscaEntityType {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaPolicy other = (ToscaPolicy) otherConcept;
+ final JpaToscaPolicy other = (JpaToscaPolicy) otherConcept;
if (!super.equals(other)) {
return super.compareTo(other);
}
@@ -245,7 +245,7 @@ public class ToscaPolicy extends ToscaEntityType {
final Object copyObject = target;
Assertions.instanceOf(copyObject, PfConcept.class);
- final ToscaPolicy copy = ((ToscaPolicy) copyObject);
+ final JpaToscaPolicy copy = ((JpaToscaPolicy) copyObject);
super.copyTo(target);
copy.setType(new PfConceptKey(type));
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
index b155192cb..610987ccb 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyType.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java
@@ -57,31 +57,31 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaPolicyType extends ToscaEntityType {
+public class JpaToscaPolicyType extends JpaToscaEntityType {
private static final long serialVersionUID = -563659852901842616L;
@ElementCollection
- private List<ToscaProperty> properties;
+ private List<JpaToscaProperty> properties;
@ElementCollection
private List<PfConceptKey> targets;
@ElementCollection
- private List<ToscaTrigger> triggers;
+ private List<JpaToscaTrigger> triggers;
/**
- * The Default Constructor creates a {@link ToscaPolicyType} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaPolicyType} object with a null key.
*/
- public ToscaPolicyType() {
+ public JpaToscaPolicyType() {
this(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaPolicyType} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaPolicyType} object with the given concept key.
*
* @param key the key
*/
- public ToscaPolicyType(@NonNull final PfConceptKey key) {
+ public JpaToscaPolicyType(@NonNull final PfConceptKey key) {
super(key);
}
@@ -90,7 +90,7 @@ public class ToscaPolicyType extends ToscaEntityType {
*
* @param copyConcept the concept to copy from
*/
- public ToscaPolicyType(final ToscaPolicyType copyConcept) {
+ public JpaToscaPolicyType(final JpaToscaPolicyType copyConcept) {
super(copyConcept);
}
@@ -100,7 +100,7 @@ public class ToscaPolicyType extends ToscaEntityType {
final List<PfKey> keyList = super.getKeys();
if (properties != null) {
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
keyList.addAll(property.getKeys());
}
}
@@ -110,7 +110,7 @@ public class ToscaPolicyType extends ToscaEntityType {
}
if (triggers != null) {
- for (ToscaTrigger trigger : triggers) {
+ for (JpaToscaTrigger trigger : triggers) {
keyList.addAll(trigger.getKeys());
}
}
@@ -123,7 +123,7 @@ public class ToscaPolicyType extends ToscaEntityType {
super.clean();
if (properties != null) {
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
property.clean();
}
}
@@ -135,7 +135,7 @@ public class ToscaPolicyType extends ToscaEntityType {
}
if (triggers != null) {
- for (ToscaTrigger trigger : triggers) {
+ for (JpaToscaTrigger trigger : triggers) {
trigger.clean();
}
}
@@ -169,7 +169,7 @@ public class ToscaPolicyType extends ToscaEntityType {
private PfValidationResult validateProperties(final PfValidationResult resultIn) {
PfValidationResult result = resultIn;
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
if (property == null) {
result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
"policy property may not be null "));
@@ -209,7 +209,7 @@ public class ToscaPolicyType extends ToscaEntityType {
private PfValidationResult validateTriggers(final PfValidationResult resultIn) {
PfValidationResult result = resultIn;
- for (ToscaTrigger trigger : triggers) {
+ for (JpaToscaTrigger trigger : triggers) {
if (trigger == null) {
result.addValidationMessage(new PfValidationMessage(getKey(), this.getClass(), ValidationResult.INVALID,
"policy trigger may not be null "));
@@ -232,7 +232,7 @@ public class ToscaPolicyType extends ToscaEntityType {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaPolicyType other = (ToscaPolicyType) otherConcept;
+ final JpaToscaPolicyType other = (JpaToscaPolicyType) otherConcept;
if (!super.equals(other)) {
return super.compareTo(other);
}
@@ -255,16 +255,16 @@ public class ToscaPolicyType extends ToscaEntityType {
final Object copyObject = target;
Assertions.instanceOf(copyObject, PfConcept.class);
- final ToscaPolicyType copy = ((ToscaPolicyType) copyObject);
+ final JpaToscaPolicyType copy = ((JpaToscaPolicyType) copyObject);
super.copyTo(target);
- final List<ToscaProperty> newProperties = new ArrayList<>();
+ final List<JpaToscaProperty> newProperties = new ArrayList<>();
if (properties == null) {
copy.setProperties(null);
} else {
- for (final ToscaProperty property : properties) {
- newProperties.add(new ToscaProperty(property));
+ for (final JpaToscaProperty property : properties) {
+ newProperties.add(new JpaToscaProperty(property));
}
copy.setProperties(newProperties);
}
@@ -282,9 +282,9 @@ public class ToscaPolicyType extends ToscaEntityType {
if (triggers == null) {
copy.setTargets(null);
} else {
- final List<ToscaTrigger> newTriggers = new ArrayList<>();
- for (final ToscaTrigger trigger : triggers) {
- newTriggers.add(new ToscaTrigger(trigger));
+ final List<JpaToscaTrigger> newTriggers = new ArrayList<>();
+ for (final JpaToscaTrigger trigger : triggers) {
+ newTriggers.add(new JpaToscaTrigger(trigger));
}
copy.setTriggers(newTriggers);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypes.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java
index 277291364..ce3a8130d 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaPolicyTypes.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyTypes.java
@@ -44,28 +44,28 @@ import org.onap.policy.models.base.PfConceptKey;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaPolicyTypes extends PfConceptContainer<ToscaPolicyType> {
+public class JpaToscaPolicyTypes extends PfConceptContainer<JpaToscaPolicyType> {
private static final long serialVersionUID = -4157979965271220098L;
public static final String DEFAULT_NAME = "ToscaPolicyTypesSimple";
public static final String DEFAULT_VERSION = "1.0.0";
/**
- * The Default Constructor creates a {@link ToscaPolicyTypes} object with a null artifact key
+ * The Default Constructor creates a {@link JpaToscaPolicyTypes} object with a null artifact key
* and creates an empty concept map.
*/
- public ToscaPolicyTypes() {
+ public JpaToscaPolicyTypes() {
super(new PfConceptKey(DEFAULT_NAME, DEFAULT_VERSION));
}
/**
- * The Key Constructor creates a {@link ToscaPolicyTypes} object with the given artifact key and
+ * The Key Constructor creates a {@link JpaToscaPolicyTypes} object with the given artifact key and
* creates an empty concept map.
*
* @param key the concept key
*/
- public ToscaPolicyTypes(final PfConceptKey key) {
- super(key, new TreeMap<PfConceptKey, ToscaPolicyType>());
+ public JpaToscaPolicyTypes(final PfConceptKey key) {
+ super(key, new TreeMap<PfConceptKey, JpaToscaPolicyType>());
}
/**
@@ -74,7 +74,7 @@ public class ToscaPolicyTypes extends PfConceptContainer<ToscaPolicyType> {
* @param key the concept container key
* @param conceptMap the concepts to be stored in the concept container
*/
- public ToscaPolicyTypes(final PfConceptKey key, final Map<PfConceptKey, ToscaPolicyType> conceptMap) {
+ public JpaToscaPolicyTypes(final PfConceptKey key, final Map<PfConceptKey, JpaToscaPolicyType> conceptMap) {
super(key, conceptMap);
}
@@ -83,7 +83,7 @@ public class ToscaPolicyTypes extends PfConceptContainer<ToscaPolicyType> {
*
* @param copyConcept the concept to copy from
*/
- public ToscaPolicyTypes(final ToscaPolicyTypes copyConcept) {
+ public JpaToscaPolicyTypes(final JpaToscaPolicyTypes copyConcept) {
super(copyConcept);
}
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaProperty.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
index 2276f5a7a..376c2b3b2 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaProperty.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaProperty.java
@@ -61,7 +61,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaProperty extends PfConcept {
+public class JpaToscaProperty extends PfConcept {
private static final long serialVersionUID = 1675770231921107988L;
public enum Status {
@@ -89,35 +89,35 @@ public class ToscaProperty extends PfConcept {
private Status status = Status.SUPPORTED;
@ElementCollection
- private List<ToscaConstraint> constraints;
+ private List<JpaToscaConstraint> constraints;
@Column
@SerializedName("entry_schema")
- private ToscaEntrySchema entrySchema;
+ private JpaToscaEntrySchema entrySchema;
/**
- * The Default Constructor creates a {@link ToscaProperty} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaProperty} object with a null key.
*/
- public ToscaProperty() {
+ public JpaToscaProperty() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaProperty} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaProperty} object with the given concept key.
*
* @param key the key
*/
- public ToscaProperty(@NonNull final PfReferenceKey key) {
+ public JpaToscaProperty(@NonNull final PfReferenceKey key) {
this(key, new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaProperty} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaProperty} object with the given concept key.
*
* @param key the key
* @param type the key of the property type
*/
- public ToscaProperty(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey type) {
+ public JpaToscaProperty(@NonNull final PfReferenceKey key, @NonNull final PfConceptKey type) {
this.key = key;
this.type = type;
}
@@ -127,7 +127,7 @@ public class ToscaProperty extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaProperty(final ToscaProperty copyConcept) {
+ public JpaToscaProperty(final JpaToscaProperty copyConcept) {
super(copyConcept);
}
@@ -138,7 +138,7 @@ public class ToscaProperty extends PfConcept {
keyList.addAll(type.getKeys());
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
keyList.addAll(constraint.getKeys());
}
}
@@ -165,7 +165,7 @@ public class ToscaProperty extends PfConcept {
}
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
constraint.clean();
}
}
@@ -214,7 +214,7 @@ public class ToscaProperty extends PfConcept {
}
if (constraints != null) {
- for (ToscaConstraint constraint : constraints) {
+ for (JpaToscaConstraint constraint : constraints) {
if (constraint == null) {
result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
"property constraint may not be null "));
@@ -238,7 +238,7 @@ public class ToscaProperty extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaProperty other = (ToscaProperty) otherConcept;
+ final JpaToscaProperty other = (JpaToscaProperty) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -252,7 +252,7 @@ public class ToscaProperty extends PfConcept {
*
* @param other the other ToscaProperty object
*/
- private int compareFields(final ToscaProperty other) {
+ private int compareFields(final JpaToscaProperty other) {
if (!type.equals(other.type)) {
return type.compareTo(other.type);
}
@@ -287,9 +287,9 @@ public class ToscaProperty extends PfConcept {
@Override
public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, ToscaProperty.class);
+ Assertions.instanceOf(target, JpaToscaProperty.class);
- final ToscaProperty copy = ((ToscaProperty) target);
+ final JpaToscaProperty copy = ((JpaToscaProperty) target);
copy.setKey(new PfReferenceKey(key));
copy.setType(new PfConceptKey(type));
copy.setDescription(description);
@@ -297,7 +297,7 @@ public class ToscaProperty extends PfConcept {
copy.setDefaultValue(defaultValue);
copy.setStatus(status);
copy.constraints = constraints; // Constraints are immutable
- copy.setEntrySchema(entrySchema != null ? new ToscaEntrySchema(entrySchema) : null);
+ copy.setEntrySchema(entrySchema != null ? new JpaToscaEntrySchema(entrySchema) : null);
return copy;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
index c3bb9165e..fa2d2aac7 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
@@ -57,7 +57,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaServiceTemplate extends ToscaEntityType {
+public class JpaToscaServiceTemplate extends JpaToscaEntityType {
private static final long serialVersionUID = 8084846046148349401L;
public static final String DEFAULT_NAME = "ToscaServiceTemplateSimple";
@@ -69,40 +69,40 @@ public class ToscaServiceTemplate extends ToscaEntityType {
@OneToOne(cascade = CascadeType.ALL)
@SerializedName("data_types")
- private ToscaDataTypes dataTypes;
+ private JpaToscaDataTypes dataTypes;
@OneToOne(cascade = CascadeType.ALL)
@SerializedName("policy_types")
- private ToscaPolicyTypes policyTypes;
+ private JpaToscaPolicyTypes policyTypes;
@SerializedName("topology_template")
- private ToscaTopologyTemplate topologyTemplate;
+ private JpaToscaTopologyTemplate topologyTemplate;
/**
- * The Default Constructor creates a {@link ToscaServiceTemplate} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaServiceTemplate} object with a null key.
*/
- public ToscaServiceTemplate() {
+ public JpaToscaServiceTemplate() {
this(new PfConceptKey(DEFAULT_NAME, DEFAULT_VERSION));
}
/**
- * The Key Constructor creates a {@link ToscaServiceTemplate} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaServiceTemplate} object with the given concept key.
*
* @param key the key
*/
- public ToscaServiceTemplate(@NonNull final PfConceptKey key) {
+ public JpaToscaServiceTemplate(@NonNull final PfConceptKey key) {
this(key, "");
}
/**
- * The full constructor creates a {@link ToscaServiceTemplate} object with all mandatory
+ * The full constructor creates a {@link JpaToscaServiceTemplate} object with all mandatory
* parameters.
*
* @param key the key
* @param toscaDefinitionsVersion the TOSCA version string
*/
- public ToscaServiceTemplate(@NonNull final PfConceptKey key, @NonNull final String toscaDefinitionsVersion) {
+ public JpaToscaServiceTemplate(@NonNull final PfConceptKey key, @NonNull final String toscaDefinitionsVersion) {
super(key);
this.toscaDefinitionsVersion = toscaDefinitionsVersion;
}
@@ -112,7 +112,7 @@ public class ToscaServiceTemplate extends ToscaEntityType {
*
* @param copyConcept the concept to copy from
*/
- public ToscaServiceTemplate(final ToscaServiceTemplate copyConcept) {
+ public JpaToscaServiceTemplate(final JpaToscaServiceTemplate copyConcept) {
super(copyConcept);
}
@@ -184,7 +184,7 @@ public class ToscaServiceTemplate extends ToscaEntityType {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaServiceTemplate other = (ToscaServiceTemplate) otherConcept;
+ final JpaToscaServiceTemplate other = (JpaToscaServiceTemplate) otherConcept;
if (!super.equals(other)) {
return super.compareTo(other);
}
@@ -212,13 +212,13 @@ public class ToscaServiceTemplate extends ToscaEntityType {
final Object copyObject = target;
Assertions.instanceOf(copyObject, PfConcept.class);
- final ToscaServiceTemplate copy = ((ToscaServiceTemplate) copyObject);
+ final JpaToscaServiceTemplate copy = ((JpaToscaServiceTemplate) copyObject);
super.copyTo(target);
copy.setToscaDefinitionsVersion(toscaDefinitionsVersion);
- copy.setDataTypes(dataTypes != null ? new ToscaDataTypes(dataTypes) : null);
- copy.setPolicyTypes(policyTypes != null ? new ToscaPolicyTypes(policyTypes) : null);
- copy.setTopologyTemplate(topologyTemplate != null ? new ToscaTopologyTemplate(topologyTemplate) : null);
+ copy.setDataTypes(dataTypes != null ? new JpaToscaDataTypes(dataTypes) : null);
+ copy.setPolicyTypes(policyTypes != null ? new JpaToscaPolicyTypes(policyTypes) : null);
+ copy.setTopologyTemplate(topologyTemplate != null ? new JpaToscaTopologyTemplate(topologyTemplate) : null);
return copy;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplates.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.java
index 33d774889..39e553144 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaServiceTemplates.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplates.java
@@ -44,25 +44,25 @@ import org.onap.policy.models.base.PfConceptKey;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = true)
-public class ToscaServiceTemplates extends PfConceptContainer<ToscaServiceTemplate> {
+public class JpaToscaServiceTemplates extends PfConceptContainer<JpaToscaServiceTemplate> {
private static final long serialVersionUID = -3053257884307604114L;
/**
- * The Default Constructor creates a {@link ToscaServiceTemplates} object with a null artifact
- * key and creates an empty concept map.
+ * The Default Constructor creates a {@link JpaToscaServiceTemplates} object with a null artifact key and creates an
+ * empty concept map.
*/
- public ToscaServiceTemplates() {
+ public JpaToscaServiceTemplates() {
super(new PfConceptKey());
}
/**
- * The Key Constructor creates a {@link ToscaServiceTemplates} object with the given artifact
- * key and creates an empty concept map.
+ * The Key Constructor creates a {@link JpaToscaServiceTemplates} object with the given artifact key and creates an
+ * empty concept map.
*
* @param key the concept key
*/
- public ToscaServiceTemplates(final PfConceptKey key) {
- super(key, new TreeMap<PfConceptKey, ToscaServiceTemplate>());
+ public JpaToscaServiceTemplates(final PfConceptKey key) {
+ super(key, new TreeMap<PfConceptKey, JpaToscaServiceTemplate>());
}
/**
@@ -71,7 +71,8 @@ public class ToscaServiceTemplates extends PfConceptContainer<ToscaServiceTempla
* @param key the concept container key
* @param conceptMap the concepts to be stored in the concept container
*/
- public ToscaServiceTemplates(final PfConceptKey key, final Map<PfConceptKey, ToscaServiceTemplate> conceptMap) {
+ public JpaToscaServiceTemplates(final PfConceptKey key,
+ final Map<PfConceptKey, JpaToscaServiceTemplate> conceptMap) {
super(key, conceptMap);
}
@@ -80,7 +81,7 @@ public class ToscaServiceTemplates extends PfConceptContainer<ToscaServiceTempla
*
* @param copyConcept the concept to copy from
*/
- public ToscaServiceTemplates(final ToscaServiceTemplates copyConcept) {
+ public JpaToscaServiceTemplates(final JpaToscaServiceTemplates copyConcept) {
super(copyConcept);
}
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTimeInterval.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
index 69c7c6c97..369aa03c1 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTimeInterval.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTimeInterval.java
@@ -59,7 +59,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaTimeInterval extends PfConcept {
+public class JpaToscaTimeInterval extends PfConcept {
private static final long serialVersionUID = 9151467029611969980L;
@EmbeddedId
@@ -72,27 +72,27 @@ public class ToscaTimeInterval extends PfConcept {
private Date endTime;
/**
- * The Default Constructor creates a {@link ToscaTimeInterval} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaTimeInterval} object with a null key.
*/
- public ToscaTimeInterval() {
+ public JpaToscaTimeInterval() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaTimeInterval} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaTimeInterval} object with the given concept key.
*
* @param key the key
*/
- public ToscaTimeInterval(@NonNull final PfReferenceKey key) {
+ public JpaToscaTimeInterval(@NonNull final PfReferenceKey key) {
this(key, new Date(0), new Date(0));
}
/**
- * The full constructor creates a {@link ToscaTimeInterval} object with all fields.
+ * The full constructor creates a {@link JpaToscaTimeInterval} object with all fields.
*
* @param key the key
*/
- public ToscaTimeInterval(@NonNull final PfReferenceKey key, @NonNull final Date startTime,
+ public JpaToscaTimeInterval(@NonNull final PfReferenceKey key, @NonNull final Date startTime,
@NonNull final Date endTime) {
this.key = key;
this.startTime = startTime;
@@ -104,7 +104,7 @@ public class ToscaTimeInterval extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaTimeInterval(final ToscaTimeInterval copyConcept) {
+ public JpaToscaTimeInterval(final JpaToscaTimeInterval copyConcept) {
super(copyConcept);
}
@@ -160,7 +160,7 @@ public class ToscaTimeInterval extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaTimeInterval other = (ToscaTimeInterval) otherConcept;
+ final JpaToscaTimeInterval other = (JpaToscaTimeInterval) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -176,9 +176,9 @@ public class ToscaTimeInterval extends PfConcept {
@Override
public PfConcept copyTo(@NonNull final PfConcept target) {
final Object copyObject = target;
- Assertions.instanceOf(copyObject, ToscaTimeInterval.class);
+ Assertions.instanceOf(copyObject, JpaToscaTimeInterval.class);
- final ToscaTimeInterval copy = ((ToscaTimeInterval) copyObject);
+ final JpaToscaTimeInterval copy = ((JpaToscaTimeInterval) copyObject);
copy.setKey(new PfReferenceKey(key));
copy.setStartTime(startTime);
copy.setEndTime(endTime);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTopologyTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
index 5b21ca0c1..095435a7f 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTopologyTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTopologyTemplate.java
@@ -55,7 +55,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaTopologyTemplate extends PfConcept {
+public class JpaToscaTopologyTemplate extends PfConcept {
private static final long serialVersionUID = 8969698734673232603L;
public static final String DEFAULT_LOCAL_NAME = "ToscaTopologyTemplateSimple";
@@ -67,23 +67,23 @@ public class ToscaTopologyTemplate extends PfConcept {
private String description;
@OneToOne(cascade = CascadeType.ALL)
- private ToscaPolicies policies;
+ private JpaToscaPolicies policies;
/**
- * The Default Constructor creates a {@link ToscaTopologyTemplate} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaTopologyTemplate} object with a null key.
*/
- public ToscaTopologyTemplate() {
- this(new PfReferenceKey(ToscaServiceTemplate.DEFAULT_NAME, ToscaServiceTemplate.DEFAULT_VERSION,
+ public JpaToscaTopologyTemplate() {
+ this(new PfReferenceKey(JpaToscaServiceTemplate.DEFAULT_NAME, JpaToscaServiceTemplate.DEFAULT_VERSION,
DEFAULT_LOCAL_NAME));
}
/**
- * The Key Constructor creates a {@link ToscaTopologyTemplate} object with the given concept
+ * The Key Constructor creates a {@link JpaToscaTopologyTemplate} object with the given concept
* key.
*
* @param key the key
*/
- public ToscaTopologyTemplate(@NonNull final PfReferenceKey key) {
+ public JpaToscaTopologyTemplate(@NonNull final PfReferenceKey key) {
this.key = key;
}
@@ -92,7 +92,7 @@ public class ToscaTopologyTemplate extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaTopologyTemplate(final ToscaTopologyTemplate copyConcept) {
+ public JpaToscaTopologyTemplate(final JpaToscaTopologyTemplate copyConcept) {
super(copyConcept);
}
@@ -153,7 +153,7 @@ public class ToscaTopologyTemplate extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaTopologyTemplate other = (ToscaTopologyTemplate) otherConcept;
+ final JpaToscaTopologyTemplate other = (JpaToscaTopologyTemplate) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -171,10 +171,10 @@ public class ToscaTopologyTemplate extends PfConcept {
final Object copyObject = target;
Assertions.instanceOf(copyObject, PfConcept.class);
- final ToscaTopologyTemplate copy = ((ToscaTopologyTemplate) copyObject);
+ final JpaToscaTopologyTemplate copy = ((JpaToscaTopologyTemplate) copyObject);
copy.setKey(new PfReferenceKey(key));
copy.setDescription(description);
- copy.setPolicies(policies != null ? new ToscaPolicies(policies) : null);
+ copy.setPolicies(policies != null ? new JpaToscaPolicies(policies) : null);
return copy;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTrigger.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
index d772d554e..0a32701c9 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/ToscaTrigger.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaTrigger.java
@@ -60,7 +60,7 @@ import org.onap.policy.models.base.PfValidationResult.ValidationResult;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class ToscaTrigger extends PfConcept {
+public class JpaToscaTrigger extends PfConcept {
private static final long serialVersionUID = -6515211640208986971L;
@EmbeddedId
@@ -75,17 +75,17 @@ public class ToscaTrigger extends PfConcept {
@Column
@SerializedName("schedule")
- private ToscaTimeInterval schedule;
+ private JpaToscaTimeInterval schedule;
@Column
@SerializedName("target_filter")
- private ToscaEventFilter targetFilter;
+ private JpaToscaEventFilter targetFilter;
@Column
- private ToscaConstraint condition;
+ private JpaToscaConstraint condition;
@Column
- private ToscaConstraint constraint;
+ private JpaToscaConstraint constraint;
@Column
@SerializedName("period")
@@ -101,29 +101,29 @@ public class ToscaTrigger extends PfConcept {
private String action;
/**
- * The Default Constructor creates a {@link ToscaTrigger} object with a null key.
+ * The Default Constructor creates a {@link JpaToscaTrigger} object with a null key.
*/
- public ToscaTrigger() {
+ public JpaToscaTrigger() {
this(new PfReferenceKey());
}
/**
- * The Key Constructor creates a {@link ToscaTrigger} object with the given concept key.
+ * The Key Constructor creates a {@link JpaToscaTrigger} object with the given concept key.
*
* @param key the key
*/
- public ToscaTrigger(@NonNull final PfReferenceKey key) {
+ public JpaToscaTrigger(@NonNull final PfReferenceKey key) {
this(key, "", "");
}
/**
- * The full Constructor creates a {@link ToscaTrigger} object with all mandatory objects.
+ * The full Constructor creates a {@link JpaToscaTrigger} object with all mandatory objects.
*
* @param key the key
* @param eventType the event type
* @param action the trigger action
*/
- public ToscaTrigger(@NonNull final PfReferenceKey key, @NonNull final String eventType,
+ public JpaToscaTrigger(@NonNull final PfReferenceKey key, @NonNull final String eventType,
@NonNull final String action) {
this.key = key;
this.eventType = eventType;
@@ -135,7 +135,7 @@ public class ToscaTrigger extends PfConcept {
*
* @param copyConcept the concept to copy from
*/
- public ToscaTrigger(final ToscaTrigger copyConcept) {
+ public JpaToscaTrigger(final JpaToscaTrigger copyConcept) {
super(copyConcept);
}
@@ -251,7 +251,7 @@ public class ToscaTrigger extends PfConcept {
return this.hashCode() - otherConcept.hashCode();
}
- final ToscaTrigger other = (ToscaTrigger) otherConcept;
+ final JpaToscaTrigger other = (JpaToscaTrigger) otherConcept;
if (!key.equals(other.key)) {
return key.compareTo(other.key);
}
@@ -265,7 +265,7 @@ public class ToscaTrigger extends PfConcept {
*
* @param other the other ToscaTrigger object
*/
- private int compareFields(final ToscaTrigger other) {
+ private int compareFields(final JpaToscaTrigger other) {
int result = ObjectUtils.compare(description, other.description);
if (result != 0) {
return result;
@@ -315,14 +315,14 @@ public class ToscaTrigger extends PfConcept {
@Override
public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, ToscaTrigger.class);
+ Assertions.instanceOf(target, JpaToscaTrigger.class);
- final ToscaTrigger copy = ((ToscaTrigger) target);
+ final JpaToscaTrigger copy = ((JpaToscaTrigger) target);
copy.setKey(new PfReferenceKey(key));
copy.setDescription(description);
copy.setEventType(eventType);
- copy.setSchedule(schedule != null ? new ToscaTimeInterval(schedule) : null);
- copy.setTargetFilter(targetFilter != null ? new ToscaEventFilter(targetFilter) : null);
+ copy.setSchedule(schedule != null ? new JpaToscaTimeInterval(schedule) : null);
+ copy.setTargetFilter(targetFilter != null ? new JpaToscaEventFilter(targetFilter) : null);
copy.setCondition(condition);
copy.setConstraint(constraint);
copy.setPeriod(period);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/mapping/ToscaServiceTemplateMapper.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/mapping/JpaToscaServiceTemplateMapper.java
index 6dcbfe694..e7a4056f7 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/mapping/ToscaServiceTemplateMapper.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/mapping/JpaToscaServiceTemplateMapper.java
@@ -20,7 +20,7 @@
package org.onap.policy.models.tosca.simple.mapping;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
/**
* This interface is used to map legacy and proprietary policies into and out of TOSCA service templates.
@@ -29,7 +29,7 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
* @param <I> the type for the incoming policy definition
* @param <O> the type for the outgoing policy definition
*/
-public interface ToscaServiceTemplateMapper<I, O> {
+public interface JpaToscaServiceTemplateMapper<I, O> {
/**
* Translate from the other format to a TOSCA service template.
@@ -37,7 +37,7 @@ public interface ToscaServiceTemplateMapper<I, O> {
* @param otherPolicyType the other policy type
* @return the TOSCA service template
*/
- public ToscaServiceTemplate toToscaServiceTemplate(final I otherPolicyType);
+ public JpaToscaServiceTemplate toToscaServiceTemplate(final I otherPolicyType);
/**
* Translate to the other format from a TOSCA service template.
@@ -45,5 +45,5 @@ public interface ToscaServiceTemplateMapper<I, O> {
* @param serviceTemplate the TOSCA service template
* @return the policy in the other format
*/
- public O fromToscaServiceTemplate(final ToscaServiceTemplate serviceTemplate);
+ public O fromToscaServiceTemplate(final JpaToscaServiceTemplate serviceTemplate);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
index c7984c5ea..6e356d0ab 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java
@@ -28,12 +28,12 @@ import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.dao.PfDao;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyTypes;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
import org.onap.policy.models.tosca.utils.ToscaUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,15 +55,15 @@ public class SimpleToscaProvider {
* @return the policy types found
* @throws PfModelException on errors getting policy types
*/
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, @NonNull final PfConceptKey policyTypeKey)
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, @NonNull final PfConceptKey policyTypeKey)
throws PfModelException {
// Create the structure of the TOSCA service template to contain the policy type
- ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- serviceTemplate.setPolicyTypes(new ToscaPolicyTypes());
+ JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
+ serviceTemplate.setPolicyTypes(new JpaToscaPolicyTypes());
// Add the policy type to the TOSCA service template
- ToscaPolicyType policyType = dao.get(ToscaPolicyType.class, policyTypeKey);
+ JpaToscaPolicyType policyType = dao.get(JpaToscaPolicyType.class, policyTypeKey);
if (policyType != null) {
serviceTemplate.getPolicyTypes().getConceptMap().put(policyTypeKey, policyType);
return serviceTemplate;
@@ -82,23 +82,23 @@ public class SimpleToscaProvider {
* @return the TOSCA service template containing the created policy types
* @throws PfModelException on errors creating policy types
*/
- public ToscaServiceTemplate createPolicyTypes(@NonNull final PfDao dao,
- @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException {
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final PfDao dao,
+ @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException {
ToscaUtils.assertPolicyTypesExist(serviceTemplate);
- for (ToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getAll(null)) {
+ for (JpaToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getAll(null)) {
dao.create(policyType);
}
// Return the created policy types
- ToscaPolicyTypes returnPolicyTypes = new ToscaPolicyTypes();
+ JpaToscaPolicyTypes returnPolicyTypes = new JpaToscaPolicyTypes();
for (PfConceptKey policyTypeKey : serviceTemplate.getPolicyTypes().getConceptMap().keySet()) {
- returnPolicyTypes.getConceptMap().put(policyTypeKey, dao.get(ToscaPolicyType.class, policyTypeKey));
+ returnPolicyTypes.getConceptMap().put(policyTypeKey, dao.get(JpaToscaPolicyType.class, policyTypeKey));
}
- ToscaServiceTemplate returnServiceTemplate = new ToscaServiceTemplate();
+ JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate();
returnServiceTemplate.setPolicyTypes(returnPolicyTypes);
return returnServiceTemplate;
@@ -112,23 +112,23 @@ public class SimpleToscaProvider {
* @return the TOSCA service template containing the modified policy types
* @throws PfModelException on errors updating policy types
*/
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final PfDao dao,
- @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException {
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final PfDao dao,
+ @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException {
ToscaUtils.assertPolicyTypesExist(serviceTemplate);
- for (ToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getAll(null)) {
+ for (JpaToscaPolicyType policyType : serviceTemplate.getPolicyTypes().getAll(null)) {
dao.update(policyType);
}
// Return the created policy types
- ToscaPolicyTypes returnPolicyTypes = new ToscaPolicyTypes();
+ JpaToscaPolicyTypes returnPolicyTypes = new JpaToscaPolicyTypes();
for (PfConceptKey policyTypeKey : serviceTemplate.getPolicyTypes().getConceptMap().keySet()) {
- returnPolicyTypes.getConceptMap().put(policyTypeKey, dao.get(ToscaPolicyType.class, policyTypeKey));
+ returnPolicyTypes.getConceptMap().put(policyTypeKey, dao.get(JpaToscaPolicyType.class, policyTypeKey));
}
- ToscaServiceTemplate returnServiceTemplate = new ToscaServiceTemplate();
+ JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate();
returnServiceTemplate.setPolicyTypes(returnPolicyTypes);
return returnServiceTemplate;
@@ -143,12 +143,13 @@ public class SimpleToscaProvider {
* @return the TOSCA service template containing the policy types that were deleted
* @throws PfModelException on errors deleting policy types
*/
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfDao dao, @NonNull final PfConceptKey policyTypeKey)
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfDao dao,
+ @NonNull final PfConceptKey policyTypeKey)
throws PfModelException {
- ToscaServiceTemplate serviceTemplate = getPolicyTypes(dao, policyTypeKey);
+ JpaToscaServiceTemplate serviceTemplate = getPolicyTypes(dao, policyTypeKey);
- dao.delete(ToscaPolicyType.class, policyTypeKey);
+ dao.delete(JpaToscaPolicyType.class, policyTypeKey);
return serviceTemplate;
}
@@ -162,16 +163,16 @@ public class SimpleToscaProvider {
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public ToscaServiceTemplate getPolicies(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey)
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey)
throws PfModelException {
// Create the structure of the TOSCA service template to contain the policy type
- ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplate());
- serviceTemplate.getTopologyTemplate().setPolicies(new ToscaPolicies());
+ JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
+ serviceTemplate.setTopologyTemplate(new JpaToscaTopologyTemplate());
+ serviceTemplate.getTopologyTemplate().setPolicies(new JpaToscaPolicies());
// Add the policy to the TOSCA service template
- ToscaPolicy policy = dao.get(ToscaPolicy.class, policyKey);
+ JpaToscaPolicy policy = dao.get(JpaToscaPolicy.class, policyKey);
if (policy != null) {
serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().put(policyKey, policy);
return serviceTemplate;
@@ -190,21 +191,21 @@ public class SimpleToscaProvider {
* @return the TOSCA service template containing the policy types that were created
* @throws PfModelException on errors creating policies
*/
- public ToscaServiceTemplate createPolicies(@NonNull final PfDao dao,
- @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException {
+ public JpaToscaServiceTemplate createPolicies(@NonNull final PfDao dao,
+ @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException {
ToscaUtils.assertPoliciesExist(serviceTemplate);
- for (ToscaPolicy policy : serviceTemplate.getTopologyTemplate().getPolicies().getAll(null)) {
+ for (JpaToscaPolicy policy : serviceTemplate.getTopologyTemplate().getPolicies().getAll(null)) {
dao.create(policy);
}
// Return the created policy types
- ToscaPolicies returnPolicies = new ToscaPolicies();
+ JpaToscaPolicies returnPolicies = new JpaToscaPolicies();
returnPolicies.setKey(serviceTemplate.getTopologyTemplate().getPolicies().getKey());
for (PfConceptKey policyKey : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().keySet()) {
- returnPolicies.getConceptMap().put(policyKey, dao.get(ToscaPolicy.class, policyKey));
+ returnPolicies.getConceptMap().put(policyKey, dao.get(JpaToscaPolicy.class, policyKey));
}
serviceTemplate.getTopologyTemplate().setPolicies(returnPolicies);
@@ -220,21 +221,21 @@ public class SimpleToscaProvider {
* @return the TOSCA service template containing the policies that were updated
* @throws PfModelException on errors updating policies
*/
- public ToscaServiceTemplate updatePolicies(@NonNull final PfDao dao,
- @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException {
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final PfDao dao,
+ @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException {
ToscaUtils.assertPoliciesExist(serviceTemplate);
- for (ToscaPolicy policy : serviceTemplate.getTopologyTemplate().getPolicies().getAll(null)) {
+ for (JpaToscaPolicy policy : serviceTemplate.getTopologyTemplate().getPolicies().getAll(null)) {
dao.update(policy);
}
// Return the created policy types
- ToscaPolicies returnPolicies = new ToscaPolicies();
+ JpaToscaPolicies returnPolicies = new JpaToscaPolicies();
returnPolicies.setKey(serviceTemplate.getTopologyTemplate().getPolicies().getKey());
for (PfConceptKey policyKey : serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().keySet()) {
- returnPolicies.getConceptMap().put(policyKey, dao.get(ToscaPolicy.class, policyKey));
+ returnPolicies.getConceptMap().put(policyKey, dao.get(JpaToscaPolicy.class, policyKey));
}
serviceTemplate.getTopologyTemplate().setPolicies(returnPolicies);
@@ -250,12 +251,12 @@ public class SimpleToscaProvider {
* @return the TOSCA service template containing the policies that were deleted
* @throws PfModelException on errors deleting policies
*/
- public ToscaServiceTemplate deletePolicies(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey)
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey)
throws PfModelException {
- ToscaServiceTemplate serviceTemplate = getPolicies(dao, policyKey);
+ JpaToscaServiceTemplate serviceTemplate = getPolicies(dao, policyKey);
- dao.delete(ToscaPolicy.class, policyKey);
+ dao.delete(JpaToscaPolicy.class, policyKey);
return serviceTemplate;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypeJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypeJsonAdapter.java
index 65e3d4ebf..6b00b20b6 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypeJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypeJsonAdapter.java
@@ -34,8 +34,8 @@ import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaProperty;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
*
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaDataTypeJsonAdapter implements JsonSerializer<ToscaDataType>, JsonDeserializer<ToscaDataType> {
+public class ToscaDataTypeJsonAdapter implements JsonSerializer<JpaToscaDataType>, JsonDeserializer<JpaToscaDataType> {
private static final Logger LOGGER = LoggerFactory.getLogger(ToscaDataTypeJsonAdapter.class);
@@ -55,7 +55,7 @@ public class ToscaDataTypeJsonAdapter implements JsonSerializer<ToscaDataType>,
private static final String DEFAULT_VERSION = "1.0.0";
@Override
- public ToscaDataType deserialize(@NonNull final JsonElement dataTypeElement, @NonNull final Type type,
+ public JpaToscaDataType deserialize(@NonNull final JsonElement dataTypeElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
@@ -79,7 +79,7 @@ public class ToscaDataTypeJsonAdapter implements JsonSerializer<ToscaDataType>,
} else {
dataTypeKey = new PfConceptKey(dataTypeName, dataTypeJsonObject.get(VERSION).getAsString());
}
- ToscaDataType dataType = new ToscaDataType(dataTypeKey);
+ JpaToscaDataType dataType = new JpaToscaDataType(dataTypeKey);
// Set derived_from
dataType.setDerivedFrom(new PfConceptKey(dataTypeJsonObject.get(DERIVED_FROM).getAsString(),
@@ -95,7 +95,7 @@ public class ToscaDataTypeJsonAdapter implements JsonSerializer<ToscaDataType>,
if (dataTypeJsonObject.has(PROPERTIES)) {
dataType.setProperties(
new ToscaPropertiesJsonAdapter().deserializeProperties(dataTypeJsonObject.get(PROPERTIES)));
- for (ToscaProperty property : dataType.getProperties()) {
+ for (JpaToscaProperty property : dataType.getProperties()) {
property.getKey().setParentConceptKey(dataTypeKey);
property.getType().setVersion(dataType.getKey().getVersion());
}
@@ -105,7 +105,7 @@ public class ToscaDataTypeJsonAdapter implements JsonSerializer<ToscaDataType>,
}
@Override
- public JsonElement serialize(@NonNull final ToscaDataType dataType, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaDataType dataType, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonObject dataTypeValJsonObject = new JsonObject();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypesJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypesJsonAdapter.java
index 387b499cf..6131581ad 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypesJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaDataTypesJsonAdapter.java
@@ -34,8 +34,8 @@ import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,12 +44,13 @@ import org.slf4j.LoggerFactory;
*
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaDataTypesJsonAdapter implements JsonSerializer<ToscaDataTypes>, JsonDeserializer<ToscaDataTypes> {
+public class ToscaDataTypesJsonAdapter
+ implements JsonSerializer<JpaToscaDataTypes>, JsonDeserializer<JpaToscaDataTypes> {
private static final Logger LOGGER = LoggerFactory.getLogger(ToscaDataTypesJsonAdapter.class);
@Override
- public ToscaDataTypes deserialize(@NonNull final JsonElement dataTypesElement, @NonNull final Type type,
+ public JpaToscaDataTypes deserialize(@NonNull final JsonElement dataTypesElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
@@ -57,13 +58,13 @@ public class ToscaDataTypesJsonAdapter implements JsonSerializer<ToscaDataTypes>
// The outgoing object
final PfConceptKey dataTypesKey = new PfConceptKey("IncomingDataTypes", "0.0.1");
- final ToscaDataTypes dataTypes = new ToscaDataTypes(dataTypesKey);
+ final JpaToscaDataTypes dataTypes = new JpaToscaDataTypes(dataTypesKey);
// Get the dataTypes
Iterator<JsonElement> dataTypesIterator = dataTypesJsonArray.iterator();
while (dataTypesIterator.hasNext()) {
- ToscaDataType dataType = new ToscaDataTypeJsonAdapter()
- .deserialize(dataTypesIterator.next(), ToscaDataType.class, context);
+ JpaToscaDataType dataType = new ToscaDataTypeJsonAdapter().deserialize(dataTypesIterator.next(),
+ JpaToscaDataType.class, context);
dataTypes.getConceptMap().put(dataType.getKey(), dataType);
}
@@ -72,7 +73,7 @@ public class ToscaDataTypesJsonAdapter implements JsonSerializer<ToscaDataTypes>
}
@Override
- public JsonElement serialize(@NonNull final ToscaDataTypes dataTypes, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaDataTypes dataTypes, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonArray dataTypesJsonArray = new JsonArray();
@@ -83,8 +84,8 @@ public class ToscaDataTypesJsonAdapter implements JsonSerializer<ToscaDataTypes>
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, errorMessage);
}
- for (ToscaDataType dataType: dataTypes.getConceptMap().values()) {
- JsonElement dataTypeEntry = new ToscaDataTypeJsonAdapter().serialize(dataType, type, context);
+ for (JpaToscaDataType dataType : dataTypes.getConceptMap().values()) {
+ JsonElement dataTypeEntry = new ToscaDataTypeJsonAdapter().serialize(dataType, type, context);
dataTypesJsonArray.add(dataTypeEntry);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPoliciesJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPoliciesJsonAdapter.java
index 4b1b53c79..ca0e3d937 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPoliciesJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPoliciesJsonAdapter.java
@@ -33,8 +33,8 @@ import java.util.Iterator;
import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
/**
* GSON type adapter for TOSCA policies.
@@ -42,22 +42,22 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
* @author Liam Fallon (liam.fallon@est.tech)
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaPoliciesJsonAdapter implements JsonSerializer<ToscaPolicies>, JsonDeserializer<ToscaPolicies> {
+public class ToscaPoliciesJsonAdapter implements JsonSerializer<JpaToscaPolicies>, JsonDeserializer<JpaToscaPolicies> {
@Override
- public ToscaPolicies deserialize(@NonNull final JsonElement policiesElement, @NonNull final Type type,
+ public JpaToscaPolicies deserialize(@NonNull final JsonElement policiesElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
final JsonArray policiesJsonArray = policiesElement.getAsJsonArray();
// The outgoing object
final PfConceptKey policiesKey = new PfConceptKey("IncomingPolicies", "0.0.1");
- final ToscaPolicies policies = new ToscaPolicies(policiesKey);
+ final JpaToscaPolicies policies = new JpaToscaPolicies(policiesKey);
// Get the policies
for (Iterator<JsonElement> policiesIterator = policiesJsonArray.iterator(); policiesIterator.hasNext(); ) {
- ToscaPolicy policy = new ToscaPolicyJsonAdapter()
- .deserialize(policiesIterator.next(), ToscaPolicy.class, context);
+ JpaToscaPolicy policy = new ToscaPolicyJsonAdapter()
+ .deserialize(policiesIterator.next(), JpaToscaPolicy.class, context);
policies.getConceptMap().put(policy.getKey(), policy);
}
@@ -66,12 +66,12 @@ public class ToscaPoliciesJsonAdapter implements JsonSerializer<ToscaPolicies>,
}
@Override
- public JsonElement serialize(@NonNull final ToscaPolicies policies, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaPolicies policies, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonArray policiesJsonArray = new JsonArray();
- for (ToscaPolicy policy: policies.getConceptMap().values()) {
+ for (JpaToscaPolicy policy: policies.getConceptMap().values()) {
policiesJsonArray.add(new ToscaPolicyJsonAdapter().serialize(policy, type, context));
}
return policiesJsonArray;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyJsonAdapter.java
index b52634b83..6b666e214 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyJsonAdapter.java
@@ -40,7 +40,7 @@ import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
* @author Liam Fallon (liam.fallon@est.tech)
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaPolicyJsonAdapter implements JsonSerializer<ToscaPolicy>, JsonDeserializer<ToscaPolicy> {
+public class ToscaPolicyJsonAdapter implements JsonSerializer<JpaToscaPolicy>, JsonDeserializer<JpaToscaPolicy> {
// Logger for this class
private static final Logger LOGGER = LoggerFactory.getLogger(ToscaPolicyJsonAdapter.class);
@@ -63,7 +63,7 @@ public class ToscaPolicyJsonAdapter implements JsonSerializer<ToscaPolicy>, Json
private final Gson gson = new GsonBuilder().setPrettyPrinting().create();
@Override
- public ToscaPolicy deserialize(@NonNull final JsonElement policyElement, @NonNull final Type type,
+ public JpaToscaPolicy deserialize(@NonNull final JsonElement policyElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
@@ -85,7 +85,7 @@ public class ToscaPolicyJsonAdapter implements JsonSerializer<ToscaPolicy>, Json
PfConceptKey policyTypeKey = new PfConceptKey(
policyJsonObject.get(TYPE).getAsString(),
policyJsonObject.get(VERSION).getAsString());
- ToscaPolicy policy = new ToscaPolicy(policyKey, policyTypeKey);
+ JpaToscaPolicy policy = new JpaToscaPolicy(policyKey, policyTypeKey);
// Set description
if (policyJsonObject.has(DESCRIPTION)) {
@@ -121,7 +121,7 @@ public class ToscaPolicyJsonAdapter implements JsonSerializer<ToscaPolicy>, Json
}
@Override
- public JsonElement serialize(@NonNull final ToscaPolicy policy, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaPolicy policy, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonObject policyValJsonObject = new JsonObject();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypeJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypeJsonAdapter.java
index 3bf98572f..a96642261 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypeJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypeJsonAdapter.java
@@ -33,8 +33,8 @@ import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaProperty;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,7 +43,8 @@ import org.slf4j.LoggerFactory;
*
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyType>, JsonDeserializer<ToscaPolicyType> {
+public class ToscaPolicyTypeJsonAdapter
+ implements JsonSerializer<JpaToscaPolicyType>, JsonDeserializer<JpaToscaPolicyType> {
private static final Logger LOGGER = LoggerFactory.getLogger(ToscaPolicyTypeJsonAdapter.class);
@@ -54,7 +55,7 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
private static final String DEFAULT_VERSION = "1.0.0";
@Override
- public ToscaPolicyType deserialize(@NonNull final JsonElement policyTypeElement, @NonNull final Type type,
+ public JpaToscaPolicyType deserialize(@NonNull final JsonElement policyTypeElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
@@ -68,8 +69,8 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
}
final String policyTypeName = policyTypeJsonMapObject.entrySet().iterator().next().getKey();
- final JsonObject policyTypeJsonObject = policyTypeJsonMapObject.entrySet().iterator().next()
- .getValue().getAsJsonObject();
+ final JsonObject policyTypeJsonObject =
+ policyTypeJsonMapObject.entrySet().iterator().next().getValue().getAsJsonObject();
// Set keys
PfConceptKey policyTypeKey;
@@ -78,11 +79,11 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
} else {
policyTypeKey = new PfConceptKey(policyTypeName, policyTypeJsonObject.get(VERSION).getAsString());
}
- ToscaPolicyType policyType = new ToscaPolicyType(policyTypeKey);
+ JpaToscaPolicyType policyType = new JpaToscaPolicyType(policyTypeKey);
// Set derived_from
- policyType.setDerivedFrom(new PfConceptKey(policyTypeJsonObject.get(DERIVED_FROM).getAsString(),
- DEFAULT_VERSION));
+ policyType.setDerivedFrom(
+ new PfConceptKey(policyTypeJsonObject.get(DERIVED_FROM).getAsString(), DEFAULT_VERSION));
// Set description
if (policyTypeJsonObject.has(DESCRIPTION)) {
@@ -94,7 +95,7 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
if (policyTypeJsonObject.has(PROPERTIES)) {
policyType.setProperties(
new ToscaPropertiesJsonAdapter().deserializeProperties(policyTypeJsonObject.get(PROPERTIES)));
- for (ToscaProperty property : policyType.getProperties()) {
+ for (JpaToscaProperty property : policyType.getProperties()) {
property.getKey().setParentConceptKey(policyTypeKey);
property.getType().setVersion(policyType.getKey().getVersion());
}
@@ -104,7 +105,7 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
}
@Override
- public JsonElement serialize(@NonNull final ToscaPolicyType policyType, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaPolicyType policyType, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonObject policyTypeValJsonObject = new JsonObject();
@@ -126,8 +127,8 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
// Add properties
if (policyType.getProperties() != null) {
- JsonElement propertiesJsonElement = new ToscaPropertiesJsonAdapter()
- .serializeProperties(policyType.getProperties());
+ JsonElement propertiesJsonElement =
+ new ToscaPropertiesJsonAdapter().serializeProperties(policyType.getProperties());
policyTypeValJsonObject.add(PROPERTIES, propertiesJsonElement);
}
@@ -135,4 +136,4 @@ public class ToscaPolicyTypeJsonAdapter implements JsonSerializer<ToscaPolicyTyp
policyTypeJsonObject.add(policyType.getKey().getName(), policyTypeValJsonObject);
return policyTypeJsonObject;
}
-} \ No newline at end of file
+}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypesJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypesJsonAdapter.java
index c9e65117e..ac6d8e558 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypesJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPolicyTypesJsonAdapter.java
@@ -34,8 +34,8 @@ import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,13 +44,13 @@ import org.slf4j.LoggerFactory;
*
* @author Chenfei Gao (cgao@research.att.com)
*/
-public class ToscaPolicyTypesJsonAdapter implements JsonSerializer<ToscaPolicyTypes>,
- JsonDeserializer<ToscaPolicyTypes> {
+public class ToscaPolicyTypesJsonAdapter implements JsonSerializer<JpaToscaPolicyTypes>,
+ JsonDeserializer<JpaToscaPolicyTypes> {
private static final Logger LOGGER = LoggerFactory.getLogger(ToscaPolicyTypesJsonAdapter.class);
@Override
- public ToscaPolicyTypes deserialize(@NonNull final JsonElement policyTypesElement, @NonNull final Type type,
+ public JpaToscaPolicyTypes deserialize(@NonNull final JsonElement policyTypesElement, @NonNull final Type type,
@NonNull final JsonDeserializationContext context) {
// The incoming JSON
@@ -58,13 +58,13 @@ public class ToscaPolicyTypesJsonAdapter implements JsonSerializer<ToscaPolicyTy
// The outgoing object
final PfConceptKey policyTypesKey = new PfConceptKey("IncomingPolicyTypes", "0.0.1");
- final ToscaPolicyTypes policyTypes = new ToscaPolicyTypes(policyTypesKey);
+ final JpaToscaPolicyTypes policyTypes = new JpaToscaPolicyTypes(policyTypesKey);
// Get the policyTypes
Iterator<JsonElement> policyTypesIterator = policyTypesJsonArray.iterator();
while (policyTypesIterator.hasNext()) {
- ToscaPolicyType policyType = new ToscaPolicyTypeJsonAdapter()
- .deserialize(policyTypesIterator.next(), ToscaPolicyType.class, context);
+ JpaToscaPolicyType policyType = new ToscaPolicyTypeJsonAdapter()
+ .deserialize(policyTypesIterator.next(), JpaToscaPolicyType.class, context);
policyTypes.getConceptMap().put(policyType.getKey(), policyType);
}
@@ -73,7 +73,7 @@ public class ToscaPolicyTypesJsonAdapter implements JsonSerializer<ToscaPolicyTy
}
@Override
- public JsonElement serialize(@NonNull final ToscaPolicyTypes policyTypes, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaPolicyTypes policyTypes, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonArray policyTypesJsonArray = new JsonArray();
@@ -84,7 +84,7 @@ public class ToscaPolicyTypesJsonAdapter implements JsonSerializer<ToscaPolicyTy
throw new PfModelRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, errorMessage);
}
- for (ToscaPolicyType policyType: policyTypes.getConceptMap().values()) {
+ for (JpaToscaPolicyType policyType: policyTypes.getConceptMap().values()) {
JsonElement policyTypeEntry = new ToscaPolicyTypeJsonAdapter().serialize(policyType, type, context);
policyTypesJsonArray.add(policyTypeEntry);
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPropertiesJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPropertiesJsonAdapter.java
index da15a800f..b5c87557a 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPropertiesJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaPropertiesJsonAdapter.java
@@ -33,12 +33,12 @@ import javax.ws.rs.core.Response;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.tosca.simple.concepts.ToscaConstraint;
-import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogical.Operation;
-import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintLogicalString;
-import org.onap.policy.models.tosca.simple.concepts.ToscaConstraintValidValues;
-import org.onap.policy.models.tosca.simple.concepts.ToscaEntrySchema;
-import org.onap.policy.models.tosca.simple.concepts.ToscaProperty;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraint;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogical.Operation;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintLogicalString;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaConstraintValidValues;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaEntrySchema;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,17 +69,17 @@ public class ToscaPropertiesJsonAdapter {
*
* @return deserialized ToscaProperty list
*/
- public List<ToscaProperty> deserializeProperties(JsonElement propertiesElement) {
+ public List<JpaToscaProperty> deserializeProperties(JsonElement propertiesElement) {
final JsonObject propertiesMapObject = propertiesElement.getAsJsonObject();
- List<ToscaProperty> properties = new LinkedList<>();
+ List<JpaToscaProperty> properties = new LinkedList<>();
for (Entry<String, JsonElement> entry : propertiesMapObject.entrySet()) {
final String propertyEntryKey = entry.getKey();
final JsonElement propertyEntryVal = entry.getValue();
// Set property: key and type
- ToscaProperty property = new ToscaProperty(
+ JpaToscaProperty property = new JpaToscaProperty(
new PfReferenceKey(new PfConceptKey(), propertyEntryKey),
new PfConceptKey(propertyEntryVal.getAsJsonObject().get(TYPE).getAsString(), DEFAULT_VERSION));
@@ -110,7 +110,7 @@ public class ToscaPropertiesJsonAdapter {
// Set property: constraints
if (propertyJsonObject.has(CONSTRAINTS)) {
property.setConstraints(deserializeConstraints(propertyJsonObject.get(CONSTRAINTS)));
- for (ToscaConstraint c : property.getConstraints()) {
+ for (JpaToscaConstraint c : property.getConstraints()) {
c.getKey().setParentConceptKey(property.getType());
}
}
@@ -129,11 +129,11 @@ public class ToscaPropertiesJsonAdapter {
*
* @return serialized JsonElement
*/
- public JsonElement serializeProperties(List<ToscaProperty> properties) {
+ public JsonElement serializeProperties(List<JpaToscaProperty> properties) {
JsonObject propertiesJsonObject = new JsonObject();
- for (ToscaProperty property : properties) {
+ for (JpaToscaProperty property : properties) {
JsonObject propertyValJsonObject = new JsonObject();
// Add type
@@ -168,23 +168,23 @@ public class ToscaPropertiesJsonAdapter {
return propertiesJsonObject;
}
- private JsonElement serializeConstraints(List<ToscaConstraint> constraints) {
+ private JsonElement serializeConstraints(List<JpaToscaConstraint> constraints) {
JsonArray constraintsValJsonArray = new JsonArray();
- for (ToscaConstraint c : constraints) {
+ for (JpaToscaConstraint c : constraints) {
JsonObject constraintJsonObject = new JsonObject();
// Check which type of constraint it is
// TODO: here we only support valid_values and equal
- if (c instanceof ToscaConstraintValidValues) {
+ if (c instanceof JpaToscaConstraintValidValues) {
JsonArray validValuesJsonArray = new JsonArray();
- for (String validValue : ((ToscaConstraintValidValues)c).getValidValues()) {
+ for (String validValue : ((JpaToscaConstraintValidValues)c).getValidValues()) {
validValuesJsonArray.add(validValue);
}
constraintJsonObject.add(VALID_VALUES, validValuesJsonArray);
- } else if (c instanceof ToscaConstraintLogicalString) {
- constraintJsonObject.addProperty(EQUAL, ((ToscaConstraintLogicalString)c).getCompareToString());
+ } else if (c instanceof JpaToscaConstraintLogicalString) {
+ constraintJsonObject.addProperty(EQUAL, ((JpaToscaConstraintLogicalString)c).getCompareToString());
} else {
String errorMessage = "constraint is neither valid_values nor equal";
LOGGER.debug(errorMessage);
@@ -197,7 +197,7 @@ public class ToscaPropertiesJsonAdapter {
return constraintsValJsonArray;
}
- private JsonElement serializeEntrySchema(ToscaEntrySchema entrySchema) {
+ private JsonElement serializeEntrySchema(JpaToscaEntrySchema entrySchema) {
JsonObject entrySchemaValJsonObject = new JsonObject();
@@ -217,12 +217,12 @@ public class ToscaPropertiesJsonAdapter {
return entrySchemaValJsonObject;
}
- private ToscaEntrySchema deserializeEntrySchema(JsonElement entrySchemaElement) {
+ private JpaToscaEntrySchema deserializeEntrySchema(JsonElement entrySchemaElement) {
JsonObject entrySchemaJsonObject = entrySchemaElement.getAsJsonObject();
// Set entry_schema: key and type
- ToscaEntrySchema entrySchema = new ToscaEntrySchema(
+ JpaToscaEntrySchema entrySchema = new JpaToscaEntrySchema(
new PfReferenceKey(new PfConceptKey(), ENTRY_SCHEMA),
new PfConceptKey(entrySchemaJsonObject.get(TYPE).getAsString(), DEFAULT_VERSION));
@@ -234,7 +234,7 @@ public class ToscaPropertiesJsonAdapter {
// Set entry_schema: constraints
if (entrySchemaJsonObject.has(CONSTRAINTS)) {
entrySchema.setConstraints(deserializeConstraints(entrySchemaJsonObject.get(CONSTRAINTS)));
- for (ToscaConstraint c : entrySchema.getConstraints()) {
+ for (JpaToscaConstraint c : entrySchema.getConstraints()) {
c.getKey().setParentConceptKey(entrySchema.getType());
}
}
@@ -242,10 +242,10 @@ public class ToscaPropertiesJsonAdapter {
return entrySchema;
}
- private List<ToscaConstraint> deserializeConstraints(JsonElement constraintsElement) {
+ private List<JpaToscaConstraint> deserializeConstraints(JsonElement constraintsElement) {
JsonArray constraintsJsonArray = constraintsElement.getAsJsonArray();
- List<ToscaConstraint> constraints = new LinkedList<>();
+ List<JpaToscaConstraint> constraints = new LinkedList<>();
for (Iterator<JsonElement> constraintsIter = constraintsJsonArray.iterator(); constraintsIter.hasNext(); ) {
JsonObject constraintJsonObject = constraintsIter.next().getAsJsonObject();
@@ -257,11 +257,11 @@ public class ToscaPropertiesJsonAdapter {
.iterator(); validValuesIter.hasNext(); ) {
validValues.add(validValuesIter.next().getAsString());
}
- ToscaConstraint constraint = new ToscaConstraintValidValues(
+ JpaToscaConstraint constraint = new JpaToscaConstraintValidValues(
new PfReferenceKey(new PfConceptKey(), VALID_VALUES), validValues);
constraints.add(constraint);
} else if (constraintJsonObject.get(EQUAL) != null) {
- ToscaConstraint constraint = new ToscaConstraintLogicalString(new PfReferenceKey(
+ JpaToscaConstraint constraint = new JpaToscaConstraintLogicalString(new PfReferenceKey(
new PfConceptKey(), EQUAL), Operation.EQ, constraintJsonObject.get(EQUAL).getAsString());
constraints.add(constraint);
} else {
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateJsonAdapter.java
index 78f3153e2..bb2ace87e 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateJsonAdapter.java
@@ -32,10 +32,10 @@ import java.lang.reflect.Type;
import lombok.NonNull;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataTypes;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyTypes;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
/**
* GSON type adapter for TOSCA policies.
@@ -44,7 +44,7 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
* @author Chenfei Gao (cgao@research.att.com)
*/
public class ToscaServiceTemplateJsonAdapter
- implements JsonSerializer<ToscaServiceTemplate>, JsonDeserializer<ToscaServiceTemplate> {
+ implements JsonSerializer<JpaToscaServiceTemplate>, JsonDeserializer<JpaToscaServiceTemplate> {
private static final String TOPOLOGY_TEMPLATE = "topology_template";
private static final String TOSCA_DEFINITIONS_VERSION = "tosca_definitions_version";
@@ -52,40 +52,40 @@ public class ToscaServiceTemplateJsonAdapter
private static final String DATA_TYPES = "data_types";
@Override
- public ToscaServiceTemplate deserialize(@NonNull final JsonElement serviceTemplateElement, @NonNull final Type type,
- @NonNull final JsonDeserializationContext context) {
+ public JpaToscaServiceTemplate deserialize(@NonNull final JsonElement serviceTemplateElement,
+ @NonNull final Type type, @NonNull final JsonDeserializationContext context) {
// The incoming JSON
final JsonObject serviceTemplateJsonObject = serviceTemplateElement.getAsJsonObject();
// The outgoing object
- final ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
+ final JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate();
serviceTemplate
.setToscaDefinitionsVersion(serviceTemplateJsonObject.get(TOSCA_DEFINITIONS_VERSION).getAsString());
// Set topology_template
if (serviceTemplateJsonObject.has(TOPOLOGY_TEMPLATE)) {
serviceTemplate.setTopologyTemplate(new ToscaTopologyTemplateJsonAdapter().deserialize(
- serviceTemplateJsonObject.get(TOPOLOGY_TEMPLATE), ToscaTopologyTemplate.class, context));
+ serviceTemplateJsonObject.get(TOPOLOGY_TEMPLATE), JpaToscaTopologyTemplate.class, context));
}
// Set policy_types
if (serviceTemplateJsonObject.has(POLICY_TYPES)) {
serviceTemplate.setPolicyTypes(new ToscaPolicyTypesJsonAdapter()
- .deserialize(serviceTemplateJsonObject.get(POLICY_TYPES), ToscaPolicyTypes.class, context));
+ .deserialize(serviceTemplateJsonObject.get(POLICY_TYPES), JpaToscaPolicyTypes.class, context));
}
// Set data_types
if (serviceTemplateJsonObject.has(DATA_TYPES)) {
serviceTemplate.setDataTypes(new ToscaDataTypesJsonAdapter()
- .deserialize(serviceTemplateJsonObject.get(DATA_TYPES), ToscaDataTypes.class, context));
+ .deserialize(serviceTemplateJsonObject.get(DATA_TYPES), JpaToscaDataTypes.class, context));
}
return serviceTemplate;
}
@Override
- public JsonElement serialize(@NonNull final ToscaServiceTemplate serviceTemplate, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaServiceTemplate serviceTemplate, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonObject serviceTemplateJsonObject = new JsonObject();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateMessageBodyHandler.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateMessageBodyHandler.java
index c7e78a524..b15a83016 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateMessageBodyHandler.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaServiceTemplateMessageBodyHandler.java
@@ -21,14 +21,14 @@ package org.onap.policy.models.tosca.simple.serialization;
import com.google.gson.GsonBuilder;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaDataTypes;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicyTypes;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaDataTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicy;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyType;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicyTypes;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -56,14 +56,14 @@ public class ToscaServiceTemplateMessageBodyHandler extends GsonMessageBodyHandl
public ToscaServiceTemplateMessageBodyHandler(final GsonBuilder builder) {
// @formatter:off
super(builder
- .registerTypeAdapter(ToscaServiceTemplate.class, new ToscaServiceTemplateJsonAdapter())
- .registerTypeAdapter(ToscaTopologyTemplate.class, new ToscaTopologyTemplateJsonAdapter())
- .registerTypeAdapter(ToscaPolicies.class, new ToscaPoliciesJsonAdapter())
- .registerTypeAdapter(ToscaPolicy.class, new ToscaPolicyJsonAdapter())
- .registerTypeAdapter(ToscaPolicyTypes.class, new ToscaPolicyTypesJsonAdapter())
- .registerTypeAdapter(ToscaPolicyType.class, new ToscaPolicyTypeJsonAdapter())
- .registerTypeAdapter(ToscaDataTypes.class, new ToscaDataTypesJsonAdapter())
- .registerTypeAdapter(ToscaDataType.class, new ToscaDataTypeJsonAdapter())
+ .registerTypeAdapter(JpaToscaServiceTemplate.class, new ToscaServiceTemplateJsonAdapter())
+ .registerTypeAdapter(JpaToscaTopologyTemplate.class, new ToscaTopologyTemplateJsonAdapter())
+ .registerTypeAdapter(JpaToscaPolicies.class, new ToscaPoliciesJsonAdapter())
+ .registerTypeAdapter(JpaToscaPolicy.class, new ToscaPolicyJsonAdapter())
+ .registerTypeAdapter(JpaToscaPolicyTypes.class, new ToscaPolicyTypesJsonAdapter())
+ .registerTypeAdapter(JpaToscaPolicyType.class, new ToscaPolicyTypeJsonAdapter())
+ .registerTypeAdapter(JpaToscaDataTypes.class, new ToscaDataTypesJsonAdapter())
+ .registerTypeAdapter(JpaToscaDataType.class, new ToscaDataTypeJsonAdapter())
.setPrettyPrinting()
.create()
);
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaTopologyTemplateJsonAdapter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaTopologyTemplateJsonAdapter.java
index d302b7e6c..df8ebb556 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaTopologyTemplateJsonAdapter.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/serialization/ToscaTopologyTemplateJsonAdapter.java
@@ -34,8 +34,8 @@ import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfReferenceKey;
-import org.onap.policy.models.tosca.simple.concepts.ToscaPolicies;
-import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaPolicies;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaTopologyTemplate;
/**
* GSON type adapter for TOSCA policies.
@@ -44,13 +44,13 @@ import org.onap.policy.models.tosca.simple.concepts.ToscaTopologyTemplate;
* @author Chenfei Gao (cgao@research.att.com)
*/
public class ToscaTopologyTemplateJsonAdapter
- implements JsonSerializer<ToscaTopologyTemplate>, JsonDeserializer<ToscaTopologyTemplate> {
+ implements JsonSerializer<JpaToscaTopologyTemplate>, JsonDeserializer<JpaToscaTopologyTemplate> {
private static final String POLICIES = "policies";
private static final String DESCRIPTION = "description";
@Override
- public ToscaTopologyTemplate deserialize(@NonNull final JsonElement toplogyTemplateElement,
+ public JpaToscaTopologyTemplate deserialize(@NonNull final JsonElement toplogyTemplateElement,
@NonNull final Type type, @NonNull final JsonDeserializationContext context) {
// The incoming JSON
@@ -58,7 +58,7 @@ public class ToscaTopologyTemplateJsonAdapter
// The outgoing object
final PfReferenceKey topologyTemplateKey = new PfReferenceKey(new PfConceptKey(), "IncomingTopologyTemplate");
- final ToscaTopologyTemplate topologyTemplate = new ToscaTopologyTemplate(topologyTemplateKey);
+ final JpaToscaTopologyTemplate topologyTemplate = new JpaToscaTopologyTemplate(topologyTemplateKey);
if (topologyTemplateJsonObject.has(DESCRIPTION)) {
topologyTemplate.setDescription(topologyTemplateJsonObject.get(DESCRIPTION).getAsString());
@@ -66,14 +66,14 @@ public class ToscaTopologyTemplateJsonAdapter
if (topologyTemplateJsonObject.has(POLICIES)) {
topologyTemplate.setPolicies(new ToscaPoliciesJsonAdapter()
- .deserialize(topologyTemplateJsonObject.get(POLICIES), ToscaPolicies.class, context));
+ .deserialize(topologyTemplateJsonObject.get(POLICIES), JpaToscaPolicies.class, context));
}
return topologyTemplate;
}
@Override
- public JsonElement serialize(@NonNull final ToscaTopologyTemplate topologyTemplate, @NonNull final Type type,
+ public JsonElement serialize(@NonNull final JpaToscaTopologyTemplate topologyTemplate, @NonNull final Type type,
@NonNull final JsonSerializationContext context) {
JsonObject topologyTemplateJsonObject = new JsonObject();
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
index a02bfa4b7..93333c4e3 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/utils/ToscaUtils.java
@@ -23,7 +23,7 @@ package org.onap.policy.models.tosca.utils;
import javax.ws.rs.core.Response;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,7 +44,7 @@ public final class ToscaUtils {
/**
* Check if policy types have been specified is initialized.
*/
- public static void assertPolicyTypesExist(final ToscaServiceTemplate serviceTemplate) {
+ public static void assertPolicyTypesExist(final JpaToscaServiceTemplate serviceTemplate) {
if (serviceTemplate.getPolicyTypes() == null) {
String errorMessage = "no policy types specified on service template";
LOGGER.warn(errorMessage);
@@ -61,7 +61,7 @@ public final class ToscaUtils {
/**
* Check if policy types have been specified is initialized.
*/
- public static void assertPoliciesExist(final ToscaServiceTemplate serviceTemplate) {
+ public static void assertPoliciesExist(final JpaToscaServiceTemplate serviceTemplate) {
if (serviceTemplate.getTopologyTemplate() == null) {
String errorMessage = "topology template not specified on service template";
LOGGER.warn(errorMessage);