Changing Topics search

merge-requests/1/head
Supun94 8 years ago
parent c2f0de2cee
commit 6098f2eaa8

@ -146,7 +146,7 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic
@Override @Override
@GET @GET
public Response getFilteredSubscriptions( public Response getFilteredSubscriptions(
@QueryParam("topic_name") String topic_name, @QueryParam("name") String topic_name,
@QueryParam("remaining_messages") int remaining_messages, @QueryParam("remaining_messages") int remaining_messages,
@QueryParam("active") String active, @QueryParam("active") String active,
@QueryParam("durable") String durable, @QueryParam("durable") String durable,
@ -208,7 +208,7 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic
// 10,currentTenantId,tenantDomain); // 10,currentTenantId,tenantDomain);
Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true, Subscription[] filteredNormalTopicSubscriptionList = andesAdminStub.getFilteredSubscriptions(false, true,
"MQTT", "TOPIC", "", false, "MQTT", "TOPIC", topic_name, false,
"", false, "All", offset, "", false, "All", offset,
10); 10);
Map<String, Subscription[]> subscriptions = new HashMap<>(); Map<String, Subscription[]> subscriptions = new HashMap<>();
@ -261,8 +261,8 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic
topics.setCount(result.getRecordsTotal()); topics.setCount(result.getRecordsTotal());
return Response.status(Response.Status.OK).entity(subscriptions).build();
return Response.ok().entity(subscriptions).build(); // return Response.ok().entity(subscriptions).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String msg = "Error occurred at server side while fetching device list."; String msg = "Error occurred at server side while fetching device list.";
log.error(msg, e); log.error(msg, e);
@ -328,21 +328,19 @@ public class MQTTManagementAdminServiceImpl implements MQTTManagementAdminServic
private PaginationResult getPaginatedTopics(TopicPaginationRequest request,Map<String, Subscription[]> subscriptions) throws DeviceManagementException { private PaginationResult getPaginatedTopics(TopicPaginationRequest request,Map<String, Subscription[]> subscriptions) throws DeviceManagementException {
List<Subscription> devicesForRoles = null;
PaginationResult paginationResult = new PaginationResult(); PaginationResult paginationResult = new PaginationResult();
List<Subscription> allSubscriptions = new ArrayList<>(); List<Subscription> allSubscriptions = new ArrayList<>();
List<Subscription> sub = new ArrayList<>();
Map<String,Subscription[]> ss = subscriptions; Map<String,Subscription[]> ss = subscriptions;
int count = 0; int count = 0;
int tenantId = this.getTenantId(); int tenantId = this.getTenantId();
request = TopicManagerUtil.validateTopicListPageSize(request); request = TopicManagerUtil.validateTopicListPageSize(request);
List<Subscription[]> subscriptionList = new ArrayList<Subscription[]>(subscriptions.values()); List<Subscription[]> subscriptionList = new ArrayList<>(subscriptions.values());
allSubscriptions = Arrays.asList(subscriptionList.get(0)); // allSubscriptions = Arrays.asList(subscriptionList.size());
count = allSubscriptions.size(); count = subscriptionList.size();
paginationResult.setData(allSubscriptions); // paginationResult.setData(allSubscriptions);
paginationResult.setRecordsFiltered(count); paginationResult.setRecordsFiltered(count);
paginationResult.setRecordsTotal(count); paginationResult.setRecordsTotal(count);
return paginationResult; return paginationResult;

Loading…
Cancel
Save