Improving swagger annotations

revert-dabc3590
prabathabey 9 years ago
commit 631d57e70d

@ -18,10 +18,8 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.*;
import io.swagger.annotations.ApiParam; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.wso2.carbon.mdm.services.android.bean.wrapper.*; import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
@ -32,7 +30,8 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@Path("/devices") @Path("/admin/devices")
@Api(value = "Android Device Management Administrative Service", description = "Device management related admin APIs.")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public interface DeviceManagementAdminService { public interface DeviceManagementAdminService {
@ -44,14 +43,18 @@ public interface DeviceManagementAdminService {
httpMethod = "POST", httpMethod = "POST",
value = "Adds a Device Lock on Android Devices", value = "Adds a Device Lock on Android Devices",
notes = "Using this API you have the option of hard locking an Android device, where the Administrator " + notes = "Using this API you have the option of hard locking an Android device, where the Administrator " +
"permanently locks the device or screen locking an Android device" "permanently locks the device or screen locking an Android device",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Lock operation has successfully been scheduled"), @ApiResponse(code = 201, message = "Created \n Lock operation has successfully been scheduled",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response configureDeviceLock( Response configureDeviceLock(
@ApiParam(name = "cameraBeanWrapper", @ApiParam(name = "deviceLockBeanWrapper",
value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper); value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper);
@POST @POST
@ -63,10 +66,12 @@ public interface DeviceManagementAdminService {
responseContainer = "List", responseContainer = "List",
notes = "Using this API you have the option of unlocking an Android device, where the Administrator " + notes = "Using this API you have the option of unlocking an Android device, where the Administrator " +
"unlocks the device", "unlocks the device",
response = String.class) response = Activity.class,
tags = "Android Device Management Administrative Service")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "created"), @ApiResponse(code = 201, message = "Created \n Successfully added unlock.", response = Activity.class),
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") @ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response configureDeviceUnlock( Response configureDeviceUnlock(
@ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation") @ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation")
@ -74,17 +79,19 @@ public interface DeviceManagementAdminService {
@POST @POST
@Path("/get-location") @Path("/location")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Requesting Location Coordinates of Android Devices", value = "Requesting Location Coordinates of Android Devices",
responseContainer = "List", responseContainer = "List",
notes = "Request location coordinates of Android devices", notes = "Request location coordinates of Android devices",
response = String.class) response = Activity.class,
tags = "Android Device Management Administrative Service")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Requested Device Coordinates"), @ApiResponse(code = 201, message = "Created \n Requested Device Coordinates", response = Activity.class),
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")}) @ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")})
Response getDeviceLocation( Response getDeviceLocation(
@ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location") @ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location")
List<String> deviceIDs); List<String> deviceIDs);
@ -95,11 +102,14 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Clearing the Password on Android Devices", value = "Clearing the Password on Android Devices",
notes = "Clear the password on Android devices" notes = "Clear the password on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully cleared password.", response = Activity.class),
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") @ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response removePassword( Response removePassword(
@ApiParam(name = "deviceIDs", @ApiParam(name = "deviceIDs",
@ -111,18 +121,22 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Enabling or Disabling the Camera on Android Devices", value = "Enabling or Disabling the Camera on Android Devices",
notes = "Enable or disable the camera on Android devices" notes = "Enable or disable the camera on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Camera operation performed successfully.",
@ApiResponse(code = 500, message = "Issue in creating a new camera instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Issue in creating a new camera instance")
}) })
Response configureCamera( Response configureCamera(
@ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs") @ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs")
CameraBeanWrapper cameraBeanWrapper); CameraBeanWrapper cameraBeanWrapper);
@POST @POST
@Path("/get-device-info") @Path("/info")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
@ -130,11 +144,15 @@ public interface DeviceManagementAdminService {
value = "Requesting Information from Android Devices", value = "Requesting Information from Android Devices",
notes = "Using this REST API you are able to request for Android device details. Once this REST API is" + notes = "Using this REST API you are able to request for Android device details. Once this REST API is" +
" executed it will be in the Android operation queue until the device calls the server to retrieve " + " executed it will be in the Android operation queue until the device calls the server to retrieve " +
"the list of operations that needs to be executed on the device" "the list of operations that needs to be executed on the device",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Device Information"), @ApiResponse(code = 201, message = "Created \n Device information request operation added.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response getDeviceInformation( Response getDeviceInformation(
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information") @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information")
@ -148,33 +166,40 @@ public interface DeviceManagementAdminService {
httpMethod = "POST", httpMethod = "POST",
value = "Enterprise Wiping Android Devices", value = "Enterprise Wiping Android Devices",
notes = "Enterprise wipe is the process of deleting enterprise related data on a device while keeping the " + notes = "Enterprise wipe is the process of deleting enterprise related data on a device while keeping the " +
"personal data intact. You are able to enterprise wipe Android devices using this REST API" "personal data intact. You are able to enterprise wipe Android devices using this REST API",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Enterprise wipe operation added.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance" response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation."
)}) )})
Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to done enterprise-wipe") Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe")
List<String> deviceIDs); List<String> deviceIDs);
@POST @POST
@Path("/wipe-devices") @Path("/wipe")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Factory Resetting an Android Device", value = "Factory Resetting an Android Device",
notes = "Factory rest or erases all the data stored in the Android devices " + notes = "Factory rest or erases all the data stored in the Android devices " +
"to restore them back to the original system" "to restore them back to the original system",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Added wipe operation", response = Activity.class),
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")}) @ApiResponse(code = 400, message = "Bad Request. \n WipeData bean is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")})
Response wipeData( Response wipeData(
@ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds to be need to done wipe-data") @ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data")
WipeDataBeanWrapper wipeDataBeanWrapper); WipeDataBeanWrapper wipeDataBeanWrapper);
@POST @POST
@Path("/get-applications") @Path("/applications")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
@ -183,58 +208,74 @@ public interface DeviceManagementAdminService {
notes = "Using this REST API the server requests for the list of applications that are installed on" + notes = "Using this REST API the server requests for the list of applications that are installed on" +
" the Android devices. Once this REST API is executed it will be in the Android operation queue " + " the Android devices. Once this REST API is executed it will be in the Android operation queue " +
"until the device calls the server to retrieve the list of operations that needs to be executed " + "until the device calls the server to retrieve the list of operations that needs to be executed " +
"on the device" "on the device",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "List of applications for specific deviceIdentifier"), @ApiResponse(code = 201, message = "Created \n List of applications for specific deviceIdentifier",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response getApplications( Response getApplications(
@ApiParam(name = "deviceIDs", value = "Device Ids to be need to get applications which already installed") @ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed")
List<String> deviceIDs); List<String> deviceIDs);
@POST @POST
@Path("/ring-devices") @Path("/ring")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Ringing Android Devices", value = "Ringing Android Devices",
notes = "Ring Android devices" notes = "Ring Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added ring operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response ringDevice( Response ringDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needs to be ring") List<String> deviceIDs); @ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") List<String> deviceIDs);
@POST @POST
@Path("/reboot-devices") @Path("/reboot")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Rebooting Android Devices", value = "Rebooting Android Devices",
notes = "Reboot Android devices" notes = "Reboot Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added reboot operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response rebootDevice( Response rebootDevice(
@ApiParam(name = "deviceIDs", value = "Device Ids needs to be rebooted") List<String> deviceIDs); @ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") List<String> deviceIDs);
@POST @POST
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Muting Android Devices", value = "Muting Android Devices",
notes = "Mute Android devices" notes = "Mute Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added mute operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n Device identifier list is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
@Path("/mute-devices") @Path("/mute")
Response muteDevice( Response muteDevice(
@ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") List<String> deviceIDs); @ApiParam(name = "deviceIDs", value = "DeviceIDs need to be muted") List<String> deviceIDs);
@ -247,11 +288,15 @@ public interface DeviceManagementAdminService {
value = "Installing an Application on Android Devices", value = "Installing an Application on Android Devices",
notes = "Install an application on an Android device. If the device you are installing the application" + notes = "Install an application on an Android device. If the device you are installing the application" +
" on has the WSO2 system service installed, the application installation will happen in silent " + " on has the WSO2 system service installed, the application installation will happen in silent " +
"mode, else the device user's consent will be required" "mode, else the device user's consent will be required",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added install application operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n applicationInstallationBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response installApplication( Response installApplication(
@ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs") @ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs")
@ -266,11 +311,15 @@ public interface DeviceManagementAdminService {
value = "Updating an Application on Android Devices", value = "Updating an Application on Android Devices",
notes = "Update an application on an Android device. If the device you are updating the application" + notes = "Update an application on an Android device. If the device you are updating the application" +
" has the WSO2 system service installed, the application update will happen in silent " + " has the WSO2 system service installed, the application update will happen in silent " +
"mode, else the device user's consent will be required" "mode, else the device user's consent will be required",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added update application operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n applicationInstallationBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response updateApplication( Response updateApplication(
@ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs") @ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs")
@ -282,11 +331,15 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Uninstalling an Application from Android Devices", value = "Uninstalling an Application from Android Devices",
notes = "Uninstall an application from Android devices" notes = "Uninstall an application from Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added uninstall application operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n applicationInstallationBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response uninstallApplication( Response uninstallApplication(
@ApiParam(name = "applicationUninstallationBeanWrapper", @ApiParam(name = "applicationUninstallationBeanWrapper",
@ -300,14 +353,19 @@ public interface DeviceManagementAdminService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Get BlackListed Applications", value = "Get BlackListed Applications",
notes = "Getting BlackListed Applications" notes = "Getting BlackListed Applications",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added blacklist application operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n blacklistApplicationsBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response blacklistApplications( Response blacklistApplications(
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications Configuration and DeviceIds") @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " +
"Configuration and DeviceIds")
BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper); BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper);
@POST @POST
@ -317,11 +375,15 @@ public interface DeviceManagementAdminService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Upgrading device firmware", value = "Upgrading device firmware",
notes = "Device firmware upgrade" notes = "Device firmware upgrade",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added firmware upgrade operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n upgradeFirmwareBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response upgradeFirmware( Response upgradeFirmware(
@ApiParam(name = "upgradeFirmwareBeanWrapper", @ApiParam(name = "upgradeFirmwareBeanWrapper",
@ -335,11 +397,15 @@ public interface DeviceManagementAdminService {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Configuring VPN on Android devices", value = "Configuring VPN on Android devices",
notes = "Configure VPN on Android devices" notes = "Configure VPN on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added configure vpn operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n vpnBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response configureVPN( Response configureVPN(
@ApiParam(name = "vpnBeanWrapper", @ApiParam(name = "vpnBeanWrapper",
@ -352,11 +418,15 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Sending a Notification to Android Devices", value = "Sending a Notification to Android Devices",
notes = "Send a notification to Android devices" notes = "Send a notification to Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added send notification operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n notificationBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response sendNotification( Response sendNotification(
@ApiParam(name = "notificationBeanWrapper", @ApiParam(name = "notificationBeanWrapper",
@ -369,11 +439,15 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Configuring Wi-Fi on Android Devices", value = "Configuring Wi-Fi on Android Devices",
notes = "Configure Wi-Fi on Android devices" notes = "Configure Wi-Fi on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added configure wifi operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n WifiConfigurations is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response configureWifi( Response configureWifi(
@ApiParam(name = "wifiBeanWrapper", @ApiParam(name = "wifiBeanWrapper",
@ -385,11 +459,15 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Encrypting Storage on Android Devices", value = "Encrypting Storage on Android Devices",
notes = "Encrypt the data stored on Android devices" notes = "Encrypt the data stored on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added encrypt storage operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n encryptionBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response encryptStorage( Response encryptStorage(
@ApiParam(name = "encryptionBeanWrapper", @ApiParam(name = "encryptionBeanWrapper",
@ -402,11 +480,15 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Changing the Lock Code on Android Devices", value = "Changing the Lock Code on Android Devices",
notes = "Change the lock code on Android devices" notes = "Change the lock code on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Created"), @ApiResponse(code = 201, message = "Created \n Successfully added change lock code operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n lockCodeBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response changeLockCode( Response changeLockCode(
@ApiParam(name = "lockCodeBeanWrapper", @ApiParam(name = "lockCodeBeanWrapper",
@ -419,11 +501,15 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Setting a Passcode Policy on Android Devices", value = "Setting a Passcode Policy on Android Devices",
notes = "Set a password policy on Android devices" notes = "Set a password policy on Android devices",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "created"), @ApiResponse(code = 201, message = "Created \n Successfully added set passcode policy operation.",
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") response = Activity.class),
@ApiResponse(code = 400, message = "Bad Request. \n passwordPolicyBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response setPasswordPolicy( Response setPasswordPolicy(
@ApiParam(name = "passwordPolicyBeanWrapper", @ApiParam(name = "passwordPolicyBeanWrapper",
@ -436,11 +522,14 @@ public interface DeviceManagementAdminService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Setting a Web Clip on Android Devices", value = "Setting a Web Clip on Android Devices",
notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application" notes = "Set a web clip on Android devices. A web clip is used to add a bookmark to a web application",
response = Activity.class,
tags = "Android Device Management Administrative Service"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 202, message = "Accepted"), @ApiResponse(code = 201, message = "Created \n Successfully added web clip operation."),
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance") @ApiResponse(code = 400, message = "Bad Request. \n webClipBeanWrapper is empty."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred when adding operation.")
}) })
Response setWebClip( Response setWebClip(
@ApiParam(name = "webClipBeanWrapper", @ApiParam(name = "webClipBeanWrapper",

@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@Api(value = "Android Device Management API", @Api(value = "Android Device Management",
description = "This carries all the resources related to Android device management functionalities") description = "This carries all the resources related to Android device management functionalities")
@Path("/devices") @Path("/devices")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ -38,14 +38,15 @@ public interface DeviceManagementService {
@PUT @PUT
@Path("/{id}/applications") @Path("/{id}/applications")
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON,
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Update the application list of a device" value = "Update the application list of a device",
tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n " + @ApiResponse(code = 200, message = "OK. \n " +
"Application list of the device has successfully been updated"), "Application list of the device has successfully been updated"),
@ApiResponse(code = 204, message = "No Content. \n Application list of the device has not been updated"),
@ApiResponse(code = 500, message = "Internal Server Error. \n " + @ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Sever error occurred while modifying the application list") "Sever error occurred while modifying the application list")
}) })
@ -57,14 +58,14 @@ public interface DeviceManagementService {
@GET @GET
@Path("/{id}/pending-operations") @Path("/{id}/pending-operations")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "GET",
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 " +
"at the server end for a given device using via this particular resource", "at the server end for a given device using via this particular resource",
response = Operation.class) response = Operation.class,
tags = "Android Device Management")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n List of pending operations of the device is returned", @ApiResponse(code = 200, message = "OK. \n List of pending operations of the device is returned",
responseHeaders = { responseHeaders = {
@ -99,7 +100,8 @@ public interface DeviceManagementService {
notes = "When carrying out device registration via an Android device, you need to initially install" + notes = "When carrying out device registration via an Android device, you need to initially install" +
" an Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," + " an Android Agent on the device, before being able to register the device with WSO2 EMM. Instead," +
" you can use this REST API to register an Android device with WSO2 EMM, without having to install" + " you can use this REST API to register an Android device with WSO2 EMM, without having to install" +
" an Android Agent on the respective device" " an Android Agent on the respective device",
tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 201, message = "Created. \n Device has successfully been enrolled. Location header " + @ApiResponse(code = 201, message = "Created. \n Device has successfully been enrolled. Location header " +
@ -117,7 +119,8 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
httpMethod = "GET", httpMethod = "GET",
value = "Getting the Registration Status of an Android Device", value = "Getting the Registration Status of an Android Device",
notes = "Use this REST API to retrieve the registration status of an Android device" notes = "Use this REST API to retrieve the registration status of an Android device",
tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Device has already enrolled", @ApiResponse(code = 200, message = "Device has already enrolled",
@ -129,6 +132,12 @@ public interface DeviceManagementService {
description = "Date and time the resource has been modified the last time.\n" + description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}), "Used by caches, or in conditional requests.")}),
@ApiResponse(code = 404, message = "Not Found. \n Requested device not found."), @ApiResponse(code = 404, message = "Not Found. \n Requested device not found."),
@ApiResponse(code = 303, message = "See Other. \n " +
"Source can be retrieved from the URL specified at the Location header.",
responseHeaders = {
@ResponseHeader(name = "Location", description = "The Source URL of the document.")}),
@ApiResponse(code = 304, message = "Not Modified. \n " +
"Empty body because the client already has the latest version of the requested resource."),
@ApiResponse(code = 500, message = "Internal Server Error. \n " + @ApiResponse(code = 500, message = "Internal Server Error. \n " +
"Server error occurred while retrieving the enrollment status of the device."), "Server error occurred while retrieving the enrollment status of the device."),
}) })
@ -139,7 +148,8 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating the Registration Details of an Android Device", value = "Updating the Registration Details of an Android Device",
notes = "Use this REST API to update the registration details of an Android device" notes = "Use this REST API to update the registration details of an Android device",
tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Device enrollment has been updated successfully", @ApiResponse(code = 200, message = "OK. \n Device enrollment has been updated successfully",
@ -173,7 +183,8 @@ public interface DeviceManagementService {
@ApiOperation( @ApiOperation(
httpMethod = "DELETE", httpMethod = "DELETE",
value = "Un-registering an Android Device", value = "Un-registering an Android Device",
notes = "Use this REST API to un-register a specific Android device" notes = "Use this REST API to un-register a specific Android device",
tags = "Android Device Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Device has successfully been dis-enrolled"), @ApiResponse(code = 200, message = "OK. \n Device has successfully been dis-enrolled"),

@ -26,7 +26,7 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@Api(value = "Android Configuration Management API", description = "This API carries all resource associated with " + @Api(value = "Android Configuration Management", description = "This API carries all resource associated with " +
"manipulating the general configurations of Android platform") "manipulating the general configurations of Android platform")
@Path("/configuration") @Path("/configuration")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@ -37,25 +37,41 @@ public interface DeviceTypeConfigurationService {
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Configuring Android Platform Settings", value = "Configuring Android platform settings.",
notes = "Configure the Android platform settings using this REST API" notes = "Configure the Android platform settings using this REST API.",
tags = "Android Configuration Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Android platform configuration saved successfully"), @ApiResponse(code = 201, message = "Created. \n Android platform configuration saved successfully",
@ApiResponse(code = 500, message = "Internal Server Error") responseHeaders = {
@ResponseHeader(name = "Location", description = "URL of the configuration added.")
}),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 500, message = "Internal Server Error. \n" +
" Error occurred while saving configurations for the android platform.")
}) })
Response addConfiguration(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration") Response addConfiguration(@ApiParam(name = "configuration",
PlatformConfiguration configuration) throws AndroidAgentException; value = "Android platform related configurations that must be added.")
PlatformConfiguration configuration);
@GET @GET
@ApiOperation( @ApiOperation(
httpMethod = "GET", httpMethod = "GET",
value = "Getting Android Platform Configurations", value = "Getting Android Platform Configurations",
notes = "Get the Android platform configuration details using this REST API", notes = "Get the Android platform configuration details using this REST API",
response = PlatformConfiguration.class response = PlatformConfiguration.class,
tags = "Android Configuration Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Get Android Configurations"), @ApiResponse(code = 200, message = "Get Android Configuration."),
@ApiResponse(code = 500, message = "Server Error") @ApiResponse(code = 303, message = "See Other. \n " +
"Source can be retrieved from the URL specified at the Location header.",
responseHeaders = {
@ResponseHeader(name = "Location", description = "The Source URL of the document.")}),
@ApiResponse(code = 304, message = "Not Modified. \n " +
"Empty body because the client already has the latest version of the requested resource."),
@ApiResponse(code = 404, message = "Not Found. \n Resource requested does not exist."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred while fetching " +
"configuration settings of Android platform.")
}) })
Response getConfiguration() throws AndroidAgentException; Response getConfiguration() throws AndroidAgentException;
@ -64,15 +80,36 @@ public interface DeviceTypeConfigurationService {
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating Android Platform Configurations", value = "Updating Android Platform Configuration.",
notes = "Update the Android platform configurations using this REST API" notes = "Update the Android platform configurations using this REST API.",
tags = "Android Configuration Management"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Platform configuration has successfully been updated"), @ApiResponse(code = 200, message = "Created. \n Configurations was updated successfully."),
@ApiResponse(code = 500, message = "Error occurred while modifying configuration settings of " + @ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
"Android platform") @ApiResponse(code = 404, message = "Not Found. \n Resource to be changed does not exist."),
@ApiResponse(code = 500, message = "Internal Server Error. \n Error occurred while modifying " +
"configuration settings of Android platform.")
}) })
Response updateConfiguration(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration") Response updateConfiguration(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration")
PlatformConfiguration configuration) throws AndroidAgentException; PlatformConfiguration configuration) throws AndroidAgentException;
@GET
@Path("license")
@Produces("text/plain")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting the License Agreement for Android Device Registration",
notes = "Use this REST API to retrieve the license agreement that is used for the Android device " +
"registration process",
response = String.class,
tags = "Android Configuration Management")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Licence agreement"),
@ApiResponse(code = 500, message = "Error occurred while retrieving the license configured for Android " +
"device enrolment")
})
Response getLicense() throws AndroidAgentException;
} }

@ -18,10 +18,7 @@
*/ */
package org.wso2.carbon.mdm.services.android.services; package org.wso2.carbon.mdm.services.android.services;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.*;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper;
@ -29,86 +26,71 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.")
@Path("/events") @Path("/events")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public interface EventReceiverService { public interface EventReceiverService {
@POST @POST
@Path("/publish-event") @Path("/publish")
@ApiOperation( @ApiOperation(
consumes = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Event Publishing via REST API.", value = "Event publishing via REST API.",
notes = "Publish events received by the WSO2 EMM Android client to WSO2 DAS using this API." notes = "Publish events received by the EMM Android client to WSO2 DAS using this API.",
tags = "Event Receiver"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Event is published successfully."), @ApiResponse(code = 201, message = "Created. \n Event is published successfully. Location header " +
@ApiResponse(code = 500, message = "Error occurred while publishing the events from Android agent.") "contains URL of newly enrolled device",
responseHeaders = {
@ResponseHeader(name = "Location", description = "URL of the newly published event.")
}),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
@ApiResponse(code = 500, message = "Internal Server Error. \n" +
" Error occurred while publishing the events from Android agent.")
}) })
Response publishEvents( Response publishEvents(
@ApiParam(name = "eventBeanWrapper", @ApiParam(name = "eventBeanWrapper", value = "Information of the agent event to be published on DAS.")
value = "Information of the agent event to be published on DAS.")
EventBeanWrapper eventBeanWrapper); EventBeanWrapper eventBeanWrapper);
@GET @GET
@ApiOperation( @ApiOperation(
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
value = "Getting Event Details of a Device.", value = "Getting event details for a given time period.",
notes = "Get the event details received by an Android device using this API.", notes = "Get the event details of a device for a given time duration using this API.Request must contain " +
"the device identifier. Optionally, both, date from and date to value should be present to get " +
"alerts between times. Based on device type and the device identifier also filtering can be done" +
"(This cannot be combined with to and from parameters).",
response = DeviceState.class, response = DeviceState.class,
responseContainer = "List" responseContainer = "List",
tags = "Event Receiver"
) )
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "List of Device statuses."), @ApiResponse(code = 200, message = "Created \n Event details of a device for a given time duration",
@ApiResponse(code = 500, response = DeviceState.class, responseContainer = "List"),
message = "Error occurred while getting published events for specific given device.") @ApiResponse(code = 303, message = "See Other. \n Source can be retrieved from the URL specified at" +
" the Location header.",
responseHeaders = {
@ResponseHeader(name = "Location", description = "The Source URL of the document.")
}),
@ApiResponse(code = 304, message = "Not Modified. \n " +
"Empty body because the client already has the latest version of the requested resource."),
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error. You must provide" +
" the device identifier. Additionally, the device identifier can be combined with either the type" +
" OR date from and to."),
@ApiResponse(code = 404, message = "Not Found. \n Resource requested does not exist."),
@ApiResponse(code = 500, message = "Error occurred while getting published events for specific device.")
}) })
Response retrieveAlert( Response retrieveAlerts(
@ApiParam(name = "deviceId", value = "DeviceId which need to retrieve published events.") @ApiParam(name = "id", value = "Device Identifier to be need to retrieve events.", required = true)
@QueryParam("id") String deviceId);
@GET
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting Event Details for a Given Time Period.",
notes = "Get the event details of a device for a given time duration using this API.",
response = DeviceState.class,
responseContainer = "List"
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "event details of a device for a given time duration"),
@ApiResponse(code = 500, message = "Error occurred while getting published events for" +
" specific device on given Date.")
})
Response retrieveAlertFromDate(
@ApiParam(name = "id",
value = "Device Identifier to be need to retrieve events.")
@QueryParam("id") String deviceId, @QueryParam("id") String deviceId,
@ApiParam(name = "from", value = "From Date.") @ApiParam(name = "from", value = "From Date.")
@QueryParam("from") long from, @QueryParam("from") long from,
@ApiParam(name = "to", value = "To Date.") @ApiParam(name = "to", value = "To Date.")
@QueryParam("to") long to); @QueryParam("to") long to,
@GET
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Retrieves event details by type",
notes = "Get the event details of a device for a given time duration using this API.",
response = DeviceState.class,
responseContainer = "List"
)
@ApiResponses(value = {
@ApiResponse(code = 200, message = "event details of a device for a given time duration"),
@ApiResponse(code = 500, message = "Error occurred while getting published events for" +
" specific device on given Date.")
})
Response retrieveAlertByType(
@ApiParam(name = "id", value = "Device Identifier to be need to retrieve events.")
@QueryParam("id") String deviceId,
@ApiParam(name = "type", value = "Type of the Alert to be need to retrieve events.") @ApiParam(name = "type", value = "Type of the Alert to be need to retrieve events.")
@QueryParam("type") String type); @QueryParam("type") String type);

@ -40,7 +40,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List; import java.util.List;
@Path("/devices") @Path("/admin/devices")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService { public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService {
@ -54,40 +54,30 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android device lock operation"); log.debug("Invoking Android device lock operation");
} }
Message message = new Message();
Response response;
try { try {
DeviceLock lock = deviceLockBeanWrapper.getOperation(); DeviceLock lock = deviceLockBeanWrapper.getOperation();
if (lock == null) { if (lock == null) {
String errorMessage = "Lock bean is empty"; String errorMessage = "Lock bean is empty.";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCK); operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCK);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setEnabled(true); operation.setEnabled(true);
operation.setPayLoad(lock.toJSON()); operation.setPayLoad(lock.toJSON());
response = AndroidAPIUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation, return AndroidAPIUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation);
message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
return response;
} }
@POST @POST
@ -95,60 +85,47 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
@Override @Override
public Response configureDeviceUnlock(List<String> deviceIDs) { public Response configureDeviceUnlock(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android device unlock operation"); log.debug("Invoking Android device unlock operation.");
} }
Message message = new Message();
Response response;
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK); operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
operation.setEnabled(true); operation.setEnabled(true);
response = AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message); return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
return response;
} }
@POST @POST
@Path("/get-location") @Path("/location")
@Override @Override
public Response getDeviceLocation(List<String> deviceIDs) { public Response getDeviceLocation(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android device location operation"); log.debug("Invoking Android device location operation.");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION); operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message); return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -157,29 +134,22 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
@Override @Override
public Response removePassword(List<String> deviceIDs) { public Response removePassword(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android clear password operation"); log.debug("Invoking Android clear password operation.");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD); operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance.";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -190,66 +160,53 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android Camera operation"); log.debug("Invoking Android Camera operation");
} }
Message message = new Message();
try { try {
Camera camera = cameraBeanWrapper.getOperation(); Camera camera = cameraBeanWrapper.getOperation();
if (camera == null) { if (camera == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the configure camera operation is incorrect.";
log.debug("The payload of the configure camera operation is incorrect"); log.error(errorMessage);
} return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
throw new OperationManagementException("Issue in creating a new camera instance");
} }
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.CAMERA); operation.setCode(AndroidConstants.OperationCodes.CAMERA);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
operation.setEnabled(camera.isEnabled()); operation.setEnabled(camera.isEnabled());
return AndroidAPIUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation);
return AndroidAPIUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation, message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@POST @POST
@Path("/get-device-info") @Path("/info")
@Override @Override
public Response getDeviceInformation(List<String> deviceIDs) { public Response getDeviceInformation(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking get Android device information operation"); log.debug("Invoking get Android device information operation");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO); operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message); return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -261,186 +218,149 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
log.debug("Invoking enterprise-wipe device operation"); log.debug("Invoking enterprise-wipe device operation");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE); operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@POST @POST
@Path("/wipe-devices") @Path("/wipe")
@Override @Override
public Response wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) { public Response wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android wipe-data device operation"); log.debug("Invoking Android wipe-data device operation");
} }
Message message = new Message();
try { try {
WipeData wipeData = wipeDataBeanWrapper.getOperation(); WipeData wipeData = wipeDataBeanWrapper.getOperation();
if (wipeData == null) { if (wipeData == null) {
throw new OperationManagementException("WipeData bean is empty"); String errorMessage = "WipeData bean is empty.";
log.error(errorMessage);
return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA); operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(wipeData.toJSON()); operation.setPayLoad(wipeData.toJSON());
return AndroidAPIUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation);
return AndroidAPIUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation, message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@POST @POST
@Path("/get-applications") @Path("/applications")
@Override @Override
public Response getApplications(List<String> deviceIDs) { public Response getApplications(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android getApplicationList device operation"); log.debug("Invoking Android getApplicationList device operation");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST); operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@POST @POST
@Path("/ring-devices") @Path("/ring")
@Override @Override
public Response ringDevice(List<String> deviceIDs) { public Response ringDevice(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android ring-device device operation"); log.debug("Invoking Android ring-device device operation");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING); operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message); return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@POST @POST
@Path("/reboot-devices") @Path("/reboot")
@Override @Override
public Response rebootDevice(List<String> deviceIDs) { public Response rebootDevice(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android reboot-device device operation"); log.debug("Invoking Android reboot-device device operation");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT); operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message); return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@POST @POST
@Path("/mute-devices") @Path("/mute")
@Override @Override
public Response muteDevice(List<String> deviceIDs) { public Response muteDevice(List<String> deviceIDs) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking mute device operation"); log.debug("Invoking mute device operation");
} }
Message message = new Message();
try { try {
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE); operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
operation.setEnabled(true); operation.setEnabled(true);
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message); return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -451,41 +371,30 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking 'InstallApplication' operation"); log.debug("Invoking 'InstallApplication' operation");
} }
Message message = new Message();
try { try {
ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation(); ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation();
if (applicationInstallation == null) { if (applicationInstallation == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the application installing operation is incorrect";
log.debug("The payload of the application installing operation is incorrect");
}
String errorMessage = "Issue in creating a new application installation instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.INSTALL_APPLICATION); operation.setCode(AndroidConstants.OperationCodes.INSTALL_APPLICATION);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(applicationInstallation.toJSON()); operation.setPayLoad(applicationInstallation.toJSON());
return AndroidAPIUtils.getOperationResponse(applicationInstallationBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(applicationInstallationBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -497,20 +406,13 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
log.debug("Invoking 'UpdateApplication' operation"); log.debug("Invoking 'UpdateApplication' operation");
} }
Message message = new Message();
try { try {
ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation(); ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation();
if (applicationUpdate == null) { if (applicationUpdate == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the application update operation is incorrect";
log.debug("The payload of the application update operation is incorrect");
}
String errorMessage = "Issue in creating a new application update instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -519,19 +421,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setPayLoad(applicationUpdate.toJSON()); operation.setPayLoad(applicationUpdate.toJSON());
return AndroidAPIUtils.getOperationResponse(applicationUpdateBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(applicationUpdateBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -543,20 +441,13 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
log.debug("Invoking 'UninstallApplication' operation"); log.debug("Invoking 'UninstallApplication' operation");
} }
Message message = new Message();
try { try {
ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation(); ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation();
if (applicationUninstallation == null) { if (applicationUninstallation == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the application uninstalling operation is incorrect";
log.debug("The payload of the application uninstalling operation is incorrect");
}
String errorMessage = "Issue in creating a new application uninstallation instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -565,19 +456,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setPayLoad(applicationUninstallation.toJSON()); operation.setPayLoad(applicationUninstallation.toJSON());
return AndroidAPIUtils.getOperationResponse(applicationUninstallationBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(applicationUninstallationBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -589,20 +476,13 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
log.debug("Invoking 'Blacklist-Applications' operation"); log.debug("Invoking 'Blacklist-Applications' operation");
} }
Message message = new Message();
try { try {
BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation(); BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation();
if (blacklistApplications == null) { if (blacklistApplications == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the blacklisting apps operation is incorrect";
log.debug("The payload of the blacklisting apps operation is incorrect");
}
String errorMessage = "Issue in creating a new blacklist applications instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -611,20 +491,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setPayLoad(blacklistApplications.toJSON()); operation.setPayLoad(blacklistApplications.toJSON());
return AndroidAPIUtils.getOperationResponse(blacklistApplicationsBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(blacklistApplicationsBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -635,20 +511,14 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android upgrade-firmware device operation"); log.debug("Invoking Android upgrade-firmware device operation");
} }
Message message = new Message();
try { try {
UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation(); UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation();
if (upgradeFirmware == null) { if (upgradeFirmware == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the upgrade firmware operation is incorrect";
log.debug("The payload of the upgrade firmware operation is incorrect");
}
String errorMessage = "Issue in creating a new upgrade firmware instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -656,19 +526,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(upgradeFirmware.toJSON()); operation.setPayLoad(upgradeFirmware.toJSON());
return AndroidAPIUtils.getOperationResponse(upgradeFirmwareBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(upgradeFirmwareBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -679,20 +545,14 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking Android VPN device operation"); log.debug("Invoking Android VPN device operation");
} }
Message message = new Message();
try { try {
Vpn vpn = vpnBeanWrapper.getOperation(); Vpn vpn = vpnBeanWrapper.getOperation();
if (vpn == null) { if (vpn == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the VPN operation is incorrect";
log.debug("The payload of the VPN operation is incorrect");
}
String errorMessage = "Issue in creating a new VPN instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -700,19 +560,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(vpn.toJSON()); operation.setPayLoad(vpn.toJSON());
return AndroidAPIUtils.getOperationResponse(vpnBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(vpnBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -723,42 +579,31 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking 'notification' operation"); log.debug("Invoking 'notification' operation");
} }
Message message = new Message();
try { try {
Notification notification = notificationBeanWrapper.getOperation(); Notification notification = notificationBeanWrapper.getOperation();
if (notification == null) { if (notification == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the notification operation is incorrect";
log.debug("The payload of the notification operation is incorrect");
}
String errorMessage = "Issue in creating a new notification instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.NOTIFICATION); operation.setCode(AndroidConstants.OperationCodes.NOTIFICATION);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(notification.toJSON()); operation.setPayLoad(notification.toJSON());
return AndroidAPIUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -769,20 +614,14 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking 'configure wifi' operation"); log.debug("Invoking 'configure wifi' operation");
} }
Message message = new Message();
try { try {
Wifi wifi = wifiBeanWrapper.getOperation(); Wifi wifi = wifiBeanWrapper.getOperation();
if (wifi == null) { if (wifi == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the wifi operation is incorrect";
log.debug("The payload of the wifi operation is incorrect");
}
String errorMessage = "Issue in creating a new Wifi instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -791,20 +630,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setPayLoad(wifi.toJSON()); operation.setPayLoad(wifi.toJSON());
return AndroidAPIUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -815,42 +650,31 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking 'encrypt' operation"); log.debug("Invoking 'encrypt' operation");
} }
Message message = new Message();
try { try {
DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation(); DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation();
if (deviceEncryption == null) { if (deviceEncryption == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the device encryption operation is incorrect";
log.debug("The payload of the device encryption operation is incorrect");
}
String errorMessage = "Issue in creating a new encryption instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
CommandOperation operation = new CommandOperation(); CommandOperation operation = new CommandOperation();
operation.setCode(AndroidConstants.OperationCodes.ENCRYPT_STORAGE); operation.setCode(AndroidConstants.OperationCodes.ENCRYPT_STORAGE);
operation.setType(Operation.Type.COMMAND); operation.setType(Operation.Type.COMMAND);
operation.setEnabled(deviceEncryption.isEncrypted()); operation.setEnabled(deviceEncryption.isEncrypted());
return AndroidAPIUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -862,42 +686,30 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
log.debug("Invoking 'change lock code' operation"); log.debug("Invoking 'change lock code' operation");
} }
Message message = new Message();
try { try {
LockCode lockCode = lockCodeBeanWrapper.getOperation(); LockCode lockCode = lockCodeBeanWrapper.getOperation();
if (lockCode == null) { if (lockCode == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the change lock code operation is incorrect";
log.debug("The payload of the change lock code operation is incorrect");
}
String errorMessage = "Issue in retrieving a new lock-code instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_CODE); operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_CODE);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(lockCode.toJSON()); operation.setPayLoad(lockCode.toJSON());
return AndroidAPIUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -908,20 +720,13 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking 'password policy' operation"); log.debug("Invoking 'password policy' operation");
} }
Message message = new Message();
try { try {
PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation(); PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation();
if (passcodePolicy == null) { if (passcodePolicy == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the change password policy operation is incorrect";
log.debug("The payload of the change password policy operation is incorrect");
}
String errorMessage = "Issue in creating a new Password policy instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
@ -930,20 +735,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
operation.setPayLoad(passcodePolicy.toJSON()); operation.setPayLoad(passcodePolicy.toJSON());
return AndroidAPIUtils.getOperationResponse(passwordPolicyBeanWrapper.getDeviceIDs(), return AndroidAPIUtils.getOperationResponse(passwordPolicyBeanWrapper.getDeviceIDs(),
operation, message); operation);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }
@ -954,42 +755,30 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Invoking 'webclip' operation"); log.debug("Invoking 'webclip' operation");
} }
Message message = new Message();
try { try {
WebClip webClip = webClipBeanWrapper.getOperation(); WebClip webClip = webClipBeanWrapper.getOperation();
if (webClip == null) { if (webClip == null) {
if (log.isDebugEnabled()) { String errorMessage = "The payload of the add webclip operation is incorrect";
log.debug("The payload of the add webclip operation is incorrect");
}
String errorMessage = "Issue in creating a new web clip instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage); log.error(errorMessage);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
} }
ProfileOperation operation = new ProfileOperation(); ProfileOperation operation = new ProfileOperation();
operation.setCode(AndroidConstants.OperationCodes.WEBCLIP); operation.setCode(AndroidConstants.OperationCodes.WEBCLIP);
operation.setType(Operation.Type.PROFILE); operation.setType(Operation.Type.PROFILE);
operation.setPayLoad(webClip.toJSON()); operation.setPayLoad(webClip.toJSON());
return AndroidAPIUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(), operation);
return AndroidAPIUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(),
operation, message);
} catch (OperationManagementException e) { } catch (OperationManagementException e) {
String errorMessage = "Issue in retrieving operation management service instance"; String errorMessage = "Issue in retrieving operation management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
String errorMessage = "Issue in retrieving device management service instance"; String errorMessage = "Issue in retrieving device management service instance";
message = Message.responseMessage(errorMessage).
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
log.error(errorMessage, e); log.error(errorMessage, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
} }
} }

@ -71,7 +71,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
} }
} }
@GET
@PUT
@Path("/{id}/pending-operations") @Path("/{id}/pending-operations")
@Override @Override
public Response getPendingOperations(@PathParam("id") String id, List<? extends Operation> resultOperations) { public Response getPendingOperations(@PathParam("id") String id, List<? extends Operation> resultOperations) {

@ -46,7 +46,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
@POST @POST
@Override @Override
public Response addConfiguration(PlatformConfiguration configuration) throws AndroidAgentException { public Response addConfiguration(PlatformConfiguration configuration){
Message responseMsg = new Message(); Message responseMsg = new Message();
String msg; String msg;
ConfigurationEntry licenseEntry = null; ConfigurationEntry licenseEntry = null;
@ -158,4 +158,24 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
return Response.status(Response.Status.CREATED).entity(responseMsg).build(); return Response.status(Response.Status.CREATED).entity(responseMsg).build();
} }
@GET
@Path("license")
@Produces("text/plain")
public Response getLicense() throws AndroidAgentException {
License license = null;
try {
license =
AndroidAPIUtils.getDeviceManagementService().getLicense(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
} catch (DeviceManagementException e) {
String msg = "Error occurred while retrieving the license configured for Android device enrolment";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
return Response.status(Response.Status.OK).entity((license == null) ? null : license.getText()).build();
}
} }

@ -42,7 +42,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
private static final Log log = LogFactory.getLog(EventReceiverServiceImpl.class); private static final Log log = LogFactory.getLog(EventReceiverServiceImpl.class);
@POST @POST
@Path("/publish-event") @Path("/publish")
@Override @Override
public Response publishEvents(EventBeanWrapper eventBeanWrapper) { public Response publishEvents(EventBeanWrapper eventBeanWrapper) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -71,7 +71,22 @@ public class EventReceiverServiceImpl implements EventReceiverService {
@GET @GET
@Override @Override
public Response retrieveAlert(@QueryParam("id") String deviceId) { public Response retrieveAlerts(@QueryParam("id") String deviceId, @QueryParam ("from") long from,
@QueryParam ("to") long to, @QueryParam("type") String type) {
if(from != 0l && to != 0l && deviceId != null) {
return retrieveAlertFromDate(deviceId, from, to);
} else if (deviceId != null && type != null) {
return retrieveAlertByType(deviceId, type);
} else if (deviceId != null) {
return retrieveAlert(deviceId);
} else {
return Response.status(Response.Status.BAD_REQUEST).entity("Request must contain the device identifier. " +
"Optionally, both from and to value should be present to get alerts between times.").build();
}
}
private Response retrieveAlert(String deviceId) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device Identifier."); log.debug("Retrieving events for given device Identifier.");
} }
@ -82,23 +97,18 @@ public class EventReceiverServiceImpl implements EventReceiverService {
deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
if (deviceStates == null) { if (deviceStates == null) {
message.setResponseCode("No any alerts are published for Device: " + deviceId + "."); message.setResponseCode("No any alerts are published for Device: " + deviceId + ".");
return Response.status(Response.Status.OK).entity(message).build(); return Response.status(Response.Status.NOT_FOUND).entity(message).build();
} else { } else {
return Response.status(Response.Status.OK).entity(deviceStates).build(); return Response.status(Response.Status.OK).entity(deviceStates).build();
} }
} catch (AnalyticsException e) { } catch (AnalyticsException e) {
String msg = "Error occurred while getting published events for specific " + String msg = "Error occurred while getting published events for specific device: " + deviceId + ".";
"Device: " + deviceId + ".";
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} }
} }
@GET private Response retrieveAlertFromDate(String deviceId, long from, long to) {
@Override
public Response retrieveAlertFromDate(@QueryParam("id") String deviceId, @QueryParam("from") long from,
@QueryParam("to") long to) {
String fromDate = String.valueOf(from); String fromDate = String.valueOf(from);
String toDate = String.valueOf(to); String toDate = String.valueOf(to);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
@ -113,7 +123,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
if (deviceStates == null) { if (deviceStates == null) {
message. message.
setResponseCode("No any alerts are published on given date for given Device: " + deviceId + "."); setResponseCode("No any alerts are published on given date for given Device: " + deviceId + ".");
return Response.status(Response.Status.OK).entity(message).build(); return Response.status(Response.Status.NOT_FOUND).entity(message).build();
} else { } else {
return Response.status(Response.Status.OK).entity(deviceStates).build(); return Response.status(Response.Status.OK).entity(deviceStates).build();
@ -126,9 +136,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
} }
} }
@GET private Response retrieveAlertByType(String deviceId, String type) {
@Override
public Response retrieveAlertByType(@QueryParam("id") String deviceId, @QueryParam("type") String type) {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Retrieving events for given device identifier and type."); log.debug("Retrieving events for given device identifier and type.");
} }
@ -140,7 +148,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
if (deviceStates == null) { if (deviceStates == null) {
message.setResponseCode("No any alerts are published for given Device: " + message.setResponseCode("No any alerts are published for given Device: " +
"" + deviceId + " on specific date."); "" + deviceId + " on specific date.");
return Response.status(Response.Status.OK).entity(message).build(); return Response.status(Response.Status.NOT_FOUND).entity(message).build();
} else { } else {
return Response.status(Response.Status.OK).entity(deviceStates).build(); return Response.status(Response.Status.OK).entity(deviceStates).build();

@ -47,6 +47,7 @@ import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManag
import org.wso2.carbon.device.mgt.core.search.mgt.impl.Utils; import org.wso2.carbon.device.mgt.core.search.mgt.impl.Utils;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.DeviceState;
import org.wso2.carbon.mdm.services.android.exception.BadRequestException;
import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException; import org.wso2.carbon.policy.mgt.common.monitor.PolicyComplianceException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
@ -114,12 +115,15 @@ public class AndroidAPIUtils {
return responseMediaType; return responseMediaType;
} }
public static Response getOperationResponse(List<String> deviceIDs, Operation operation, public static Response getOperationResponse(List<String> deviceIDs, Operation operation)
Message message)
throws DeviceManagementException, OperationManagementException { throws DeviceManagementException, OperationManagementException {
if (deviceIDs == null || deviceIDs.size() == 0) {
String errorMessage = "Device identifier list is empty";
log.error(errorMessage);
return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
}
AndroidDeviceUtils deviceUtils = new AndroidDeviceUtils(); AndroidDeviceUtils deviceUtils = new AndroidDeviceUtils();
DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs, message); DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs);
List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList(); List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList();
Activity activity = getDeviceManagementService().addOperation( Activity activity = getDeviceManagementService().addOperation(

@ -33,13 +33,7 @@ public class AndroidDeviceUtils {
private static final String COMMA_SEPARATION_PATTERN = ", "; private static final String COMMA_SEPARATION_PATTERN = ", ";
public DeviceIDHolder validateDeviceIdentifiers(List<String> deviceIDs, public DeviceIDHolder validateDeviceIdentifiers(List<String> deviceIDs) {
Message message) {
if (deviceIDs == null || deviceIDs.isEmpty()) {
message.setResponseMessage("Device identifier list is empty");
throw new BadRequestException(message);
}
List<String> errorDeviceIdList = new ArrayList<String>(); List<String> errorDeviceIdList = new ArrayList<String>();
List<DeviceIdentifier> validDeviceIDList = new ArrayList<DeviceIdentifier>(); List<DeviceIdentifier> validDeviceIDList = new ArrayList<DeviceIdentifier>();

@ -30,13 +30,7 @@
<PermissionConfiguration> <PermissionConfiguration>
<APIVersion></APIVersion> <APIVersion></APIVersion>
<!-- Operations management related permissions for admin --> <!-- Operations management related permissions for admin -->
<Permission>
<name>Get Pending Operation</name>
<path>/device-mgt/android/operations/poll</path>
<url>/operation/*</url>
<method>PUT</method>
<scope>emm_android_agent</scope>
</Permission>
<Permission> <Permission>
<name>Lock</name> <name>Lock</name>
@ -273,7 +267,7 @@
<Permission> <Permission>
<name>View license</name> <name>View license</name>
<path>/device-mgt/android/license/view</path> <path>/device-mgt/android/license/view</path>
<url>/device/license</url> <url>/configuration/license</url>
<method>GET</method> <method>GET</method>
<scope>emm_android_agent</scope> <scope>emm_android_agent</scope>
</Permission> </Permission>
@ -282,19 +276,51 @@
<Permission> <Permission>
<name>Enroll device</name> <name>Enroll device</name>
<path>/device-mgt/android/devices/enroll</path> <path>/device-mgt/android/devices/enroll</path>
<url>/enrollment</url> <url>/devices</url>
<method>POST</method> <method>POST</method>
<scope>emm_android_agent</scope> <scope>emm_android_agent</scope>
</Permission> </Permission>
<Permission> <Permission>
<name>Get Enrollment Status</name> <name>Devices related Operations</name>
<path>/device-mgt/android/devices/enroll</path> <path>/device-mgt/android/devices</path>
<url>/enrollment/*</url> <url>/devices/*</url>
<method>GET</method> <method>GET</method>
<scope>emm_android_agent</scope> <scope>emm_android_agent</scope>
</Permission> </Permission>
<Permission>
<name>Device is enrolled</name>
<path>/device-mgt/android/devices</path>
<url>/devices/*/status</url>
<method>GET</method>
<scope>emm_android_agent</scope>
</Permission>
<Permission>
<name>Devices related Operations</name>
<path>/device-mgt/android/devices/operations</path>
<url>/devices/*/pending-operations</url>
<method>PUT</method>
<scope>emm_android_agent</scope>
</Permission>
<Permission>
<name>Modify devices</name>
<path>/device-mgt/android/devices/operations</path>
<url>/devices/*</url>
<method>PUT</method>
<scope>emm_android_agent</scope>
</Permission>
<Permission>
<name>Delete devices</name>
<path>/device-mgt/android/devices/operations</path>
<url>/devices/*</url>
<method>DELETE</method>
<scope>emm_android_agent</scope>
</Permission>
<Permission> <Permission>
<name>Update Enrollment</name> <name>Update Enrollment</name>
<path>/device-mgt/android/devices/enroll</path> <path>/device-mgt/android/devices/enroll</path>

@ -43,9 +43,9 @@
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig"> <bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
<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="2.1"/> <property name="version" value="1.0"/>
<property name="host" value="localhost:9443"/> <property name="host" value="device-mgt.wso2.com"/>
<property name="basePath" value="/device-mgt/android/v2.1"/> <property name="basePath" value="/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"/>

Loading…
Cancel
Save