From 032b9a524cbc20a9846ef90fd1ce3eb0cafbea65 Mon Sep 17 00:00:00 2001 From: lasantha Date: Thu, 22 Jun 2017 12:00:04 +0530 Subject: [PATCH] Adding a maximum event count --- .../device/mgt/iot/androidsense/service/impl/util/APIUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java index b057705f0..82d6737df 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/util/APIUtil.java @@ -35,6 +35,7 @@ import java.util.Map; public class APIUtil { private static Log log = LogFactory.getLog(APIUtil.class); + private static int maxEventCount = 100; public static String getAuthenticatedUser() { PrivilegedCarbonContext threadLocalCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); @@ -82,6 +83,8 @@ public class APIUtil { int eventCount = analyticsDataAPI.searchCount(tenantId, tableName, query); if (eventCount == 0) { return null; + }else if(eventCount>maxEventCount){ + eventCount=maxEventCount; } List resultEntries = analyticsDataAPI.search(tenantId, tableName, query, 0, eventCount, sortByFields);