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 54cff03dc6..d9a77d577b 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 a8e82e1f17..b20721054a 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 6f1038493c..aa90f5fd96 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 7f26e785bd..7503381b01 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 6237873a42..6a64193c8c 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 5d7e35e176..181eb2f8d2 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 91976371d0..9cab7c60ba 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 cc86a06a03..12ae3132ea 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 d726b7d51c..30c96902a5 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 580aa797fa..893d71637b 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 0d7e59ac4c..f6b0e4fb7c 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 2b903946cc..80ed0fcde8 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 * * * ?