diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-05-16 15:24:54 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-05-17 09:32:57 +0000 |
commit | db6eb3fc07398e31dfa664992117f33fa8489cec (patch) | |
tree | f492919cd5b1c2973e91b4866e49e1deb36f524b /models/src/main/java/org | |
parent | 722523f568a682f1e48f6998c24c945802fec782 (diff) |
Add extend instance deletion support in ACM
Extend the functionality of deletion step to also inform the participant of instance deletion. This allow the participant to take any necessary steps that might result from instance deletion.
Issue-ID: POLICY-4686
Change-Id: Ibeb44d472da20ad98dafa9ddd7ded28398f4ed10
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/main/java/org')
5 files changed, 44 insertions, 14 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java index 659b312d4..94aa07097 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/DeployState.java @@ -24,5 +24,7 @@ public enum DeployState { DEPLOYED, DEPLOYING, UNDEPLOYED, - UNDEPLOYING + UNDEPLOYING, + DELETING, + DELETED } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java index 6c1572d19..f4b57f1d1 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/DeployOrder.java @@ -23,5 +23,6 @@ package org.onap.policy.clamp.models.acm.messages.rest.instantiation; public enum DeployOrder { NONE, UNDEPLOY, - DEPLOY + DEPLOY, + DELETE } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java index dba64f585..8676b3397 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AcInstanceStateResolver.java @@ -44,6 +44,7 @@ public class AcInstanceStateResolver { // list of results public static final String DEPLOY = DeployOrder.DEPLOY.name(); public static final String UNDEPLOY = DeployOrder.UNDEPLOY.name(); + public static final String DELETE = DeployOrder.DELETE.name(); public static final String LOCK = LockOrder.LOCK.name(); public static final String UNLOCK = LockOrder.UNLOCK.name(); public static final String NONE = "NONE"; @@ -56,6 +57,7 @@ public class AcInstanceStateResolver { this.graph.put(new String[] {DEPLOY, LOCK_NONE, UNDEPLOYED, STATE_LOCKED_NONE}, DEPLOY); this.graph.put(new String[] {UNDEPLOY, LOCK_NONE, DEPLOYED, LOCKED}, UNDEPLOY); + this.graph.put(new String[] {DELETE, LOCK_NONE, UNDEPLOYED, LOCK_NONE}, DELETE); this.graph.put(new String[] {DEPLOY_NONE, UNLOCK, DEPLOYED, LOCKED}, UNLOCK); this.graph.put(new String[] {DEPLOY_NONE, LOCK, DEPLOYED, UNLOCKED}, LOCK); } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java index 94693fd0b..38add31dd 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java @@ -203,7 +203,7 @@ public class AutomationCompositionProvider { var jpa = acElementRepository.getReferenceById(element.getAutomationCompositionElementId().toString()); jpa.setUseState(element.getUseState()); jpa.setOperationalState(element.getOperationalState()); - jpa.setProperties(element.getStatusProperties()); + jpa.setStatusProperties(element.getStatusProperties()); jpaList.add(jpa); } } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java index 35482b9bb..7de4720ad 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java @@ -284,7 +284,8 @@ public final class AcmUtils { */ public static boolean isInTransitionalState(DeployState deployState, LockState lockState) { return DeployState.DEPLOYING.equals(deployState) || DeployState.UNDEPLOYING.equals(deployState) - || LockState.LOCKING.equals(lockState) || LockState.UNLOCKING.equals(lockState); + || LockState.LOCKING.equals(lockState) || LockState.UNLOCKING.equals(lockState) + || DeployState.DELETING.equals(deployState); } /** @@ -294,12 +295,24 @@ public final class AcmUtils { * @return the DeployOrder */ public static DeployOrder stateDeployToOrder(DeployState deployState) { - if (DeployState.DEPLOYING.equals(deployState)) { - return DeployOrder.DEPLOY; - } else if (DeployState.UNDEPLOYING.equals(deployState)) { - return DeployOrder.UNDEPLOY; + DeployOrder result = null; + switch (deployState) { + case DEPLOYING: + result = DeployOrder.DEPLOY; + break; + + case UNDEPLOYING: + result = DeployOrder.UNDEPLOY; + break; + + case DELETING: + result = DeployOrder.DELETE; + break; + + default: + result = DeployOrder.NONE; } - return DeployOrder.NONE; + return result; } /** @@ -324,12 +337,24 @@ public final class AcmUtils { * @return the DeployState */ public static DeployState deployCompleted(DeployState deployState) { - if (DeployState.DEPLOYING.equals(deployState)) { - return DeployState.DEPLOYED; - } else if (DeployState.UNDEPLOYING.equals(deployState)) { - return DeployState.UNDEPLOYED; + DeployState result = null; + switch (deployState) { + case DEPLOYING: + result = DeployState.DEPLOYED; + break; + + case UNDEPLOYING: + result = DeployState.UNDEPLOYED; + break; + + case DELETING: + result = DeployState.DELETED; + break; + + default: + return deployState; } - return deployState; + return result; } /** |