diff options
Diffstat (limited to 'runtime-acm/src/main')
3 files changed, 14 insertions, 8 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java index 29b337edd..03a2f4e25 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java @@ -43,6 +43,7 @@ import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.ObjectValidationResult; import org.onap.policy.common.parameters.ValidationStatus; import org.onap.policy.models.base.PfModelRuntimeException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -80,9 +81,10 @@ public class AutomationCompositionInstantiationProvider { if (!validationResult.isValid()) { throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult()); } - automationComposition = automationCompositionProvider.saveAutomationComposition(automationComposition); + automationComposition = automationCompositionProvider.createAutomationComposition(automationComposition); var response = new InstantiationResponse(); + response.setInstanceId(automationComposition.getInstanceId()); response.setAffectedAutomationComposition(automationComposition.getKey().asIdentifier()); return response; @@ -99,9 +101,10 @@ public class AutomationCompositionInstantiationProvider { if (!validationResult.isValid()) { throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult()); } - automationCompositionProvider.saveAutomationComposition(automationComposition); + automationCompositionProvider.updateAutomationComposition(automationComposition); var response = new InstantiationResponse(); + response.setInstanceId(automationComposition.getInstanceId()); response.setAffectedAutomationComposition(automationComposition.getKey().asIdentifier()); return response; @@ -134,7 +137,8 @@ public class AutomationCompositionInstantiationProvider { * @return the result of the deletion */ public InstantiationResponse deleteAutomationComposition(String name, String version) { - var automationCompositionOpt = automationCompositionProvider.findAutomationComposition(name, version); + var automationCompositionOpt = + automationCompositionProvider.findAutomationComposition(new ToscaConceptIdentifier(name, version)); if (automationCompositionOpt.isEmpty()) { throw new PfModelRuntimeException(Response.Status.NOT_FOUND, "Automation composition not found"); } @@ -144,8 +148,10 @@ public class AutomationCompositionInstantiationProvider { "Automation composition state is still " + automationComposition.getState()); } var response = new InstantiationResponse(); - response.setAffectedAutomationComposition( - automationCompositionProvider.deleteAutomationComposition(name, version).getKey().asIdentifier()); + automationComposition = + automationCompositionProvider.deleteAutomationComposition(automationComposition.getInstanceId()); + response.setInstanceId(automationComposition.getInstanceId()); + response.setAffectedAutomationComposition(automationComposition.getKey().asIdentifier()); return response; } @@ -199,7 +205,7 @@ public class AutomationCompositionInstantiationProvider { automationComposition.setCascadedOrderedState(command.getOrderedState()); supervisionHandler.triggerAutomationCompositionSupervision(automationComposition); - automationCompositionProvider.saveAutomationComposition(automationComposition); + automationCompositionProvider.updateAutomationComposition(automationComposition); var response = new InstantiationResponse(); response.setAffectedAutomationComposition(command.getAutomationCompositionIdentifier()); 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 b5d7645da..de67360f8 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 @@ -235,7 +235,7 @@ public class SupervisionHandler { automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet()); updated |= setPrimed(automationComposition.get()); if (updated) { - automationCompositionProvider.saveAutomationComposition(automationComposition.get()); + automationCompositionProvider.updateAutomationComposition(automationComposition.get()); } } else { LOGGER.warn("AutomationComposition not found in database {}", diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java index e2f8b6777..129569b6b 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java @@ -242,7 +242,7 @@ public class SupervisionScanner { automationComposition.getState(), automationComposition.getOrderedState()); automationComposition.setState(automationComposition.getOrderedState().asState()); - automationCompositionProvider.saveAutomationComposition(automationComposition); + automationCompositionProvider.updateAutomationComposition(automationComposition); // Clear missed report counter on automation composition clearFaultAndCounter(automationComposition); |