From 6098f2eaa86077e7107c085e19b199217fd6e2ca Mon Sep 17 00:00:00 2001 From: Supun94 Date: Thu, 15 Jun 2017 13:16:05 +0530 Subject: [PATCH] Changing Topics search --- .../admin/MQTTManagementAdminServiceImpl.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java index 926e182dd..5e3166d34 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/src/main/java/org/wso2/carbon/andes/extensions/device/mgt/jaxrs/service/impl/admin/MQTTManagementAdminServiceImpl.java @@ -146,7 +146,7 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic @Override @GET public Response getFilteredSubscriptions( - @QueryParam("topic_name") String topic_name, + @QueryParam("name") String topic_name, @QueryParam("remaining_messages") int remaining_messages, @QueryParam("active") String active, @QueryParam("durable") String durable, @@ -208,7 +208,7 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic // 10,currentTenantId,tenantDomain); Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, - "MQTT", "TOPIC", "", false, + "MQTT", "TOPIC", topic_name, false, "", false, "All", offset, 10); Map subscriptions = new HashMap<>(); @@ -261,8 +261,8 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic topics.setCount(result.getRecordsTotal()); - - return Response.ok().entity(subscriptions).build(); + return Response.status(Response.Status.OK).entity(subscriptions).build(); +// return Response.ok().entity(subscriptions).build(); } catch (DeviceManagementException e) { String msg = "Error occurred at server side while fetching device list."; log.error(msg, e); @@ -328,21 +328,19 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic private PaginationResult getPaginatedTopics(TopicPaginationRequest request,Map subscriptions) throws DeviceManagementException { - List devicesForRoles = null; PaginationResult paginationResult = new PaginationResult(); List allSubscriptions = new ArrayList<>(); - List sub = new ArrayList<>(); Map ss = subscriptions; int count = 0; int tenantId = this.getTenantId(); request = TopicManagerUtil.validateTopicListPageSize(request); - List subscriptionList = new ArrayList(subscriptions.values()); + List subscriptionList = new ArrayList<>(subscriptions.values()); - allSubscriptions = Arrays.asList(subscriptionList.get(0)); - count = allSubscriptions.size(); +// allSubscriptions = Arrays.asList(subscriptionList.size()); + count = subscriptionList.size(); - paginationResult.setData(allSubscriptions); +// paginationResult.setData(allSubscriptions); paginationResult.setRecordsFiltered(count); paginationResult.setRecordsTotal(count); return paginationResult;