diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql index a7b4691313..9b6e0eeb0e 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/Android-Agent-ExecutionPlan/Android-Agent-ExecutionPlan.siddhiql @@ -9,12 +9,12 @@ @Plan:trace('false') @Import('org.wso2.android.agent.Stream:1.0.0') -define stream dataIn (deviceId string, payload string, type string); +define stream dataIn (meta_deviceId string, payload string, type string); @Export('org.wso2.geo.LocationStream:1.0.0') define stream dataOut (id string, timeStamp long, latitude double, longitude double, type string, speed float, heading float ); from dataIn[type == 'location'] -select deviceId as id, convert(json:getProperty(payload, 'timeStamp'), 'long') as timeStamp, convert(json:getProperty(payload, +select meta_deviceId as id, convert(json:getProperty(payload, 'timeStamp'), 'long') as timeStamp, convert(json:getProperty(payload, 'latitude'), 'double') as latitude, convert(json:getProperty(payload, 'longitude'), 'double') as longitude, 'android' as type, 0.0f as speed, 0.0f as heading insert into dataOut \ No newline at end of file diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json index ed17c58f23..1c8f6b2b66 100755 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.analytics/src/main/resources/carbonapps/org.wso2.android.agent.Stream_1.0.0/org.wso2.android.agent.Stream_1.0.0.json @@ -3,11 +3,13 @@ "version": "1.0.0", "nickName": "", "description": "Stream that receives various types of events from android agent", - "payloadData": [ + "metaData": [ { "name": "deviceId", "type": "STRING" - }, + } + ], + "payloadData": [ { "name": "payload", "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 a11c678d02..362289b2ca 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 @@ -21,6 +21,7 @@ package org.wso2.carbon.mdm.services.android.services.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.analytics.data.publisher.exception.DataPublisherConfigurationException; import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; @@ -31,6 +32,7 @@ import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorExcep import org.wso2.carbon.mdm.services.android.services.EventReceiverService; import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; import org.wso2.carbon.mdm.services.android.util.Message; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import javax.validation.Valid; import javax.validation.constraints.Size; @@ -51,12 +53,12 @@ public class EventReceiverServiceImpl implements EventReceiverService { log.debug("Invoking Android device even logging."); } Message message = new Message(); + Object metaData[] = {eventBeanWrapper.getDeviceIdentifier()}; - Object payload[] = {eventBeanWrapper.getDeviceIdentifier(), eventBeanWrapper.getPayload(), - eventBeanWrapper.getType()}; + Object payload[] = {eventBeanWrapper.getPayload(), eventBeanWrapper.getType()}; try { if (AndroidAPIUtils.getEventPublisherService().publishEvent( - EVENT_STREAM_DEFINITION, "1.0.0", new Object[0], new Object[0], payload)) { + EVENT_STREAM_DEFINITION, "1.0.0", metaData, new Object[0], payload)) { message.setResponseCode("Event is published successfully."); return Response.status(Response.Status.CREATED).entity(message).build(); } else {