mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Improving swagger annotations
This commit is contained in:
commit
631d57e70d
@ -18,10 +18,8 @@
|
||||
*/
|
||||
package org.wso2.carbon.mdm.services.android.services;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Activity;
|
||||
import org.wso2.carbon.mdm.services.android.bean.wrapper.*;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
@ -32,7 +30,8 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
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)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public interface DeviceManagementAdminService {
|
||||
@ -44,14 +43,18 @@ public interface DeviceManagementAdminService {
|
||||
httpMethod = "POST",
|
||||
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 " +
|
||||
"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 = {
|
||||
@ApiResponse(code = 200, message = "Lock operation has successfully been scheduled"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Lock operation has successfully been scheduled",
|
||||
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(
|
||||
@ApiParam(name = "cameraBeanWrapper",
|
||||
@ApiParam(name = "deviceLockBeanWrapper",
|
||||
value = "Device lock configurations with device IDs") DeviceLockBeanWrapper deviceLockBeanWrapper);
|
||||
|
||||
@POST
|
||||
@ -63,10 +66,12 @@ public interface DeviceManagementAdminService {
|
||||
responseContainer = "List",
|
||||
notes = "Using this API you have the option of unlocking an Android device, where the Administrator " +
|
||||
"unlocks the device",
|
||||
response = String.class)
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added unlock.", 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 configureDeviceUnlock(
|
||||
@ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation")
|
||||
@ -74,17 +79,19 @@ public interface DeviceManagementAdminService {
|
||||
|
||||
|
||||
@POST
|
||||
@Path("/get-location")
|
||||
@Path("/location")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Requesting Location Coordinates of Android Devices",
|
||||
responseContainer = "List",
|
||||
notes = "Request location coordinates of Android devices",
|
||||
response = String.class)
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Requested Device Coordinates"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")})
|
||||
@ApiResponse(code = 201, message = "Created \n Requested Device Coordinates", 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 getDeviceLocation(
|
||||
@ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location")
|
||||
List<String> deviceIDs);
|
||||
@ -95,11 +102,14 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully cleared password.", 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 removePassword(
|
||||
@ApiParam(name = "deviceIDs",
|
||||
@ -111,18 +121,22 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in creating a new camera instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Camera operation performed successfully.",
|
||||
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(
|
||||
@ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs")
|
||||
CameraBeanWrapper cameraBeanWrapper);
|
||||
|
||||
@POST
|
||||
@Path("/get-device-info")
|
||||
@Path("/info")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
@ -130,11 +144,15 @@ public interface DeviceManagementAdminService {
|
||||
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" +
|
||||
" 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 = {
|
||||
@ApiResponse(code = 200, message = "Device Information"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Device information request operation added.",
|
||||
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(
|
||||
@ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information")
|
||||
@ -148,33 +166,40 @@ public interface DeviceManagementAdminService {
|
||||
httpMethod = "POST",
|
||||
value = "Enterprise Wiping Android Devices",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance"
|
||||
@ApiResponse(code = 201, message = "Created \n Enterprise wipe operation added.",
|
||||
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);
|
||||
|
||||
@POST
|
||||
@Path("/wipe-devices")
|
||||
@Path("/wipe")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Factory Resetting an Android Device",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")})
|
||||
@ApiResponse(code = 201, message = "Created \n Added wipe operation", response = Activity.class),
|
||||
@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(
|
||||
@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);
|
||||
|
||||
@POST
|
||||
@Path("/get-applications")
|
||||
@Path("/applications")
|
||||
@ApiOperation(
|
||||
consumes = 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" +
|
||||
" 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 " +
|
||||
"on the device"
|
||||
"on the device",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "List of applications for specific deviceIdentifier"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n List of applications for specific deviceIdentifier",
|
||||
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(
|
||||
@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);
|
||||
|
||||
@POST
|
||||
@Path("/ring-devices")
|
||||
@Path("/ring")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Ringing Android Devices",
|
||||
notes = "Ring Android devices"
|
||||
notes = "Ring Android devices",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added ring operation.",
|
||||
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(
|
||||
@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
|
||||
@Path("/reboot-devices")
|
||||
@Path("/reboot")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Rebooting Android Devices",
|
||||
notes = "Reboot Android devices"
|
||||
notes = "Reboot Android devices",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added reboot operation.",
|
||||
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(
|
||||
@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
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Muting Android Devices",
|
||||
notes = "Mute Android devices"
|
||||
notes = "Mute Android devices",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added mute operation.",
|
||||
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(
|
||||
@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",
|
||||
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 " +
|
||||
"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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added install application operation.",
|
||||
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(
|
||||
@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",
|
||||
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 " +
|
||||
"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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added update application operation.",
|
||||
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(
|
||||
@ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs")
|
||||
@ -282,11 +331,15 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added uninstall application operation.",
|
||||
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(
|
||||
@ApiParam(name = "applicationUninstallationBeanWrapper",
|
||||
@ -300,14 +353,19 @@ public interface DeviceManagementAdminService {
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Get BlackListed Applications",
|
||||
notes = "Getting BlackListed Applications"
|
||||
notes = "Getting BlackListed Applications",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added blacklist application operation.",
|
||||
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(
|
||||
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications Configuration and DeviceIds")
|
||||
@ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " +
|
||||
"Configuration and DeviceIds")
|
||||
BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper);
|
||||
|
||||
@POST
|
||||
@ -317,11 +375,15 @@ public interface DeviceManagementAdminService {
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Upgrading device firmware",
|
||||
notes = "Device firmware upgrade"
|
||||
notes = "Device firmware upgrade",
|
||||
response = Activity.class,
|
||||
tags = "Android Device Management Administrative Service"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added firmware upgrade operation.",
|
||||
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(
|
||||
@ApiParam(name = "upgradeFirmwareBeanWrapper",
|
||||
@ -335,11 +397,15 @@ public interface DeviceManagementAdminService {
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added configure vpn operation.",
|
||||
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(
|
||||
@ApiParam(name = "vpnBeanWrapper",
|
||||
@ -352,11 +418,15 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added send notification operation.",
|
||||
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(
|
||||
@ApiParam(name = "notificationBeanWrapper",
|
||||
@ -369,11 +439,15 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added configure wifi operation.",
|
||||
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(
|
||||
@ApiParam(name = "wifiBeanWrapper",
|
||||
@ -385,11 +459,15 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added encrypt storage operation.",
|
||||
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(
|
||||
@ApiParam(name = "encryptionBeanWrapper",
|
||||
@ -402,11 +480,15 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "Created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added change lock code operation.",
|
||||
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(
|
||||
@ApiParam(name = "lockCodeBeanWrapper",
|
||||
@ -419,11 +501,15 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "created"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added set passcode policy operation.",
|
||||
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(
|
||||
@ApiParam(name = "passwordPolicyBeanWrapper",
|
||||
@ -436,11 +522,14 @@ public interface DeviceManagementAdminService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
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 = {
|
||||
@ApiResponse(code = 202, message = "Accepted"),
|
||||
@ApiResponse(code = 500, message = "Issue in retrieving device management service instance")
|
||||
@ApiResponse(code = 201, message = "Created \n Successfully added web clip operation."),
|
||||
@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(
|
||||
@ApiParam(name = "webClipBeanWrapper",
|
||||
|
||||
@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
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")
|
||||
@Path("/devices")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@ -38,14 +38,15 @@ public interface DeviceManagementService {
|
||||
@PUT
|
||||
@Path("/{id}/applications")
|
||||
@ApiOperation(
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "PUT",
|
||||
value = "Update the application list of a device"
|
||||
value = "Update the application list of a device",
|
||||
tags = "Android Device Management"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "OK. \n " +
|
||||
"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 " +
|
||||
"Sever error occurred while modifying the application list")
|
||||
})
|
||||
@ -57,14 +58,14 @@ public interface DeviceManagementService {
|
||||
@GET
|
||||
@Path("/{id}/pending-operations")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "PUT",
|
||||
httpMethod = "GET",
|
||||
value = "Get the operation list pending for the device",
|
||||
responseContainer = "List",
|
||||
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",
|
||||
response = Operation.class)
|
||||
response = Operation.class,
|
||||
tags = "Android Device Management")
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "OK. \n List of pending operations of the device is returned",
|
||||
responseHeaders = {
|
||||
@ -99,7 +100,8 @@ public interface DeviceManagementService {
|
||||
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," +
|
||||
" 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 = {
|
||||
@ApiResponse(code = 201, message = "Created. \n Device has successfully been enrolled. Location header " +
|
||||
@ -117,7 +119,8 @@ public interface DeviceManagementService {
|
||||
@ApiOperation(
|
||||
httpMethod = "GET",
|
||||
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 = {
|
||||
@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" +
|
||||
"Used by caches, or in conditional requests.")}),
|
||||
@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 " +
|
||||
"Server error occurred while retrieving the enrollment status of the device."),
|
||||
})
|
||||
@ -139,7 +148,8 @@ public interface DeviceManagementService {
|
||||
@ApiOperation(
|
||||
httpMethod = "PUT",
|
||||
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 = {
|
||||
@ApiResponse(code = 200, message = "OK. \n Device enrollment has been updated successfully",
|
||||
@ -173,7 +183,8 @@ public interface DeviceManagementService {
|
||||
@ApiOperation(
|
||||
httpMethod = "DELETE",
|
||||
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 = {
|
||||
@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.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")
|
||||
@Path("/configuration")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@ -37,25 +37,41 @@ public interface DeviceTypeConfigurationService {
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Configuring Android Platform Settings",
|
||||
notes = "Configure the Android platform settings using this REST API"
|
||||
value = "Configuring Android platform settings.",
|
||||
notes = "Configure the Android platform settings using this REST API.",
|
||||
tags = "Android Configuration Management"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Android platform configuration saved successfully"),
|
||||
@ApiResponse(code = 500, message = "Internal Server Error")
|
||||
@ApiResponse(code = 201, message = "Created. \n Android platform configuration saved successfully",
|
||||
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")
|
||||
PlatformConfiguration configuration) throws AndroidAgentException;
|
||||
Response addConfiguration(@ApiParam(name = "configuration",
|
||||
value = "Android platform related configurations that must be added.")
|
||||
PlatformConfiguration configuration);
|
||||
@GET
|
||||
@ApiOperation(
|
||||
httpMethod = "GET",
|
||||
value = "Getting Android Platform Configurations",
|
||||
notes = "Get the Android platform configuration details using this REST API",
|
||||
response = PlatformConfiguration.class
|
||||
response = PlatformConfiguration.class,
|
||||
tags = "Android Configuration Management"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Get Android Configurations"),
|
||||
@ApiResponse(code = 500, message = "Server Error")
|
||||
@ApiResponse(code = 200, message = "Get Android Configuration."),
|
||||
@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;
|
||||
|
||||
@ -64,15 +80,36 @@ public interface DeviceTypeConfigurationService {
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "PUT",
|
||||
value = "Updating Android Platform Configurations",
|
||||
notes = "Update the Android platform configurations using this REST API"
|
||||
value = "Updating Android Platform Configuration.",
|
||||
notes = "Update the Android platform configurations using this REST API.",
|
||||
tags = "Android Configuration Management"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "OK. \n Platform configuration has successfully been updated"),
|
||||
@ApiResponse(code = 500, message = "Error occurred while modifying configuration settings of " +
|
||||
"Android platform")
|
||||
@ApiResponse(code = 200, message = "Created. \n Configurations was updated successfully."),
|
||||
@ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."),
|
||||
@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")
|
||||
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;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.*;
|
||||
import org.wso2.carbon.mdm.services.android.bean.DeviceState;
|
||||
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.Response;
|
||||
|
||||
@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.")
|
||||
@Path("/events")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public interface EventReceiverService {
|
||||
|
||||
@POST
|
||||
@Path("/publish-event")
|
||||
@Path("/publish")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "POST",
|
||||
value = "Event Publishing via REST API.",
|
||||
notes = "Publish events received by the WSO2 EMM Android client to WSO2 DAS using this API."
|
||||
value = "Event publishing via REST API.",
|
||||
notes = "Publish events received by the EMM Android client to WSO2 DAS using this API.",
|
||||
tags = "Event Receiver"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Event is published successfully."),
|
||||
@ApiResponse(code = 500, message = "Error occurred while publishing the events from Android agent.")
|
||||
@ApiResponse(code = 201, message = "Created. \n Event is published successfully. Location header " +
|
||||
"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(
|
||||
@ApiParam(name = "eventBeanWrapper",
|
||||
value = "Information of the agent event to be published on DAS.")
|
||||
@ApiParam(name = "eventBeanWrapper", value = "Information of the agent event to be published on DAS.")
|
||||
EventBeanWrapper eventBeanWrapper);
|
||||
|
||||
@GET
|
||||
@ApiOperation(
|
||||
produces = MediaType.APPLICATION_JSON,
|
||||
httpMethod = "GET",
|
||||
value = "Getting Event Details of a Device.",
|
||||
notes = "Get the event details received by an Android device using this API.",
|
||||
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.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,
|
||||
responseContainer = "List"
|
||||
responseContainer = "List",
|
||||
tags = "Event Receiver"
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "List of Device statuses."),
|
||||
@ApiResponse(code = 500,
|
||||
message = "Error occurred while getting published events for specific given device.")
|
||||
@ApiResponse(code = 200, message = "Created \n Event details of a device for a given time duration",
|
||||
response = DeviceState.class, responseContainer = "List"),
|
||||
@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(
|
||||
@ApiParam(name = "deviceId", value = "DeviceId which need to retrieve published events.")
|
||||
@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.")
|
||||
Response retrieveAlerts(
|
||||
@ApiParam(name = "id", value = "Device Identifier to be need to retrieve events.", required = true)
|
||||
@QueryParam("id") String deviceId,
|
||||
@ApiParam(name = "from", value = "From Date.")
|
||||
@QueryParam("from") long from,
|
||||
@ApiParam(name = "to", value = "To Date.")
|
||||
@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,
|
||||
@QueryParam("to") long to,
|
||||
@ApiParam(name = "type", value = "Type of the Alert to be need to retrieve events.")
|
||||
@QueryParam("type") String type);
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
@Path("/devices")
|
||||
@Path("/admin/devices")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService {
|
||||
@ -54,40 +54,30 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android device lock operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
Response response;
|
||||
|
||||
try {
|
||||
DeviceLock lock = deviceLockBeanWrapper.getOperation();
|
||||
|
||||
if (lock == null) {
|
||||
String errorMessage = "Lock bean is empty";
|
||||
message = Message.responseMessage(errorMessage).
|
||||
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
|
||||
String errorMessage = "Lock bean is empty.";
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCK);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setEnabled(true);
|
||||
operation.setPayLoad(lock.toJSON());
|
||||
response = AndroidAPIUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation,
|
||||
message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceLockBeanWrapper.getDeviceIDs(), operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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
|
||||
@ -95,60 +85,47 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
@Override
|
||||
public Response configureDeviceUnlock(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android device unlock operation");
|
||||
log.debug("Invoking Android device unlock operation.");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
Response response;
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_UNLOCK);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
operation.setEnabled(true);
|
||||
response = AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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
|
||||
@Path("/get-location")
|
||||
@Path("/location")
|
||||
@Override
|
||||
public Response getDeviceLocation(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android device location operation");
|
||||
log.debug("Invoking Android device location operation.");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_LOCATION);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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
|
||||
public Response removePassword(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android clear password operation");
|
||||
log.debug("Invoking Android clear password operation.");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.CLEAR_PASSWORD);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
String errorMessage = "Issue in retrieving operation management service instance";
|
||||
message = Message.responseMessage(errorMessage).
|
||||
responseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()).build();
|
||||
String errorMessage = "Issue in retrieving operation management service instance.";
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking Android Camera operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
Camera camera = cameraBeanWrapper.getOperation();
|
||||
|
||||
if (camera == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("The payload of the configure camera operation is incorrect");
|
||||
}
|
||||
throw new OperationManagementException("Issue in creating a new camera instance");
|
||||
String errorMessage = "The payload of the configure camera operation is incorrect.";
|
||||
log.error(errorMessage);
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(errorMessage).build();
|
||||
}
|
||||
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.CAMERA);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
operation.setEnabled(camera.isEnabled());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation, message);
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(cameraBeanWrapper.getDeviceIDs(), operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/get-device-info")
|
||||
@Path("/info")
|
||||
@Override
|
||||
public Response getDeviceInformation(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking get Android device information operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_INFO);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.ENTERPRISE_WIPE);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/wipe-devices")
|
||||
@Path("/wipe")
|
||||
@Override
|
||||
public Response wipeData(WipeDataBeanWrapper wipeDataBeanWrapper) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android wipe-data device operation");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
WipeData wipeData = wipeDataBeanWrapper.getOperation();
|
||||
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.WIPE_DATA);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(wipeData.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation, message);
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(wipeDataBeanWrapper.getDeviceIDs(), operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/get-applications")
|
||||
@Path("/applications")
|
||||
@Override
|
||||
public Response getApplications(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android getApplicationList device operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.APPLICATION_LIST);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/ring-devices")
|
||||
@Path("/ring")
|
||||
@Override
|
||||
public Response ringDevice(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android ring-device device operation");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_RING);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/reboot-devices")
|
||||
@Path("/reboot")
|
||||
@Override
|
||||
public Response rebootDevice(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking Android reboot-device device operation");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_REBOOT);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message).build();
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build();
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/mute-devices")
|
||||
@Path("/mute")
|
||||
@Override
|
||||
public Response muteDevice(List<String> deviceIDs) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Invoking mute device operation");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
CommandOperation operation = new CommandOperation();
|
||||
operation.setCode(AndroidConstants.OperationCodes.DEVICE_MUTE);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
operation.setEnabled(true);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(deviceIDs, operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking 'InstallApplication' operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
ApplicationInstallation applicationInstallation = applicationInstallationBeanWrapper.getOperation();
|
||||
|
||||
if (applicationInstallation == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the application installing operation is incorrect";
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.INSTALL_APPLICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(applicationInstallation.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(applicationInstallationBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
ApplicationUpdate applicationUpdate = applicationUpdateBeanWrapper.getOperation();
|
||||
|
||||
if (applicationUpdate == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the application update operation is incorrect";
|
||||
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();
|
||||
@ -519,19 +421,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setPayLoad(applicationUpdate.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(applicationUpdateBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
ApplicationUninstallation applicationUninstallation = applicationUninstallationBeanWrapper.getOperation();
|
||||
|
||||
if (applicationUninstallation == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the application uninstalling operation is incorrect";
|
||||
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();
|
||||
@ -565,19 +456,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setPayLoad(applicationUninstallation.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(applicationUninstallationBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
BlacklistApplications blacklistApplications = blacklistApplicationsBeanWrapper.getOperation();
|
||||
|
||||
if (blacklistApplications == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the blacklisting apps operation is incorrect";
|
||||
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();
|
||||
@ -611,20 +491,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setPayLoad(blacklistApplications.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(blacklistApplicationsBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking Android upgrade-firmware device operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
UpgradeFirmware upgradeFirmware = upgradeFirmwareBeanWrapper.getOperation();
|
||||
|
||||
if (upgradeFirmware == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the upgrade firmware operation is incorrect";
|
||||
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();
|
||||
@ -656,19 +526,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(upgradeFirmware.toJSON());
|
||||
return AndroidAPIUtils.getOperationResponse(upgradeFirmwareBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking Android VPN device operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
Vpn vpn = vpnBeanWrapper.getOperation();
|
||||
|
||||
if (vpn == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the VPN operation is incorrect";
|
||||
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();
|
||||
@ -700,19 +560,15 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(vpn.toJSON());
|
||||
return AndroidAPIUtils.getOperationResponse(vpnBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking 'notification' operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
Notification notification = notificationBeanWrapper.getOperation();
|
||||
|
||||
if (notification == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the notification operation is incorrect";
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.NOTIFICATION);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(notification.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(notificationBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking 'configure wifi' operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
Wifi wifi = wifiBeanWrapper.getOperation();
|
||||
|
||||
if (wifi == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the wifi operation is incorrect";
|
||||
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();
|
||||
@ -791,20 +630,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setPayLoad(wifi.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(wifiBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking 'encrypt' operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
DeviceEncryption deviceEncryption = encryptionBeanWrapper.getOperation();
|
||||
|
||||
if (deviceEncryption == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the device encryption operation is incorrect";
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.ENCRYPT_STORAGE);
|
||||
operation.setType(Operation.Type.COMMAND);
|
||||
operation.setEnabled(deviceEncryption.isEncrypted());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(encryptionBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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");
|
||||
}
|
||||
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
LockCode lockCode = lockCodeBeanWrapper.getOperation();
|
||||
|
||||
if (lockCode == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the change lock code operation is incorrect";
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.CHANGE_LOCK_CODE);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(lockCode.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(lockCodeBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking 'password policy' operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
PasscodePolicy passcodePolicy = passwordPolicyBeanWrapper.getOperation();
|
||||
|
||||
if (passcodePolicy == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the change password policy operation is incorrect";
|
||||
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();
|
||||
@ -930,20 +735,16 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe
|
||||
operation.setPayLoad(passcodePolicy.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(passwordPolicyBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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()) {
|
||||
log.debug("Invoking 'webclip' operation");
|
||||
}
|
||||
Message message = new Message();
|
||||
|
||||
try {
|
||||
WebClip webClip = webClipBeanWrapper.getOperation();
|
||||
|
||||
if (webClip == null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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();
|
||||
String errorMessage = "The payload of the add webclip operation is incorrect";
|
||||
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();
|
||||
operation.setCode(AndroidConstants.OperationCodes.WEBCLIP);
|
||||
operation.setType(Operation.Type.PROFILE);
|
||||
operation.setPayLoad(webClip.toJSON());
|
||||
|
||||
return AndroidAPIUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(),
|
||||
operation, message);
|
||||
return AndroidAPIUtils.getOperationResponse(webClipBeanWrapper.getDeviceIDs(), operation);
|
||||
|
||||
} catch (OperationManagementException e) {
|
||||
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);
|
||||
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) {
|
||||
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);
|
||||
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")
|
||||
@Override
|
||||
public Response getPendingOperations(@PathParam("id") String id, List<? extends Operation> resultOperations) {
|
||||
|
||||
@ -46,7 +46,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
||||
|
||||
@POST
|
||||
@Override
|
||||
public Response addConfiguration(PlatformConfiguration configuration) throws AndroidAgentException {
|
||||
public Response addConfiguration(PlatformConfiguration configuration){
|
||||
Message responseMsg = new Message();
|
||||
String msg;
|
||||
ConfigurationEntry licenseEntry = null;
|
||||
@ -158,4 +158,24 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
||||
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);
|
||||
|
||||
@POST
|
||||
@Path("/publish-event")
|
||||
@Path("/publish")
|
||||
@Override
|
||||
public Response publishEvents(EventBeanWrapper eventBeanWrapper) {
|
||||
if (log.isDebugEnabled()) {
|
||||
@ -71,7 +71,22 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
||||
|
||||
@GET
|
||||
@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()) {
|
||||
log.debug("Retrieving events for given device Identifier.");
|
||||
}
|
||||
@ -82,23 +97,18 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
||||
deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query);
|
||||
if (deviceStates == null) {
|
||||
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 {
|
||||
return Response.status(Response.Status.OK).entity(deviceStates).build();
|
||||
}
|
||||
} catch (AnalyticsException e) {
|
||||
String msg = "Error occurred while getting published events for specific " +
|
||||
"Device: " + deviceId + ".";
|
||||
String msg = "Error occurred while getting published events for specific device: " + deviceId + ".";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Override
|
||||
public Response retrieveAlertFromDate(@QueryParam("id") String deviceId, @QueryParam("from") long from,
|
||||
@QueryParam("to") long to) {
|
||||
private Response retrieveAlertFromDate(String deviceId, long from, long to) {
|
||||
String fromDate = String.valueOf(from);
|
||||
String toDate = String.valueOf(to);
|
||||
if (log.isDebugEnabled()) {
|
||||
@ -113,7 +123,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
||||
if (deviceStates == null) {
|
||||
message.
|
||||
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 {
|
||||
return Response.status(Response.Status.OK).entity(deviceStates).build();
|
||||
@ -126,9 +136,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Override
|
||||
public Response retrieveAlertByType(@QueryParam("id") String deviceId, @QueryParam("type") String type) {
|
||||
private Response retrieveAlertByType(String deviceId, String type) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Retrieving events for given device identifier and type.");
|
||||
}
|
||||
@ -140,7 +148,7 @@ public class EventReceiverServiceImpl implements EventReceiverService {
|
||||
if (deviceStates == null) {
|
||||
message.setResponseCode("No any alerts are published for given Device: " +
|
||||
"" + deviceId + " on specific date.");
|
||||
return Response.status(Response.Status.OK).entity(message).build();
|
||||
return Response.status(Response.Status.NOT_FOUND).entity(message).build();
|
||||
|
||||
} else {
|
||||
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.service.DeviceManagementProviderService;
|
||||
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.core.PolicyManagerService;
|
||||
|
||||
@ -114,12 +115,15 @@ public class AndroidAPIUtils {
|
||||
return responseMediaType;
|
||||
}
|
||||
|
||||
public static Response getOperationResponse(List<String> deviceIDs, Operation operation,
|
||||
Message message)
|
||||
public static Response getOperationResponse(List<String> deviceIDs, Operation operation)
|
||||
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();
|
||||
DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs, message);
|
||||
DeviceIDHolder deviceIDHolder = deviceUtils.validateDeviceIdentifiers(deviceIDs);
|
||||
|
||||
List<DeviceIdentifier> validDeviceIds = deviceIDHolder.getValidDeviceIDList();
|
||||
Activity activity = getDeviceManagementService().addOperation(
|
||||
|
||||
@ -33,13 +33,7 @@ public class AndroidDeviceUtils {
|
||||
|
||||
private static final String COMMA_SEPARATION_PATTERN = ", ";
|
||||
|
||||
public DeviceIDHolder validateDeviceIdentifiers(List<String> deviceIDs,
|
||||
Message message) {
|
||||
|
||||
if (deviceIDs == null || deviceIDs.isEmpty()) {
|
||||
message.setResponseMessage("Device identifier list is empty");
|
||||
throw new BadRequestException(message);
|
||||
}
|
||||
public DeviceIDHolder validateDeviceIdentifiers(List<String> deviceIDs) {
|
||||
|
||||
List<String> errorDeviceIdList = new ArrayList<String>();
|
||||
List<DeviceIdentifier> validDeviceIDList = new ArrayList<DeviceIdentifier>();
|
||||
|
||||
@ -30,13 +30,7 @@
|
||||
<PermissionConfiguration>
|
||||
<APIVersion></APIVersion>
|
||||
<!-- 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>
|
||||
<name>Lock</name>
|
||||
@ -273,7 +267,7 @@
|
||||
<Permission>
|
||||
<name>View license</name>
|
||||
<path>/device-mgt/android/license/view</path>
|
||||
<url>/device/license</url>
|
||||
<url>/configuration/license</url>
|
||||
<method>GET</method>
|
||||
<scope>emm_android_agent</scope>
|
||||
</Permission>
|
||||
@ -282,19 +276,51 @@
|
||||
<Permission>
|
||||
<name>Enroll device</name>
|
||||
<path>/device-mgt/android/devices/enroll</path>
|
||||
<url>/enrollment</url>
|
||||
<url>/devices</url>
|
||||
<method>POST</method>
|
||||
<scope>emm_android_agent</scope>
|
||||
</Permission>
|
||||
|
||||
<Permission>
|
||||
<name>Get Enrollment Status</name>
|
||||
<path>/device-mgt/android/devices/enroll</path>
|
||||
<url>/enrollment/*</url>
|
||||
<name>Devices related Operations</name>
|
||||
<path>/device-mgt/android/devices</path>
|
||||
<url>/devices/*</url>
|
||||
<method>GET</method>
|
||||
<scope>emm_android_agent</scope>
|
||||
</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>
|
||||
<name>Update Enrollment</name>
|
||||
<path>/device-mgt/android/devices/enroll</path>
|
||||
|
||||
@ -43,9 +43,9 @@
|
||||
|
||||
<bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
|
||||
<property name="resourcePackage" value="org.wso2.carbon.mdm.services.android.services"/>
|
||||
<property name="version" value="2.1"/>
|
||||
<property name="host" value="localhost:9443"/>
|
||||
<property name="basePath" value="/device-mgt/android/v2.1"/>
|
||||
<property name="version" value="1.0"/>
|
||||
<property name="host" value="device-mgt.wso2.com"/>
|
||||
<property name="basePath" value="/device-mgt/android/v1.0"/>
|
||||
<property name="title" value="Android Device Management API Definitions"/>
|
||||
<property name="contact" value="dev@wso2.org"/>
|
||||
<property name="license" value="Apache 2.0"/>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user