summaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@est.tech>2019-04-03 14:26:01 +0000
committerramverma <ram.krishna.verma@est.tech>2019-04-03 14:26:01 +0000
commit23ed0372dac385ad2525bcfc84e8d6b558ef92d6 (patch)
tree69dadb87c1ae1f3891e7bbe49b244aa7fe7e01dc /main/src
parenta47c4b53211a4ad6a448b3f6b28b683189f88c80 (diff)
Changes in pdp registration handler
1) Fix left over comments from previous review. 2) Change from PdpGroups to List<PdpGroup> Change-Id: I833d4cf2837babf0947c9999220a651f9a69bf7e Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java41
1 files changed, 20 insertions, 21 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java b/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java
index 5a44ff91..f873ab3c 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java
@@ -29,7 +29,6 @@ import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpGroup;
-import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
@@ -91,20 +90,18 @@ public class PdpStatusMessageHandler {
boolean pdpGroupFound = false;
Optional<PdpSubGroup> subGroup = null;
final List<Pair<String, String>> supportedPolicyTypesPair = createSupportedPolictTypesPair(message);
- final PdpGroups pdpGroups =
+ final List<PdpGroup> pdpGroups =
databaseProvider.getFilteredPdpGroups(message.getPdpType(), supportedPolicyTypesPair);
- for (final PdpGroup pdpGroup : pdpGroups.getGroups()) {
- if (pdpGroup.getPdpGroupState().equals(PdpState.ACTIVE)) {
- subGroup = findPdpSubGroup(message, pdpGroup);
- if (subGroup.isPresent()) {
- LOGGER.debug("Found pdpGroup - {}, going for registration of PDP - {}", pdpGroup, message);
- if (!findPdpInstance(message, subGroup.get()).isPresent()) {
- updatePdpSubGroup(pdpGroup, subGroup.get(), message, databaseProvider);
- }
- sendPdpMessage(pdpGroup.getName(), subGroup.get(), message.getInstance(), null);
- pdpGroupFound = true;
- break;
+ for (final PdpGroup pdpGroup : pdpGroups) {
+ subGroup = findPdpSubGroup(message, pdpGroup);
+ if (subGroup.isPresent()) {
+ LOGGER.debug("Found pdpGroup - {}, going for registration of PDP - {}", pdpGroup, message);
+ if (!findPdpInstance(message, subGroup.get()).isPresent()) {
+ updatePdpSubGroup(pdpGroup, subGroup.get(), message, databaseProvider);
}
+ sendPdpMessage(pdpGroup.getName(), subGroup.get(), message.getInstance(), null);
+ pdpGroupFound = true;
+ break;
}
}
return pdpGroupFound;
@@ -141,14 +138,16 @@ public class PdpStatusMessageHandler {
Optional<PdpSubGroup> pdpSubgroup = null;
Optional<Pdp> pdpInstance = null;
- final PdpGroups pdpGroups = databaseProvider.getLatestPdpGroups(message.getPdpGroup());
- final PdpGroup pdpGroup = pdpGroups.getGroups().get(0);
- pdpSubgroup = findPdpSubGroup(message, pdpGroup);
- if (pdpSubgroup.isPresent()) {
- pdpInstance = findPdpInstance(message, pdpSubgroup.get());
- if (pdpInstance.isPresent()) {
- processPdpDetails(message, pdpSubgroup, pdpInstance, pdpGroup);
- pdpInstanceFound = true;
+ final List<PdpGroup> pdpGroups = databaseProvider.getLatestPdpGroups(message.getPdpGroup());
+ if (!pdpGroups.isEmpty()) {
+ final PdpGroup pdpGroup = pdpGroups.get(0);
+ pdpSubgroup = findPdpSubGroup(message, pdpGroup);
+ if (pdpSubgroup.isPresent()) {
+ pdpInstance = findPdpInstance(message, pdpSubgroup.get());
+ if (pdpInstance.isPresent()) {
+ processPdpDetails(message, pdpSubgroup, pdpInstance, pdpGroup);
+ pdpInstanceFound = true;
+ }
}
}
if (!pdpInstanceFound) {