PolicyAudit creation when deploy/undeploy triggered.
[policy/pap.git] / main / src / main / java / org / onap / policy / pap / main / rest / PdpGroupDeleteProvider.java
index 38851cd..6f39a71 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP PAP
  * ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
  * Modifications Copyright (C) 2020-2021 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -93,8 +93,8 @@ public class PdpGroupDeleteProvider extends ProviderBase {
      * @param policyIdent identifier of the policy to be undeployed
      * @throws PfModelException if an error occurred
      */
-    public void undeploy(ToscaConceptIdentifierOptVersion policyIdent) throws PfModelException {
-        process(policyIdent, this::undeployPolicy);
+    public void undeploy(ToscaConceptIdentifierOptVersion policyIdent, String user) throws PfModelException {
+        process(user, policyIdent, this::undeployPolicy);
     }
 
     /**
@@ -146,7 +146,7 @@ public class PdpGroupDeleteProvider extends ProviderBase {
 
             Set<String> pdps = subgroup.getPdpInstances().stream().map(Pdp::getInstanceId).collect(Collectors.toSet());
 
-            boolean result = false;
+            var result = false;
 
             Iterator<ToscaConceptIdentifier> iter = subgroup.getPolicies().iterator();
             while (iter.hasNext()) {
@@ -158,7 +158,7 @@ public class PdpGroupDeleteProvider extends ProviderBase {
                     logger.info("remove policy {} from subgroup {} {} count={}", ident,
                                     group.getName(), subgroup.getPdpType(), subgroup.getPolicies().size());
 
-                    data.trackUndeploy(ident, pdps);
+                    data.trackUndeploy(ident, pdps, group.getName(), subgroup.getPdpType());
                 }
             }