Fix Participant primed status in ACM

Fix Participant primed status is not updated correctly in the runtime

Issue-ID: POLICY-4625
Change-Id: I6a3ce7b73f5edaeedf84ec43c7f62c526cd99f36
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
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 71f510a..dc4a6e3 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
@@ -37,6 +37,7 @@
 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
 import org.springframework.data.domain.Example;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 
 @Service
@@ -97,6 +98,7 @@
         var jpaAcmDefinition = ProviderUtils.getJpaAndValidate(acDefinition, JpaAutomationCompositionDefinition::new,
                 "AutomationCompositionDefinition");
         acmDefinitionRepository.save(jpaAcmDefinition);
+        acmDefinitionRepository.flush();
     }
 
     /**
@@ -141,7 +143,7 @@
      * @param compositionId The UUID of the automation composition definition to delete
      * @return the automation composition definition
      */
-    @Transactional(readOnly = true)
+    @Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
     public Optional<AutomationCompositionDefinition> findAcDefinition(UUID compositionId) {
         var jpaGet = acmDefinitionRepository.findById(compositionId.toString());
         return jpaGet.stream().map(JpaAutomationCompositionDefinition::toAuthorative).findFirst();
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
index ca0b5c5..d8eddf5 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
@@ -47,7 +47,6 @@
  * database to the callers.
  */
 @Service
-@Transactional
 @RequiredArgsConstructor
 public class CommissioningProvider {
     public static final String AUTOMATION_COMPOSITION_NODE_TYPE = "org.onap.policy.clamp.acm.AutomationComposition";
@@ -81,6 +80,7 @@
      * @param serviceTemplate the service template
      * @return the result of the commissioning operation
      */
+    @Transactional
     public CommissioningResponse createAutomationCompositionDefinition(ToscaServiceTemplate serviceTemplate) {
 
         var acmDefinition = acDefinitionProvider.createAutomationCompositionDefinition(serviceTemplate);
@@ -95,6 +95,7 @@
      * @param serviceTemplate the service template
      * @return the result of the commissioning operation
      */
+    @Transactional
     public CommissioningResponse updateCompositionDefinition(UUID compositionId, ToscaServiceTemplate serviceTemplate) {
         if (verifyIfInstanceExists(compositionId)) {
             throw new PfModelRuntimeException(Status.BAD_REQUEST,
@@ -116,6 +117,7 @@
      * @param compositionId The UUID of the automation composition definition to delete
      * @return the result of the deletion
      */
+    @Transactional
     public CommissioningResponse deleteAutomationCompositionDefinition(UUID compositionId) {
         if (verifyIfInstanceExists(compositionId)) {
             throw new PfModelRuntimeException(Status.BAD_REQUEST,
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
index d6bae3b..6a1e12f 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -57,7 +57,7 @@
         var acDefinition = acDefinitionOpt.get();
         if (!AcTypeState.PRIMING.equals(acDefinition.getState())
                 && !AcTypeState.DEPRIMING.equals(acDefinition.getState())) {
-            LOGGER.warn("AC Definition {} already primed/deprimed with participant {}",
+            LOGGER.error("AC Definition {} already primed/deprimed with participant {}",
                     participantPrimeAckMessage.getCompositionId(), participantPrimeAckMessage.getParticipantId());
             return;
         }