aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
diff options
context:
space:
mode:
Diffstat (limited to 'models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java')
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index eebacd1d6..30ad2b246 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -186,9 +186,17 @@ public class JpaToscaPolicy extends JpaToscaEntityType<ToscaPolicy> implements P
public void fromAuthorative(@NonNull final ToscaPolicy toscaPolicy) {
super.fromAuthorative(toscaPolicy);
- type.setName(toscaPolicy.getType());
- type.setVersion(toscaPolicy.getTypeVersion());
- if (type.getVersion() == null) {
+ if (toscaPolicy.getType() != null) {
+ type.setName(toscaPolicy.getType());
+ }
+ else {
+ type.setName(PfKey.NULL_KEY_NAME);
+ }
+
+ if (toscaPolicy.getTypeVersion() != null) {
+ type.setVersion(toscaPolicy.getTypeVersion());
+ }
+ else {
type.setVersion(PfKey.NULL_KEY_VERSION);
}