From 99054e1e770edf6f0d34674b67ece961dd0ab3fb Mon Sep 17 00:00:00 2001 From: charitha Date: Fri, 3 Aug 2018 22:32:16 +0530 Subject: [PATCH] Prevent duplicate alerts & added owner field --- ...FusionGenerateNotifications-1.0.0.siddhiql | 26 ---------- .../artifact.xml | 21 -------- ...-ExecutionPlan-Pass_through-1.0.0.siddhiql | 8 ++-- ...er_device_stream_geo_FusedSpatialEvent.xml | 8 ++++ ...r_device_stream_geo_AlertNotifications.xml | 8 ++++ .../WSO2IoT-Geo-ExecutionPlan.siddhiql | 6 +-- .../main/resources/carbonapps/artifacts.xml | 2 - ...e.stream.geo.AlertNotifications-1.0.0.json | 4 ++ ...ce.stream.geo.FusedSpatialEvent-1.0.0.json | 4 ++ .../artifact.xml | 21 -------- ...wso2.geo.ProcessedSpatialEvents-1.0.0.json | 48 ------------------- ....wso2.geo.StandardSpatialEvents-1.0.0.json | 4 ++ .../org.wso2.iot.LocationStream-1.0.0.json | 4 ++ .../impl/EventReceiverServiceImpl.java | 6 ++- .../impl/EventReceiverServiceImpl.java | 6 ++- 15 files changed, 47 insertions(+), 129 deletions(-) delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/Geo-ExecutionPlan-EventsFusionGenerateNotifications-1.0.0.siddhiql delete mode 100755 components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/artifact.xml delete mode 100755 components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/artifact.xml delete mode 100644 components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/org.wso2.geo.ProcessedSpatialEvents-1.0.0.json diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/Geo-ExecutionPlan-EventsFusionGenerateNotifications-1.0.0.siddhiql b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/Geo-ExecutionPlan-EventsFusionGenerateNotifications-1.0.0.siddhiql deleted file mode 100644 index 36bbd52339..0000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/Geo-ExecutionPlan-EventsFusionGenerateNotifications-1.0.0.siddhiql +++ /dev/null @@ -1,26 +0,0 @@ -/* Enter a unique ExecutionPlan */ -@Plan:name('Geo-ExecutionPlan-EventsFusionGenerateNotifications') - -/* Enter a unique description for ExecutionPlan */ --- @Plan:description('ExecutionPlan') - -/* define streams/tables and write queries here ... */ - -@Plan:trace('false') - -@Import('org.wso2.geo.ProcessedSpatialEvents:1.0.0') -define stream dataIn (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string, state string, information string ); - -@Export('iot.per.device.stream.geo.AlertNotifications:1.0.0') -define stream alertsOut ( id string, state string, information string, timeStamp long, latitude double, longitude double, type string); - -@Export('iot.per.device.stream.geo.FusedSpatialEvent:1.0.0') -define stream dataOut ( id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, state string, information string, notify bool ); - -from dataIn -select id, latitude, longitude, timeStamp, type, speed, heading, state , information, (str:strcmp("ALERTED", state) == 0) as notify -insert into dataOut; - -from dataOut[notify == true] -select id, state, information,timeStamp, latitude, longitude, type -insert into alertsOut; \ No newline at end of file diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/artifact.xml deleted file mode 100755 index e7cb8f858b..0000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-EventsFusionGenerateNotifications_1.0.0/artifact.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Geo-ExecutionPlan-EventsFusionGenerateNotifications-1.0.0.siddhiql - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-Pass_through_1.0.0/Geo-ExecutionPlan-Pass_through-1.0.0.siddhiql b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-Pass_through_1.0.0/Geo-ExecutionPlan-Pass_through-1.0.0.siddhiql index aec39ac5c3..11e3894bc5 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-Pass_through_1.0.0/Geo-ExecutionPlan-Pass_through-1.0.0.siddhiql +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/Geo-ExecutionPlan-Pass_through_1.0.0/Geo-ExecutionPlan-Pass_through-1.0.0.siddhiql @@ -7,11 +7,11 @@ /* define streams/tables and write queries here ... */ @Import('org.wso2.geo.StandardSpatialEvents:1.0.0') -define stream dataIn (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string); +define stream dataIn (id string, owner string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string); -@Export('org.wso2.geo.ProcessedSpatialEvents:1.0.0') -define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string, state string, information string); +@Export('iot.per.device.stream.geo.FusedSpatialEvent:1.0.0') +define stream dataOut (id string, owner string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, state string, information string, notify bool); from dataIn -select id , latitude, longitude,timeStamp, type ,speed, heading ,eventId , "NORMAL" as state, "Normal driving pattern" as information +select id, owner, latitude, longitude,timeStamp, type ,speed, heading, "NORMAL" as state, "Normal driving pattern" as information, false as notify insert into dataOut; \ No newline at end of file diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-EventSink-FusedStream_1.0.0/iot_per_device_stream_geo_FusedSpatialEvent.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-EventSink-FusedStream_1.0.0/iot_per_device_stream_geo_FusedSpatialEvent.xml index 23c3589b85..f14873f991 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-EventSink-FusedStream_1.0.0/iot_per_device_stream_geo_FusedSpatialEvent.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-EventSink-FusedStream_1.0.0/iot_per_device_stream_geo_FusedSpatialEvent.xml @@ -9,6 +9,14 @@ false STRING + + owner + false + true + false + false + STRING + latitude false diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-AlertNotifications_1.0.0/iot_per_device_stream_geo_AlertNotifications.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-AlertNotifications_1.0.0/iot_per_device_stream_geo_AlertNotifications.xml index ca3f795e1e..04b2703a3c 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-AlertNotifications_1.0.0/iot_per_device_stream_geo_AlertNotifications.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-AlertNotifications_1.0.0/iot_per_device_stream_geo_AlertNotifications.xml @@ -9,6 +9,14 @@ false STRING + + owner + false + true + false + false + STRING + state false diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-ExecutionPlan_1.0.0/WSO2IoT-Geo-ExecutionPlan.siddhiql b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-ExecutionPlan_1.0.0/WSO2IoT-Geo-ExecutionPlan.siddhiql index 1bfd0de600..e8418fe499 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-ExecutionPlan_1.0.0/WSO2IoT-Geo-ExecutionPlan.siddhiql +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/WSO2IoT-Geo-ExecutionPlan_1.0.0/WSO2IoT-Geo-ExecutionPlan.siddhiql @@ -9,13 +9,13 @@ @Plan:trace('false') @Import('org.wso2.iot.LocationStream:1.0.0') -define stream dataIn (meta_deviceId string, meta_deviceType string, timeStamp long, latitude double, longitude double); +define stream dataIn (meta_deviceId string, meta_owner string, meta_deviceType string, timeStamp long, latitude double, longitude double); @Export('org.wso2.geo.StandardSpatialEvents:1.0.0') -define stream dataOut (id string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string); +define stream dataOut (id string, owner string, latitude double, longitude double, timeStamp long, type string, speed float, heading float, eventId string); from every fs1=dataIn -> fs2=dataIn[fs2.timeStamp > fs1.timeStamp and fs1.meta_deviceId == fs2.meta_deviceId] -select fs1.meta_deviceId as id, fs2.latitude, fs2.longitude, fs2.timeStamp, fs1.meta_deviceType as type, +select fs1.meta_deviceId as id, fs1.meta_owner as owner, fs2.latitude, fs2.longitude, fs2.timeStamp, fs1.meta_deviceType as type, convert(geo:distance(fs2.latitude, fs2.longitude, fs1.latitude, fs1.longitude) * 3600/(fs2.timeStamp - fs1.timeStamp), 'float') as speed, 0.0f as heading, UUID() as eventId group by fs1.meta_deviceId diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml index f0fdfa0660..9c2354b2fb 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/artifacts.xml @@ -22,7 +22,6 @@ - @@ -31,7 +30,6 @@ - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.AlertNotifications_1.0.0/iot.per.device.stream.geo.AlertNotifications-1.0.0.json b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.AlertNotifications_1.0.0/iot.per.device.stream.geo.AlertNotifications-1.0.0.json index b19d158ab1..a10ec10efa 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.AlertNotifications_1.0.0/iot.per.device.stream.geo.AlertNotifications-1.0.0.json +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.AlertNotifications_1.0.0/iot.per.device.stream.geo.AlertNotifications-1.0.0.json @@ -8,6 +8,10 @@ "name": "id", "type": "STRING" }, + { + "name": "owner", + "type": "STRING" + }, { "name": "state", "type": "STRING" diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.FusedSpatialEvent_1.0.0/iot.per.device.stream.geo.FusedSpatialEvent-1.0.0.json b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.FusedSpatialEvent_1.0.0/iot.per.device.stream.geo.FusedSpatialEvent-1.0.0.json index e8b866a34f..e9f4601d61 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.FusedSpatialEvent_1.0.0/iot.per.device.stream.geo.FusedSpatialEvent-1.0.0.json +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/iot.per.device.stream.geo.FusedSpatialEvent_1.0.0/iot.per.device.stream.geo.FusedSpatialEvent-1.0.0.json @@ -8,6 +8,10 @@ "name": "id", "type": "STRING" }, + { + "name": "owner", + "type": "STRING" + }, { "name": "latitude", "type": "DOUBLE" diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/artifact.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/artifact.xml deleted file mode 100755 index a87870c317..0000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/artifact.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - org.wso2.geo.ProcessedSpatialEvents-1.0.0.json - diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/org.wso2.geo.ProcessedSpatialEvents-1.0.0.json b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/org.wso2.geo.ProcessedSpatialEvents-1.0.0.json deleted file mode 100644 index 08adb68582..0000000000 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.ProcessedSpatialEvents_1.0.0/org.wso2.geo.ProcessedSpatialEvents-1.0.0.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "org.wso2.geo.ProcessedSpatialEvents", - "version": "1.0.0", - "nickName": "", - "description": "", - "payloadData": [ - { - "name": "id", - "type": "STRING" - }, - { - "name": "latitude", - "type": "DOUBLE" - }, - { - "name": "longitude", - "type": "DOUBLE" - }, - { - "name": "timeStamp", - "type": "LONG" - }, - { - "name": "type", - "type": "STRING" - }, - { - "name": "speed", - "type": "FLOAT" - }, - { - "name": "heading", - "type": "FLOAT" - }, - { - "name": "eventId", - "type": "STRING" - }, - { - "name": "state", - "type": "STRING" - }, - { - "name": "information", - "type": "STRING" - } - ] -} \ No newline at end of file diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.StandardSpatialEvents_1.0.0/org.wso2.geo.StandardSpatialEvents-1.0.0.json b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.StandardSpatialEvents_1.0.0/org.wso2.geo.StandardSpatialEvents-1.0.0.json index 74a5670b9f..3ffbef8e7f 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.StandardSpatialEvents_1.0.0/org.wso2.geo.StandardSpatialEvents-1.0.0.json +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.geo.StandardSpatialEvents_1.0.0/org.wso2.geo.StandardSpatialEvents-1.0.0.json @@ -8,6 +8,10 @@ "name": "id", "type": "STRING" }, + { + "name": "owner", + "type": "STRING" + }, { "name": "latitude", "type": "DOUBLE" diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.iot.LocationStream_1.0.0/org.wso2.iot.LocationStream-1.0.0.json b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.iot.LocationStream_1.0.0/org.wso2.iot.LocationStream-1.0.0.json index d275099901..4211e7902c 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.iot.LocationStream_1.0.0/org.wso2.iot.LocationStream-1.0.0.json +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/src/main/resources/carbonapps/org.wso2.iot.LocationStream_1.0.0/org.wso2.iot.LocationStream-1.0.0.json @@ -8,6 +8,10 @@ "name": "deviceId", "type": "STRING" }, + { + "name": "owner", + "type": "STRING" + }, { "name": "deviceType", "type": "STRING" diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java index c5e0c36ab8..f42a9a8d23 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java @@ -69,13 +69,14 @@ public class EventReceiverServiceImpl implements EventReceiverService { if (log.isDebugEnabled()) { log.debug("Invoking Android device event logging."); } + Device device; try { if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { return Response.status(Response.Status.ACCEPTED).entity("Event is publishing has not enabled.").build(); } DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(), AndroidConstants.DEVICE_TYPE_ANDROID); - Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){ return Response.status(Response.Status.ACCEPTED).entity("Device is not in Active state.").build(); } else if (device == null){ @@ -92,7 +93,8 @@ public class EventReceiverServiceImpl implements EventReceiverService { return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } Message message = new Message(); - Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), AndroidConstants.DEVICE_TYPE_ANDROID}; + Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(), + AndroidConstants.DEVICE_TYPE_ANDROID}; String eventPayload = eventBeanWrapper.getPayload(); JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class); Object[] payload = { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java index 62c8a56258..308b784176 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.v09.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java @@ -70,13 +70,14 @@ public class EventReceiverServiceImpl implements EventReceiverService { if (log.isDebugEnabled()) { log.debug("Invoking Android device event logging."); } + Device device; try { if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) { return Response.status(Response.Status.ACCEPTED).entity("Event is publishing has not enabled.").build(); } DeviceIdentifier deviceIdentifier = new DeviceIdentifier(eventBeanWrapper.getDeviceIdentifier(), AndroidConstants.DEVICE_TYPE_ANDROID); - Device device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + device = AndroidAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); if (device != null && EnrolmentInfo.Status.ACTIVE != device.getEnrolmentInfo().getStatus()){ return Response.status(Response.Status.ACCEPTED).entity("Device is not in Active state.").build(); } else if (device == null){ @@ -93,7 +94,8 @@ public class EventReceiverServiceImpl implements EventReceiverService { return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); } Message message = new Message(); - Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), AndroidConstants.DEVICE_TYPE_ANDROID}; + Object[] metaData = {eventBeanWrapper.getDeviceIdentifier(), device.getEnrolmentInfo().getOwner(), + AndroidConstants.DEVICE_TYPE_ANDROID}; String eventPayload = eventBeanWrapper.getPayload(); JsonObject jsonObject = gson.fromJson(eventPayload, JsonObject.class); Object[] payload = {