diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js index e44cd63890..78d026bf1a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js @@ -21,7 +21,22 @@ batchProviders = function () { var JS_MAX_VALUE = "9007199254740992"; var JS_MIN_VALUE = "-9007199254740992"; - var tableName = "ORG_WSO2_GEO_FUSEDSPATIALEVENT"; + var TABLENAME_ANDROID = "ORG_WSO2_GEO_FUSEDSPATIALEVENT"; + var TABLENAME_ANDROID_SENSE = "ORG_WSO2_IOT_ANDROID_LOCATION"; + + var tableName = function (deviceType) { + switch (deviceType) { + case "android" : + return TABLENAME_ANDROID; + break; + case "android_sense" : + return TABLENAME_ANDROID_SENSE; + break; + default: + return null; + + } + }; var typeMap = { "bool": "string", @@ -59,8 +74,12 @@ batchProviders = function () { * @param providerConfig */ operations.getSchema = function (loggedInUser) { + var tablename = tableName(deviceType); + if (tablename == null) { + return []; + } var schema = []; - var result = connector.getTableSchema(loggedInUser, tableName).getMessage(); + var result = connector.getTableSchema(loggedInUser, tablename).getMessage(); result = JSON.parse(result); var columns = result.columns; @@ -87,6 +106,10 @@ batchProviders = function () { var luceneQuery = ""; var limit = 100; var result; + var tablename = tableName(deviceType); + if (tablename == null) { + return []; + } //if there's a filter present, we should perform a Lucene search instead of reading the table if (luceneQuery) { luceneQuery = 'id:"' + deviceId + '" AND type:"' + deviceType + '"'; @@ -95,11 +118,11 @@ batchProviders = function () { "start": 0, "count": limit }; - result = connector.search(loggedInUser, tableName, stringify(filter)).getMessage(); + result = connector.search(loggedInUser, tablename, stringify(filter)).getMessage(); } else { var from = JS_MIN_VALUE; var to = JS_MAX_VALUE; - result = connector.getRecordsByRange(loggedInUser, tableName, from, to, 0, limit, null).getMessage(); + result = connector.getRecordsByRange(loggedInUser, tablename, from, to, 0, limit, null).getMessage(); } result = JSON.parse(result); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 3f0b5365ce..6d70599360 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -69,7 +69,18 @@ deviceModule = function () { throw constants["ERRORS"]["USER_NOT_FOUND"]; } var userName = carbonUser.username + "@" + carbonUser.domain; - var locationDataSet = batchProvider.getData(userName, deviceId, deviceType); + + var locationDataSet = []; + switch(deviceType) { + case 'android': + locationDataSet = batchProvider.getData(userName, deviceId, deviceType); + break; + case 'android_sense': + locationDataSet = batchProvider.getData(userName, deviceId, deviceType); + break; + + } + var locationData = []; var locationTimeData = [];