summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/pom.xml2
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeProvider.java19
2 files changed, 3 insertions, 18 deletions
diff --git a/main/pom.xml b/main/pom.xml
index b0e8ef19..9c3b012e 100644
--- a/main/pom.xml
+++ b/main/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.onap.policy.pap</groupId>
<artifactId>policy-pap</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.2.3-SNAPSHOT</version>
</parent>
<artifactId>pap-main</artifactId>
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeProvider.java
index 97a214c7..0c90ae47 100644
--- a/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeProvider.java
+++ b/main/src/main/java/org/onap/policy/pap/main/rest/PdpGroupStateChangeProvider.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Modifications Copyright (C) 2019 AT&T Intellectual Property.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pap.concepts.PdpGroupStateChangeResponse;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroup;
-import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
@@ -82,16 +81,10 @@ public class PdpGroupStateChangeProvider extends PdpMessageGenerator {
private void handleActiveState(final String groupName) throws PfModelException {
try (PolicyModelsProvider databaseProvider = modelProviderWrapper.create()) {
- final PdpGroupFilter filter = PdpGroupFilter.builder().name(groupName).groupState(PdpState.ACTIVE).build();
- final List<PdpGroup> activePdpGroups = databaseProvider.getFilteredPdpGroups(filter);
final List<PdpGroup> pdpGroups = databaseProvider.getPdpGroups(groupName);
- if (activePdpGroups.isEmpty() && !pdpGroups.isEmpty()) {
+ if (!pdpGroups.isEmpty() && !PdpState.ACTIVE.equals(pdpGroups.get(0).getPdpGroupState())) {
updatePdpGroupAndPdp(databaseProvider, pdpGroups, PdpState.ACTIVE);
sendPdpMessage(pdpGroups.get(0), PdpState.ACTIVE, databaseProvider);
- } else if (!pdpGroups.isEmpty() && !activePdpGroups.isEmpty()) {
- updatePdpGroupAndPdp(databaseProvider, pdpGroups, PdpState.ACTIVE);
- updatePdpGroup(databaseProvider, activePdpGroups, PdpState.PASSIVE);
- sendPdpMessage(pdpGroups.get(0), PdpState.ACTIVE, databaseProvider);
}
}
}
@@ -106,14 +99,6 @@ public class PdpGroupStateChangeProvider extends PdpMessageGenerator {
}
}
- private void updatePdpGroup(final PolicyModelsProvider databaseProvider, final List<PdpGroup> pdpGroups,
- final PdpState pdpState) throws PfModelException {
- pdpGroups.get(0).setPdpGroupState(pdpState);
- databaseProvider.updatePdpGroups(pdpGroups);
-
- LOGGER.debug("Updated PdpGroup in DB - {} ", pdpGroups);
- }
-
private void updatePdpGroupAndPdp(final PolicyModelsProvider databaseProvider, final List<PdpGroup> pdpGroups,
final PdpState pdpState) throws PfModelException {
pdpGroups.get(0).setPdpGroupState(pdpState);