mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request #560 from Kamidu/release-2.0.x
Enable location histry for android sense
This commit is contained in:
commit
8f377376ab
@ -21,7 +21,22 @@ batchProviders = function () {
|
|||||||
var JS_MAX_VALUE = "9007199254740992";
|
var JS_MAX_VALUE = "9007199254740992";
|
||||||
var JS_MIN_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 = {
|
var typeMap = {
|
||||||
"bool": "string",
|
"bool": "string",
|
||||||
@ -59,8 +74,12 @@ batchProviders = function () {
|
|||||||
* @param providerConfig
|
* @param providerConfig
|
||||||
*/
|
*/
|
||||||
operations.getSchema = function (loggedInUser) {
|
operations.getSchema = function (loggedInUser) {
|
||||||
|
var tablename = tableName(deviceType);
|
||||||
|
if (tablename == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
var schema = [];
|
var schema = [];
|
||||||
var result = connector.getTableSchema(loggedInUser, tableName).getMessage();
|
var result = connector.getTableSchema(loggedInUser, tablename).getMessage();
|
||||||
result = JSON.parse(result);
|
result = JSON.parse(result);
|
||||||
|
|
||||||
var columns = result.columns;
|
var columns = result.columns;
|
||||||
@ -87,6 +106,10 @@ batchProviders = function () {
|
|||||||
var luceneQuery = "";
|
var luceneQuery = "";
|
||||||
var limit = 100;
|
var limit = 100;
|
||||||
var result;
|
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 there's a filter present, we should perform a Lucene search instead of reading the table
|
||||||
if (luceneQuery) {
|
if (luceneQuery) {
|
||||||
luceneQuery = 'id:"' + deviceId + '" AND type:"' + deviceType + '"';
|
luceneQuery = 'id:"' + deviceId + '" AND type:"' + deviceType + '"';
|
||||||
@ -95,11 +118,11 @@ batchProviders = function () {
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"count": limit
|
"count": limit
|
||||||
};
|
};
|
||||||
result = connector.search(loggedInUser, tableName, stringify(filter)).getMessage();
|
result = connector.search(loggedInUser, tablename, stringify(filter)).getMessage();
|
||||||
} else {
|
} else {
|
||||||
var from = JS_MIN_VALUE;
|
var from = JS_MIN_VALUE;
|
||||||
var to = JS_MAX_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);
|
result = JSON.parse(result);
|
||||||
|
|||||||
@ -69,7 +69,18 @@ deviceModule = function () {
|
|||||||
throw constants["ERRORS"]["USER_NOT_FOUND"];
|
throw constants["ERRORS"]["USER_NOT_FOUND"];
|
||||||
}
|
}
|
||||||
var userName = carbonUser.username + "@" + carbonUser.domain;
|
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 locationData = [];
|
||||||
var locationTimeData = [];
|
var locationTimeData = [];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user