Rename GeoAnalyticsConfigurations to OperationAnalyticsConfiguration

revert-70aa11f8
charitha 7 years ago
parent f766011f9b
commit 9f94f86401

@ -31,15 +31,15 @@ import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants.GeoServices;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.authorization.DeviceAccessAuthorizationException;
import org.wso2.carbon.device.mgt.common.geo.service.Alert;
import org.wso2.carbon.device.mgt.common.geo.service.Event;
import org.wso2.carbon.device.mgt.common.geo.service.GeoFence;
import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationProviderService;
import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationBasedServiceException;
import org.wso2.carbon.device.mgt.common.geo.service.GeoLocationProviderService;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroupConstants;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.device.mgt.jaxrs.service.api.GeoLocationBasedService;
import org.wso2.carbon.device.mgt.jaxrs.util.Constants;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
@ -76,13 +76,13 @@ public class GeoLocationBasedServiceImpl implements GeoLocationBasedService {
public Response getGeoDeviceStats(@PathParam("deviceId") String deviceId,
@PathParam("deviceType") String deviceType,
@QueryParam("from") long from, @QueryParam("to") long to) {
//First, check whether the Geo Location service has been enabled in the cdmf-config.xml file
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance()
.getDeviceManagementConfig();
if (deviceManagementConfig != null) {
if(!deviceManagementConfig.getGeoLocationConfiguration().getPublishLocationOperationResponse()){
return Response.status(Response.Status.BAD_REQUEST.getStatusCode()).build();
try {
if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) {
return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
.entity("Operation publishing does not exists").build();
}
} catch (DeviceManagementException e) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()).entity(e.getMessage()).build();
}
String tableName = "IOT_PER_DEVICE_STREAM_GEO_FUSEDSPATIALEVENT";
String fromDate = String.valueOf(from);

@ -144,30 +144,6 @@ public class DeviceInfo implements Serializable {
this.location = location;
}
public String getIMEI() {
if (IMEI != null) {
return IMEI;
} else {
return "";
}
}
public void setIMEI(String IMEI) {
this.IMEI = IMEI;
}
public String getIMSI() {
if (IMSI != null) {
return IMSI;
} else {
return "";
}
}
public void setIMSI(String IMSI) {
this.IMSI = IMSI;
}
public String getDeviceModel() {
if (deviceModel != null) {
return deviceModel;

@ -18,7 +18,7 @@
package org.wso2.carbon.device.mgt.core.config;
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;
import org.wso2.carbon.device.mgt.core.config.pagination.PaginationConfiguration;
@ -48,7 +48,7 @@ public final class DeviceManagementConfig {
private DeviceStatusTaskConfig deviceStatusTaskConfig;
private DeviceCacheConfiguration deviceCacheConfiguration;
private CertificateCacheConfiguration certificateCacheConfiguration;
private GeoLocationConfiguration geoLocationConfiguration;
private OperationAnalyticsConfiguration operationAnalyticsConfiguration;
private String defaultGroupsConfiguration;
@XmlElement(name = "ManagementRepository", required = true)
@ -142,13 +142,13 @@ public final class DeviceManagementConfig {
this.certificateCacheConfiguration = certificateCacheConfiguration;
}
@XmlElement(name = "GeoLocationConfiguration", required = true)
public GeoLocationConfiguration getGeoLocationConfiguration() {
return geoLocationConfiguration;
@XmlElement(name = "OperationAnalyticsConfiguration", required = true)
public OperationAnalyticsConfiguration getOperationAnalyticsConfiguration() {
return operationAnalyticsConfiguration;
}
public void setGeoLocationConfiguration(GeoLocationConfiguration geoLocationConfiguration) {
this.geoLocationConfiguration = geoLocationConfiguration;
public void setOperationAnalyticsConfiguration(OperationAnalyticsConfiguration operationAnalyticsConfiguration) {
this.operationAnalyticsConfiguration = operationAnalyticsConfiguration;
}
@XmlElement(name = "DefaultGroupsConfiguration", required = true)

@ -22,21 +22,21 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* This class represents the information related to Geo Location configuration.
* This class represents the information related to Device Operation Analytics configuration.
*/
@XmlRootElement(name = "GeoLocationConfiguration")
public class GeoLocationConfiguration {
@XmlRootElement(name = "OperationAnalyticsConfiguration")
public class OperationAnalyticsConfiguration {
private boolean publishLocationOperationResponse;
private boolean publishOperationResponse;
private boolean isEnabled;
public boolean getPublishLocationOperationResponse() {
return publishLocationOperationResponse;
public boolean getPublishOperationResponse() {
return publishOperationResponse;
}
@XmlElement(name = "PublishLocationOperationResponse", required = true)
public void setPublishLocationOperationResponse(boolean publishLocationOperationResponse) {
this.publishLocationOperationResponse = publishLocationOperationResponse;
@XmlElement(name = "PublishOperationResponse", required = true)
public void setPublishOperationResponse(boolean publishOperationResponse) {
this.publishOperationResponse = publishOperationResponse;
}
public boolean getIsEnabled() {

@ -31,6 +31,7 @@ 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;
@ -415,11 +416,22 @@ public final class DeviceManagerUtil {
return limit;
}
public static boolean isPublishLocationOperationResEnabled() throws DeviceManagementException {
public static boolean isOperationAnalyticsEnabled() throws DeviceManagementException {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
getDeviceManagementConfig();
if (deviceManagementConfig != null) {
return deviceManagementConfig.getGeoLocationConfiguration().getPublishLocationOperationResponse();
return deviceManagementConfig.getOperationAnalyticsConfiguration().getIsEnabled();
} else {
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
"cdm-config.xml file.");
}
}
public static boolean isPublishOperationResponseEnabled() throws DeviceManagementException {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
getDeviceManagementConfig();
if (deviceManagementConfig != null && isOperationAnalyticsEnabled()) {
return deviceManagementConfig.getOperationAnalyticsConfiguration().getPublishOperationResponse();
} else {
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
"cdm-config.xml file.");

@ -73,7 +73,7 @@ deviceModule = function () {
}
var userName = carbonUser.username + "@" + carbonUser.domain;
var locationHistory = [];
var geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled;
var geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled;
if (geoServicesEnabled) {
try {
var fromDate = new Date();

@ -60,6 +60,6 @@ function onRequest(context) {
} else {
viewModel.lastLocation = stringify({});
}
viewModel.geoServicesEnabled = devicemgtProps.serverConfig.geoLocationConfiguration.isEnabled;
viewModel.geoServicesEnabled = devicemgtProps.serverConfig.operationAnalyticsConfiguration.isEnabled;
return viewModel;
}

@ -33,6 +33,7 @@
<url>http://wso2.org</url>
<modules>
<module>org.wso2.carbon.device.mgt.basics.feature</module>
<module>org.wso2.carbon.device.mgt.server.feature</module>
<module>org.wso2.carbon.device.mgt.ui.feature</module>
<module>org.wso2.carbon.device.mgt.api.feature</module>

Loading…
Cancel
Save