diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-01-03 10:48:36 +0000 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-01-04 09:54:47 +0000 |
commit | 951196b4e0d4c64403f186693c2d1c53e25df3b1 (patch) | |
tree | bdfbd91c858902522be7866081496e2f5e878db4 /models/src/main/java/org/onap | |
parent | c6fb86de3dae6f26aec9813cd5ef4cc8d9268359 (diff) |
Refactor Post compositions to create and update ACM definitions
Issue-ID: POLICY-4492
Change-Id: Ica3885c7e2a048500a86abc194624ac22efd6bc2
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/main/java/org/onap')
-rw-r--r-- | models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProvider.java | 8 |
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"); |