From dca34e7fb338d79bec6152ead869904a5e61225a Mon Sep 17 00:00:00 2001 From: GPrathap Date: Thu, 24 Nov 2016 18:46:16 +0530 Subject: [PATCH] added cron expression --- .../pom.xml | 2 +- .../AndroidActivityScript.xml | 4 +++- .../AndroidAudioScript.xml | 4 +++- .../android_call_script/AndriodCallScript.xml | 4 +++- ...so2.iot.android.call.stats.ui.publisher.xml | 2 ++ .../android_data_script/AndriodDataScript.xml | 4 +++- .../AndriodFrequentContactsScript.xml | 4 +++- .../android_location_script/LocationScript.xml | 4 +++- .../js/core/batch-provider-api.js | 1 - .../js/core/gadget-core.js | 18 ++++++++---------- .../AndriodScreenScript.xml | 4 +++- .../Android_Sense_Script.xml | 5 +++-- 12 files changed, 35 insertions(+), 21 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 54cff03dc..d9a77d577 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -27,7 +27,7 @@ 4.0.0 org.wso2.carbon.device.mgt.iot.androidsense.analytics - WSO2 Carbon - IoT Server Android Sense Analytics capp + WSO2 Carbon - IoT Server Android Sense Analytics Carbon App pom diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml index a8e82e1f1..b20721054 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_activity_script/AndroidActivityScript.xml @@ -26,5 +26,7 @@ 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; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_ACTIVITY_STATS; + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_ACTIVITY_STATS; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml index 6f1038493..aa90f5fd9 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_audio_script/AndroidAudioScript.xml @@ -15,5 +15,7 @@ FROM AndroidHeadsetData GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS; + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndriodCallScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndriodCallScript.xml index 7f26e785b..7503381b0 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndriodCallScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_script/AndriodCallScript.xml @@ -15,5 +15,7 @@ FROM AndroidCallData GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_CALL_STATS; + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_CALL_STATS; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_ui_event_publisher/org.wso2.iot.android.call.stats.ui.publisher.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_ui_event_publisher/org.wso2.iot.android.call.stats.ui.publisher.xml index 6237873a4..6a64193c8 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_ui_event_publisher/org.wso2.iot.android.call.stats.ui.publisher.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_call_stats_ui_event_publisher/org.wso2.iot.android.call.stats.ui.publisher.xml @@ -5,3 +5,5 @@ + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndriodDataScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndriodDataScript.xml index 5d7e35e17..181eb2f8d 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndriodDataScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_data_script/AndriodDataScript.xml @@ -15,5 +15,7 @@ FROM AndroidDataData GROUP BY year, month, day, meta_deviceId, meta_owner, type ORDER BY timestamp DESC; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_DATA_STATS; + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_DATA_STATS; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndriodFrequentContactsScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndriodFrequentContactsScript.xml index 91976371d..9cab7c60b 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndriodFrequentContactsScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_frequentcontacts_script/AndriodFrequentContactsScript.xml @@ -49,5 +49,7 @@ SELECT owner, deviceId, number, sum(callCount) as callCount, sum(smsCount) as smsCount, sum(total) as total, year FROM Android_Frequent_Contacts_Per_Month GROUP BY deviceId, owner, number, year - ORDER BY total DESC; + ORDER BY total DESC; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml index cc86a06a0..12ae3132e 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_location_script/LocationScript.xml @@ -39,5 +39,7 @@ INSERT INTO TABLE Android_Location_Stats_Per_Year SELECT owner, deviceId, latitude, longitude, streetName, sum(noOfVisits) as noOfVisits, year FROM Android_Location_Stats_Per_Month - GROUP BY deviceId, owner, year, streetName, latitude, longitude; + GROUP BY deviceId, owner, year, streetName, latitude, longitude; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/batch-provider-api.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/batch-provider-api.js index d726b7d51..30c96902a 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/batch-provider-api.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/batch-provider-api.js @@ -178,7 +178,6 @@ var getConfig, validate, getMode, getSchema, getData, registerCallBackforPush; result = connector.getRecordsByRange(loggedInUser, tableName, from, to, 0, limit, null).getMessage(); } - log.info(result); result = JSON.parse(result); var data = []; for (var i = 0; i < result.length; i++) { diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/gadget-core.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/gadget-core.js index 580aa797f..893d71637 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/gadget-core.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_on_chart_gadget/Android_Screen_On_Chart/js/core/gadget-core.js @@ -60,19 +60,20 @@ $(function() { contentType: "application/json", async: false, success: function(data) { - var duration = data[0].duration / 60000; // Convert to minutes - var newData = [{ + 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 newData = [{ "duration": duration, "owner": "YES" }, { "duration": (1440 - duration), "owner": "NO" } - ]; - // data.forEach(function(entry) { - // entry.duration = entry.duration / 60000 % 100; // Convert to minutes - // }); - // providerData = data; + ]; + } providerData = newData; } }); @@ -81,18 +82,15 @@ $(function() { var drawGadget = function() { - draw('#canvas', conf[CHART_CONF], schema, providerData); setInterval(function() { draw('#canvas', conf[CHART_CONF], schema, getProviderData()); }, pref.getInt(REFRESH_INTERVAL)); - }; getGadgetLocation(function(gadget_Location) { gadgetLocation = gadget_Location; init(); drawGadget(); - }); }); \ No newline at end of file diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndriodScreenScript.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndriodScreenScript.xml index 0d7e59ac4..f6b0e4fb7 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndriodScreenScript.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_screen_script/AndriodScreenScript.xml @@ -15,5 +15,7 @@ FROM AndroidScreenData GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_SCREEN_STATS; + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_SCREEN_STATS; + + 0 0/5 * * * ? diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_script/Android_Sense_Script.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_script/Android_Sense_Script.xml index 2b903946c..80ed0fcde 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_script/Android_Sense_Script.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/src/main/resources/carbonapps/androidsense/android_sense_script/Android_Sense_Script.xml @@ -15,6 +15,7 @@ FROM AndroidHeadsetData GROUP BY year, month, day, meta_deviceId, meta_owner ORDER BY timestamp DESC; - INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS; - + INCREMENTAL_TABLE_COMMIT ORG_WSO2_IOT_ANDROID_HEADSET_STATS; + + 0 0/5 * * * ?