X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fcontroller%2FDashboardController.java;h=56ff637e91715bca0ec48410a153af4f55d896e8;hb=d9007d680d19734d5dc106479784c420236cca4b;hp=707a65d6210f9268fb1fcdbf36c411c3524cd915;hpb=6a5e800771311208c66ad79ce1bdf76affd144b2;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java index 707a65d62..56ff637e9 100644 --- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java +++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java @@ -86,7 +86,18 @@ public class DashboardController extends RestrictedBaseController{ private ArrayList papStatusData; private ArrayList policyActivityData; + private PolicyController policyController; + public PolicyController getPolicyController() { + return policyController; + } + public void setPolicyController(PolicyController policyController) { + this.policyController = policyController; + } + + private PolicyController getPolicyControllerInstance(){ + return policyController != null ? getPolicyController() : new PolicyController(); + } @RequestMapping(value={"/get_DashboardLoggingData"}, method={org.springframework.web.bind.annotation.RequestMethod.GET} , produces=MediaType.APPLICATION_JSON_VALUE) public void getData(HttpServletRequest request, HttpServletResponse response){ @@ -141,7 +152,8 @@ public class DashboardController extends RestrictedBaseController{ Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - this.pdpConatiner = new PDPGroupContainer(PolicyController.getPapEngine()); + PolicyController controller = getPolicyControllerInstance(); + this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine()); addPDPToTable(); model.put("pdpTableDatas", mapper.writeValueAsString(pdpStatusData)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -159,7 +171,8 @@ public class DashboardController extends RestrictedBaseController{ Map model = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); - this.pdpConatiner = new PDPGroupContainer(PolicyController.getPapEngine()); + PolicyController controller = getPolicyControllerInstance(); + this.pdpConatiner = new PDPGroupContainer(controller.getPapEngine()); addPolicyToTable(); model.put("policyActivityTableDatas", mapper.writeValueAsString(policyActivityData)); JsonMessage msg = new JsonMessage(mapper.writeValueAsString(model)); @@ -178,7 +191,8 @@ public class DashboardController extends RestrictedBaseController{ papStatusData = new ArrayList<>(); String papStatus = null; try { - Set groups = PolicyController.getPapEngine().getEcompPDPGroups(); + PolicyController controller = getPolicyControllerInstance(); + Set groups = controller.getPapEngine().getEcompPDPGroups(); if (groups == null) { papStatus = "UNKNOWN"; throw new PAPException("PAP not running");