update MM agent API 56/82756/1
authorsunil.unnava <su622b@att.com>
Wed, 20 Mar 2019 05:23:48 +0000 (01:23 -0400)
committersunil.unnava <su622b@att.com>
Wed, 20 Mar 2019 05:24:30 +0000 (01:24 -0400)
Issue-ID: DMAAP-909
Change-Id: I07bbf3e2c7db7f5610511a8e8c8c3db37a74549c
Signed-off-by: sunil.unnava <su622b@att.com>
src/main/java/org/onap/dmaap/service/MMRestService.java

index e271dce..4a2c908 100644 (file)
@@ -1362,47 +1362,27 @@ public class MMRestService {
                }
        }
 
-       private String getWhitelistByNamespace(String originalWhitelist, String namespace) {
 
-               String whitelist = null;
-               List<String> resultList = new ArrayList<>();
-               List<String> 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