diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java
index 311dd44a06..b9070a0df2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java
@@ -70,7 +70,7 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService {
@PathParam("deviceType") String deviceType,
@QueryParam("from") long from, @QueryParam("to") long to) {
try {
- if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) {
+ if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) {
return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build();
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java
index 175ad8488f..97e357a0e1 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/DeviceManagementConfig.java
@@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.core.config;
import org.wso2.carbon.device.mgt.core.config.archival.ArchivalConfiguration;
import org.wso2.carbon.device.mgt.core.config.cache.CertificateCacheConfiguration;
+import org.wso2.carbon.device.mgt.core.config.geo.location.GeoLocationConfiguration;
import org.wso2.carbon.device.mgt.core.config.geo.location.OperationAnalyticsConfiguration;
import org.wso2.carbon.device.mgt.core.config.cache.DeviceCacheConfiguration;
import org.wso2.carbon.device.mgt.core.config.identity.IdentityConfigurations;
@@ -53,6 +54,7 @@ public final class DeviceManagementConfig {
private DeviceCacheConfiguration deviceCacheConfiguration;
private CertificateCacheConfiguration certificateCacheConfiguration;
private OperationAnalyticsConfiguration operationAnalyticsConfiguration;
+ private GeoLocationConfiguration geoLocationConfiguration;
private String defaultGroupsConfiguration;
private RemoteSessionConfiguration remoteSessionConfiguration;
private ArchivalConfiguration archivalConfiguration;
@@ -167,6 +169,15 @@ public final class DeviceManagementConfig {
this.operationAnalyticsConfiguration = operationAnalyticsConfiguration;
}
+ @XmlElement(name = "GeoLocationConfiguration", required = true)
+ public GeoLocationConfiguration getGeoLocationConfiguration() {
+ return geoLocationConfiguration;
+ }
+
+ public void setGeoLocationConfiguration(GeoLocationConfiguration geoLocationConfiguration) {
+ this.geoLocationConfiguration = geoLocationConfiguration;
+ }
+
@XmlElement(name = "DefaultGroupsConfiguration", required = true)
public String getDefaultGroupsConfiguration() {
return defaultGroupsConfiguration;
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java
new file mode 100644
index 0000000000..a4a3492804
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/GeoLocationConfiguration.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * you may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.wso2.carbon.device.mgt.core.config.geo.location;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * This class represents the information related to Geo Location configuration.
+ */
+@XmlRootElement(name = "GeoLocationConfiguration")
+public class GeoLocationConfiguration {
+
+ private boolean isEnabled;
+
+ public boolean getIsEnabled() {
+ return isEnabled;
+ }
+
+ @XmlElement(name = "isEnabled", required = true)
+ public void setIsEnabled(boolean isEnabled) {
+ this.isEnabled = isEnabled;
+ }
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java
index 8cc2053e64..337a295fb4 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/geo/location/OperationAnalyticsConfiguration.java
@@ -27,24 +27,24 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "OperationAnalyticsConfiguration")
public class OperationAnalyticsConfiguration {
- private boolean publishOperationResponse;
- private boolean isEnabled;
+ private boolean publishDeviceInfoResponse;
+ private boolean publishLocationResponse;
- public boolean getPublishOperationResponse() {
- return publishOperationResponse;
+ public boolean getPublishDeviceInfoResponse() {
+ return publishDeviceInfoResponse;
}
- @XmlElement(name = "PublishOperationResponse", required = true)
- public void setPublishOperationResponse(boolean publishOperationResponse) {
- this.publishOperationResponse = publishOperationResponse;
+ @XmlElement(name = "PublishDeviceInfoResponse", required = true)
+ public void setPublishDeviceInfoResponse(boolean publishDeviceInfoResponse) {
+ this.publishDeviceInfoResponse = publishDeviceInfoResponse;
}
- public boolean getIsEnabled() {
- return isEnabled;
+ public boolean getPublishLocationResponse() {
+ return publishLocationResponse;
}
- @XmlElement(name = "isEnabled", required = true)
- public void setEnabled(boolean enabled) {
- isEnabled = enabled;
+ @XmlElement(name = "PublishLocationResponse", required = true)
+ public void setPublishLocationResponse(boolean publishLocationResponse) {
+ this.publishLocationResponse = publishLocationResponse;
}
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java
index 0a7f22dbf0..385ab18477 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java
@@ -74,7 +74,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
deviceDetailsDAO.addDeviceProperties(deviceInfo.getDeviceDetailsMap(), device.getId());
DeviceManagementDAOFactory.commitTransaction();
- if (DeviceManagerUtil.isPublishOperationResponseEnabled()) {
+ if (DeviceManagerUtil.isPublishDeviceInfoResponseEnabled()) {
Object[] metaData = {device.getDeviceIdentifier(), device.getType()};
Object[] payload = new Object[]{
Calendar.getInstance().getTimeInMillis(),
@@ -192,7 +192,7 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
deviceDAO.updateDevice(device, CarbonContext.getThreadLocalCarbonContext().getTenantId());
deviceDetailsDAO.deleteDeviceLocation(deviceLocation.getDeviceId());
deviceDetailsDAO.addDeviceLocation(deviceLocation);
- if (DeviceManagerUtil.isPublishOperationResponseEnabled()) {
+ if (DeviceManagerUtil.isPublishLocationResponseEnabled()) {
Object[] metaData = {device.getDeviceIdentifier(), device.getType()};
Object[] payload = new Object[]{
deviceLocation.getUpdatedTime().getTime(),
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java
index 87b6e70ac7..97cd4bfd37 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/DeviceManagerUtil.java
@@ -31,7 +31,6 @@ import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
import org.wso2.carbon.device.mgt.common.GroupPaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.TransactionManagementException;
-import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
import org.wso2.carbon.device.mgt.common.group.mgt.GroupManagementException;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
@@ -416,23 +415,22 @@ public final class DeviceManagerUtil {
return limit;
}
- public static boolean isOperationAnalyticsEnabled() throws DeviceManagementException {
+ public static boolean isPublishLocationResponseEnabled() throws DeviceManagementException {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
getDeviceManagementConfig();
if (deviceManagementConfig != null) {
- return deviceManagementConfig.getOperationAnalyticsConfiguration().getIsEnabled();
+ return deviceManagementConfig.getOperationAnalyticsConfiguration().getPublishLocationResponse();
} else {
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
- "cdm-config.xml file.");
+ "cdm-config.xml file.");
}
}
- public static boolean isPublishOperationResponseEnabled() throws DeviceManagementException {
+ public static boolean isPublishDeviceInfoResponseEnabled() throws DeviceManagementException {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
getDeviceManagementConfig();
if (deviceManagementConfig != null) {
- return isOperationAnalyticsEnabled()
- && deviceManagementConfig.getOperationAnalyticsConfiguration().getPublishOperationResponse();
+ return deviceManagementConfig.getOperationAnalyticsConfiguration().getPublishDeviceInfoResponse();
} else {
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
"cdm-config.xml file.");
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml
index fa199542e5..5401c99d7d 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/cdm-config.xml
@@ -88,9 +88,24 @@
false
86400
-
+
false
- false
+
+
+ false
+ false
+
+ false
+
+
+
+
+ *
+
+
BYOD,COPE
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
index ef6cf7357f..c83585e96b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
@@ -73,7 +73,7 @@ deviceModule = function () {
}
var userName = carbonUser.username + "@" + carbonUser.domain;
var locationHistory = [];
- var geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled;
+ var geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled;
if (geoServicesEnabled) {
try {
var fromDate = new Date();
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java
index 311dd44a06..b9070a0df2 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.v09.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/GeoLocationBasedServiceImpl.java
@@ -70,7 +70,7 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService {
@PathParam("deviceType") String deviceType,
@QueryParam("from") long from, @QueryParam("to") long to) {
try {
- if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) {
+ if (!DeviceManagerUtil.isPublishLocationResponseEnabled()) {
return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.entity("Unable to retrive Geo Device stats. Geo Data publishing does not enabled.").build();
}
diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml
index e17b5c5839..fa6e580215 100644
--- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml
+++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/conf/cdm-config.xml
@@ -118,9 +118,24 @@
-
+
false
- false
+
+
+ false
+ false
+
+ false
+
+
+
+
+ *
+
+