diff options
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.java | 12 |
1 files changed, 12 insertions, 0 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 feae48e1a..92e0faea6 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 @@ -62,6 +62,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; @EqualsAndHashCode(callSuper = true) public class JpaToscaPolicy extends JpaToscaWithTypeAndStringProperties<ToscaPolicy> { private static final long serialVersionUID = 3265174757061982805L; + private static final String METADATA_METADATA_SET_NAME_TAG = "metadataSetName"; + private static final String METADATA_METADATA_SET_VERSION_TAG = "metadataSetVersion"; // Tags for metadata private static final String METADATA_POLICY_ID_TAG = "policy-id"; @@ -143,6 +145,16 @@ public class JpaToscaPolicy extends JpaToscaWithTypeAndStringProperties<ToscaPol // Add the policy name and version fields to the metadata getMetadata().put(METADATA_POLICY_ID_TAG, getKey().getName()); getMetadata().put(METADATA_POLICY_VERSION_TAG, getKey().getVersion()); + + // Add metadataSet name and version to the metadata + if (getMetadata().containsKey(METADATA_METADATA_SET_NAME_TAG) + && getMetadata().containsKey(METADATA_METADATA_SET_VERSION_TAG)) { + getMetadata().put(METADATA_METADATA_SET_NAME_TAG, getMetadata().get(METADATA_METADATA_SET_NAME_TAG) + .replaceAll("^\"|\"$", "")); + + getMetadata().put(METADATA_METADATA_SET_VERSION_TAG, getMetadata().get(METADATA_METADATA_SET_VERSION_TAG) + .replaceAll("^\"|\"$", "")); + } } @Override |