Merge branch 'rest-api-improvements' of github.com:wso2/carbon-device-mgt-plugins into rest-api-improvements

revert-dabc3590
Chatura Dilan 9 years ago
commit 9086a130c4

@ -87,11 +87,11 @@ public interface DeviceManagementService {
value = "List of applications that need to be persisted against the device") value = "List of applications that need to be persisted against the device")
List<Application> applications); List<Application> applications);
@GET @PUT
@Path("/{id}/pending-operations") @Path("/{id}/pending-operations")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "PUT",
value = "Get the operation list pending for the device", value = "Get the operation list pending for the device",
responseContainer = "List", responseContainer = "List",
notes = "The Android agent communicates with the server to get the operations that are queued up " + notes = "The Android agent communicates with the server to get the operations that are queued up " +

@ -145,10 +145,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
notification.setOperationId(operation.getId()); notification.setOperationId(operation.getId());
notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification. notification.setStatus(org.wso2.carbon.device.mgt.common.notification.mgt.Notification.
Status.NEW.toString()); Status.NEW.toString());
notification.setDeviceIdentifier(id);
notification.setDescription("Operation " + operation.getCode() + " failed to execute on device " + notification.setDescription("Operation " + operation.getCode() + " failed to execute on device " +
deviceName + ". Device ID : " + deviceId); deviceName + ". Device ID : " + deviceId);
AndroidAPIUtils.getNotificationManagementService().addNotification(notification); AndroidAPIUtils.getNotificationManagementService().addNotification(id, notification);
} }
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Updating operation '" + operation.toString() + "'"); log.debug("Updating operation '" + operation.toString() + "'");

@ -60,7 +60,6 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
PlatformConfiguration = new PlatformConfiguration(); PlatformConfiguration = new PlatformConfiguration();
configs = new ArrayList<>(); configs = new ArrayList<>();
} }
ConfigurationEntry entry = new ConfigurationEntry(); ConfigurationEntry entry = new ConfigurationEntry();
License license = AndroidAPIUtils.getDeviceManagementService().getLicense( License license = AndroidAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, AndroidConstants. DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, AndroidConstants.
@ -110,7 +109,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration); AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
//AndroidAPIUtils.getGCMService().resetTenantConfigCache(); //AndroidAPIUtils.getGCMService().resetTenantConfigCache();
Response.status(Response.Status.ACCEPTED); Response.status(Response.Status.ACCEPTED);
responseMsg.setResponseMessage("Android platform configuration has updated successfully."); responseMsg.setResponseMessage("Android platform configuration has been updated successfully.");
responseMsg.setResponseCode(Response.Status.ACCEPTED.toString()); responseMsg.setResponseCode(Response.Status.ACCEPTED.toString());
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
msg = "Error occurred while modifying configuration settings of Android platform"; msg = "Error occurred while modifying configuration settings of Android platform";

@ -45,7 +45,8 @@
<property name="resourcePackage" value="org.wso2.carbon.mdm.services.android.services"/> <property name="resourcePackage" value="org.wso2.carbon.mdm.services.android.services"/>
<property name="version" value="1.0"/> <property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/> <property name="host" value="localhost:9443"/>
<property name="basePath" value="api/device-mgt/android/v1.0"/> <property name="schemes" value="https" />
<property name="basePath" value="/api/device-mgt/android/v1.0"/>
<property name="title" value="Android Device Management API Definitions"/> <property name="title" value="Android Device Management API Definitions"/>
<property name="contact" value="dev@wso2.org"/> <property name="contact" value="dev@wso2.org"/>
<property name="license" value="Apache 2.0"/> <property name="license" value="Apache 2.0"/>

@ -87,10 +87,9 @@ public class OperationUtils {
Notification lockResetNotification = new Notification(); Notification lockResetNotification = new Notification();
lockResetNotification.setOperationId(status.getCommandReference()); lockResetNotification.setOperationId(status.getCommandReference());
lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW)); lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW));
lockResetNotification.setDeviceIdentifier(deviceIdentifier);
lockResetNotification.setDescription( lockResetNotification.setDescription(
Constants.SyncMLResponseCodes.LOCKRESET_NOTIFICATION); Constants.SyncMLResponseCodes.LOCKRESET_NOTIFICATION);
nmService.addNotification(lockResetNotification); nmService.addNotification(deviceIdentifier, lockResetNotification);
} catch (NotificationManagementException e) { } catch (NotificationManagementException e) {
throw new WindowsOperationException("Failure occurred in getting notification service", e); throw new WindowsOperationException("Failure occurred in getting notification service", e);
} }
@ -156,10 +155,9 @@ public class OperationUtils {
Notification lockResetNotification = new Notification(); Notification lockResetNotification = new Notification();
lockResetNotification.setOperationId(status.getCommandReference()); lockResetNotification.setOperationId(status.getCommandReference());
lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW)); lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW));
lockResetNotification.setDeviceIdentifier(deviceIdentifier);
lockResetNotification.setDescription(Constants.SyncMLResponseCodes.LOCKRESET_NOTIFICATION); lockResetNotification.setDescription(Constants.SyncMLResponseCodes.LOCKRESET_NOTIFICATION);
nmService.addNotification(lockResetNotification); nmService.addNotification(deviceIdentifier, lockResetNotification);
} catch (NotificationManagementException e) { } catch (NotificationManagementException e) {
String msg = "Failure occurred in getting notification service"; String msg = "Failure occurred in getting notification service";
log.error(msg, e); log.error(msg, e);
@ -404,10 +402,9 @@ public class OperationUtils {
Notification notification = new Notification(); Notification notification = new Notification();
notification.setDescription("Auto generated DevicePin : " + pinValue); notification.setDescription("Auto generated DevicePin : " + pinValue);
notification.setOperationId(result.getCommandReference()); notification.setOperationId(result.getCommandReference());
notification.setDeviceIdentifier(deviceIdentifier);
notification.setStatus(String.valueOf(Notification.Status.NEW)); notification.setStatus(String.valueOf(Notification.Status.NEW));
try { try {
nmService.addNotification(notification); nmService.addNotification(deviceIdentifier, notification);
} catch (NotificationManagementException e) { } catch (NotificationManagementException e) {
String msg = "Failure Occurred in getting notification service."; String msg = "Failure Occurred in getting notification service.";
log.error(msg, e); log.error(msg, e);

Loading…
Cancel
Save