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.context.CarbonContext;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants.GeoServices; 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.authorization.DeviceAccessAuthorizationException;
import org.wso2.carbon.device.mgt.common.geo.service.Alert; 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.Event;
import org.wso2.carbon.device.mgt.common.geo.service.GeoFence; 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.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.common.group.mgt.DeviceGroupConstants;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.jaxrs.service.api.GeoLocationBasedService; 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.Constants;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils; 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, public Response getGeoDeviceStats(@PathParam("deviceId") String deviceId,
@PathParam("deviceType") String deviceType, @PathParam("deviceType") String deviceType,
@QueryParam("from") long from, @QueryParam("to") long to) { @QueryParam("from") long from, @QueryParam("to") long to) {
//First, check whether the Geo Location service has been enabled in the cdmf-config.xml file try {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance() if (!DeviceManagerUtil.isPublishOperationResponseEnabled()) {
.getDeviceManagementConfig(); return Response.status(Response.Status.BAD_REQUEST.getStatusCode())
if (deviceManagementConfig != null) { .entity("Operation publishing does not exists").build();
if(!deviceManagementConfig.getGeoLocationConfiguration().getPublishLocationOperationResponse()){
return Response.status(Response.Status.BAD_REQUEST.getStatusCode()).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 tableName = "IOT_PER_DEVICE_STREAM_GEO_FUSEDSPATIALEVENT";
String fromDate = String.valueOf(from); String fromDate = String.valueOf(from);

@ -144,30 +144,6 @@ public class DeviceInfo implements Serializable {
this.location = location; 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() { public String getDeviceModel() {
if (deviceModel != null) { if (deviceModel != null) {
return deviceModel; return deviceModel;

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

@ -22,21 +22,21 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; 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") @XmlRootElement(name = "OperationAnalyticsConfiguration")
public class GeoLocationConfiguration { public class OperationAnalyticsConfiguration {
private boolean publishLocationOperationResponse; private boolean publishOperationResponse;
private boolean isEnabled; private boolean isEnabled;
public boolean getPublishLocationOperationResponse() { public boolean getPublishOperationResponse() {
return publishLocationOperationResponse; return publishOperationResponse;
} }
@XmlElement(name = "PublishLocationOperationResponse", required = true) @XmlElement(name = "PublishOperationResponse", required = true)
public void setPublishLocationOperationResponse(boolean publishLocationOperationResponse) { public void setPublishOperationResponse(boolean publishOperationResponse) {
this.publishLocationOperationResponse = publishLocationOperationResponse; this.publishOperationResponse = publishOperationResponse;
} }
public boolean getIsEnabled() { 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.GroupPaginationRequest;
import org.wso2.carbon.device.mgt.common.PaginationRequest; import org.wso2.carbon.device.mgt.common.PaginationRequest;
import org.wso2.carbon.device.mgt.common.TransactionManagementException; 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.group.mgt.GroupManagementException;
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
@ -415,11 +416,22 @@ public final class DeviceManagerUtil {
return limit; return limit;
} }
public static boolean isPublishLocationOperationResEnabled() throws DeviceManagementException { public static boolean isOperationAnalyticsEnabled() throws DeviceManagementException {
DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance(). DeviceManagementConfig deviceManagementConfig = DeviceConfigurationManager.getInstance().
getDeviceManagementConfig(); getDeviceManagementConfig();
if (deviceManagementConfig != null) { 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 { } else {
throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " + throw new DeviceManagementException("Device-Mgt configuration has not initialized. Please check the " +
"cdm-config.xml file."); "cdm-config.xml file.");

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

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

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

Loading…
Cancel
Save