From 8cd116bf2295fda6adbc41f87ae4d94fac572fb6 Mon Sep 17 00:00:00 2001 From: "sunil.unnava" Date: Wed, 20 Mar 2019 01:23:48 -0400 Subject: update MM agent API Issue-ID: DMAAP-909 Change-Id: I07bbf3e2c7db7f5610511a8e8c8c3db37a74549c Signed-off-by: sunil.unnava --- .../java/org/onap/dmaap/service/MMRestService.java | 42 ++++++---------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/dmaap/service/MMRestService.java b/src/main/java/org/onap/dmaap/service/MMRestService.java index e271dce..4a2c908 100644 --- a/src/main/java/org/onap/dmaap/service/MMRestService.java +++ b/src/main/java/org/onap/dmaap/service/MMRestService.java @@ -1362,47 +1362,27 @@ public class MMRestService { } } - private String getWhitelistByNamespace(String originalWhitelist, String namespace) { - String whitelist = null; - List resultList = new ArrayList<>(); - List whitelistList = new ArrayList<>(); - whitelistList = Arrays.asList(originalWhitelist.split(",")); - - for (String topic : whitelistList) { - if (StringUtils.isNotBlank(originalWhitelist) && getNamespace(topic).equals(namespace)) { - resultList.add(topic); - } - } - if (!resultList.isEmpty()) { - whitelist = StringUtils.join(resultList, ","); - } - - return whitelist; - } - - private JSONArray getListMirrorMaker(String msgFrmSubscribe, String randomStr) { - JSONObject jsonObj; - JSONArray jsonArray; + public JSONArray getListMirrorMaker(String msgFrmSubscribe, String randomStr) { + JSONObject jsonObj = new JSONObject(); + JSONArray jsonArray = new JSONArray(); JSONArray listMirrorMaker = new JSONArray(); - + msgFrmSubscribe = removeExtraChar(msgFrmSubscribe); jsonArray = new JSONArray(msgFrmSubscribe); - + jsonObj = jsonArray.getJSONObject(0); + for (int i = 0; i < jsonArray.length(); i++) { jsonObj = jsonArray.getJSONObject(i); - - JSONObject obj = new JSONObject(); - if (jsonObj.has(MESSAGE)) { - obj = jsonObj.getJSONObject(MESSAGE); - } - if (obj.has("messageID") && obj.get("messageID").equals(randomStr) && obj.has(LISTMIRRORMAKER)) { - listMirrorMaker = obj.getJSONArray(LISTMIRRORMAKER); + + if (jsonObj.has("messageID") && jsonObj.get("messageID").equals(randomStr) && jsonObj.has("listMirrorMaker")) { + listMirrorMaker = jsonObj.getJSONArray("listMirrorMaker"); break; } } - return listMirrorMaker; + return listMirrorMaker; } + public JSONObject validateMMExists(DMaaPContext ctx, String name) throws Exception { // Create a listAllMirrorMaker Json object -- cgit 1.2.3-korg