added cron expression

revert-dabc3590
GPrathap 8 years ago
parent dd86f91de6
commit dca34e7fb3

@ -27,7 +27,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics</artifactId> <artifactId>org.wso2.carbon.device.mgt.iot.androidsense.analytics</artifactId>
<name>WSO2 Carbon - IoT Server Android Sense Analytics capp</name> <name>WSO2 Carbon - IoT Server Android Sense Analytics Carbon App</name>
<packaging>pom</packaging> <packaging>pom</packaging>
<build> <build>

@ -26,5 +26,7 @@
FROM AndroidActivityData WHERE action = 'RUNNING' OR action = 'WALKING' OR action = 'CYCLING' FROM AndroidActivityData WHERE action = 'RUNNING' OR action = 'WALKING' OR action = 'CYCLING'
GROUP BY year, month, day, meta_deviceId, action, meta_owner ORDER BY timestamp ASC; GROUP BY year, month, day, meta_deviceId, action, meta_owner ORDER BY timestamp ASC;
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_ACTIVITY_STATS; </Script> INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_ACTIVITY_STATS;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -15,5 +15,7 @@
FROM AndroidHeadsetData FROM AndroidHeadsetData
GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC; GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC;
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS; </Script> INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -15,5 +15,7 @@
FROM AndroidCallData FROM AndroidCallData
GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC; GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC;
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_CALL_STATS; </Script> INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_CALL_STATS;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -5,3 +5,5 @@
<mapping customMapping="disable" type="wso2event"/> <mapping customMapping="disable" type="wso2event"/>
<to eventAdapterType="ui"/> <to eventAdapterType="ui"/>
</eventPublisher> </eventPublisher>

@ -15,5 +15,7 @@
FROM AndroidDataData FROM AndroidDataData
GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC; GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC;
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_DATA_STATS; </Script> INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_DATA_STATS;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -49,5 +49,7 @@
SELECT owner, deviceId, number, sum(callCount) as callCount, sum(smsCount) as smsCount, sum(total) as total, year SELECT owner, deviceId, number, sum(callCount) as callCount, sum(smsCount) as smsCount, sum(total) as total, year
FROM Android_Frequent_Contacts_Per_Month FROM Android_Frequent_Contacts_Per_Month
GROUP BY deviceId, owner, number, year GROUP BY deviceId, owner, number, year
ORDER BY total DESC; </Script> ORDER BY total DESC;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -39,5 +39,7 @@
INSERT INTO TABLE Android_Location_Stats_Per_Year INSERT INTO TABLE Android_Location_Stats_Per_Year
SELECT owner, deviceId, latitude, longitude, streetName, sum(noOfVisits) as noOfVisits, year SELECT owner, deviceId, latitude, longitude, streetName, sum(noOfVisits) as noOfVisits, year
FROM Android_Location_Stats_Per_Month FROM Android_Location_Stats_Per_Month
GROUP BY deviceId, owner, year, streetName, latitude, longitude; </Script> GROUP BY deviceId, owner, year, streetName, latitude, longitude;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -178,7 +178,6 @@ var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush;
result = connector.getRecordsByRange(loggedInUser, tableName, from, to, 0, limit, null).getMessage(); result = connector.getRecordsByRange(loggedInUser, tableName, from, to, 0, limit, null).getMessage();
} }
log.info(result);
result = JSON.parse(result); result = JSON.parse(result);
var data = []; var data = [];
for (var i = 0; i < result.length; i++) { for (var i = 0; i < result.length; i++) {

@ -60,6 +60,10 @@ $(function() {
contentType: "application/json", contentType: "application/json",
async: false, async: false,
success: function(data) { success: function(data) {
if(typeof data[0].duration == 'undefined'){
console.log("Currently data can't be retrieved...");
console.log(JSON.stringify(data));
}else{
var duration = data[0].duration / 60000; // Convert to minutes var duration = data[0].duration / 60000; // Convert to minutes
var newData = [{ var newData = [{
"duration": duration, "duration": duration,
@ -69,10 +73,7 @@ $(function() {
"owner": "NO" "owner": "NO"
} }
]; ];
// data.forEach(function(entry) { }
// entry.duration = entry.duration / 60000 % 100; // Convert to minutes
// });
// providerData = data;
providerData = newData; providerData = newData;
} }
}); });
@ -81,18 +82,15 @@ $(function() {
var drawGadget = function() { var drawGadget = function() {
draw('#canvas', conf[CHART_CONF], schema, providerData); draw('#canvas', conf[CHART_CONF], schema, providerData);
setInterval(function() { setInterval(function() {
draw('#canvas', conf[CHART_CONF], schema, getProviderData()); draw('#canvas', conf[CHART_CONF], schema, getProviderData());
}, pref.getInt(REFRESH_INTERVAL)); }, pref.getInt(REFRESH_INTERVAL));
}; };
getGadgetLocation(function(gadget_Location) { getGadgetLocation(function(gadget_Location) {
gadgetLocation = gadget_Location; gadgetLocation = gadget_Location;
init(); init();
drawGadget(); drawGadget();
}); });
}); });

@ -15,5 +15,7 @@
FROM AndroidScreenData FROM AndroidScreenData
GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC; GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC;
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_SCREEN_STATS; </Script> INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_SCREEN_STATS;
</Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

@ -17,4 +17,5 @@
INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS; INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS;
</Script> </Script>
<CronExpression>0 0/5 * * * ?</CronExpression>
</Analytics> </Analytics>

Loading…
Cancel
Save