- JSONObject jsonObject = new JSONObject(formattedString);
- switch (dmaapRequestMessage.getOperation()) {
- case "getPolicySchemas":
- ricName = (String) jsonObject.get("ricName");
- logger.debug("Received the request for getPolicySchemas with Ric Name- {}", ricName);
- return getDmaapResponseMessage(dmaapRequestMessage, policyController.getPolicySchemas(ricName));
- case "getPolicySchema":
- String policyTypeId = (String) jsonObject.get("id");
- logger.debug("Received the request for getPolicySchema with Policy Type Id- {}", policyTypeId);
- return getDmaapResponseMessage(dmaapRequestMessage, policyController.getPolicySchema(policyTypeId));
- case "getPolicyTypes":
- ricName = (String) jsonObject.get("ricName");
- logger.debug("Received the request for getPolicyTypes with Ric Name- {}", ricName);
- return getDmaapResponseMessage(dmaapRequestMessage, policyController.getPolicyTypes(ricName));
- case "getPolicy":
- instance = (String) jsonObject.get("instance");
- logger.debug("Received the request for getPolicy with Instance- {}", instance);
- return getDmaapResponseMessage(dmaapRequestMessage, policyController.getPolicy(instance));
- case "deletePolicy":
- instance = (String) jsonObject.get("instance");
- logger.debug("Received the request for deletePolicy with Instance- {}", instance);
- return getDmaapResponseMessage(dmaapRequestMessage, policyController.deletePolicy(instance).block());
- case "putPolicy":
- String type = (String) jsonObject.get("type");
- String putPolicyInstance = (String) jsonObject.get("instance");
- String putPolicyRic = (String) jsonObject.get("ric");
- String service = (String) jsonObject.get("service");
- jsonBody = (String) jsonObject.get("jsonBody");
- return getDmaapResponseMessage(dmaapRequestMessage,
- policyController.putPolicy(type, putPolicyInstance, putPolicyRic, service, jsonBody).block());
- case "getPolicies":
- String getPolicyType = (String) jsonObject.get("type");
- instance = (String) jsonObject.get("instance");
- String getPolicyRic = (String) jsonObject.get("ric");
- String getPolicyService = (String) jsonObject.get("service");
- jsonBody = (String) jsonObject.get("jsonBody");
- return getDmaapResponseMessage(dmaapRequestMessage, policyController
- .putPolicy(getPolicyType, instance, getPolicyRic, getPolicyService, jsonBody).block());
- default:
- break;