summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
index 12a05946e..054271512 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.models.acm.persistence.provider;
+import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -52,7 +53,12 @@ public class AcDefinitionProvider {
public AutomationCompositionDefinition createAutomationCompositionDefinition(
final ToscaServiceTemplate serviceTemplate) {
var acmDefinition = new AutomationCompositionDefinition();
- acmDefinition.setCompositionId(UUID.randomUUID());
+ var compositionId = UUID.randomUUID();
+ acmDefinition.setCompositionId(compositionId);
+ if (serviceTemplate.getMetadata() == null) {
+ serviceTemplate.setMetadata(new HashMap<>());
+ }
+ serviceTemplate.getMetadata().put("compositionId", compositionId);
acmDefinition.setServiceTemplate(serviceTemplate);
var jpaAcmDefinition = ProviderUtils.getJpaAndValidate(acmDefinition, JpaAutomationCompositionDefinition::new,
"AutomationCompositionDefinition");