From 63bb616e9c929ada50d9e9901121514a906244ae Mon Sep 17 00:00:00 2001 From: prabathabey Date: Sat, 28 May 2016 08:12:10 +0530 Subject: [PATCH] Improving swagger annotations --- .../DeviceManagementAdminService.java | 956 ++++++++++++++++-- .../services/DeviceManagementService.java | 284 ++++-- .../DeviceTypeConfigurationService.java | 150 ++- .../services/EventReceiverService.java | 122 ++- .../impl/DeviceManagementServiceImpl.java | 6 +- .../DeviceTypeConfigurationServiceImpl.java | 53 +- .../impl/EventReceiverServiceImpl.java | 7 +- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 2 +- 8 files changed, 1281 insertions(+), 299 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index ad473d8d7..3e504e52c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -48,10 +48,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Device lock operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new lock operation.") }) Response configureDeviceLock( @ApiParam(name = "deviceLockBeanWrapper", @@ -69,9 +101,42 @@ public interface DeviceManagementAdminService { response = Activity.class, tags = "Android Device Management Administrative Service") @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Device un-lock operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new un-lock operation.") }) Response configureDeviceUnlock( @ApiParam(name = "deviceIDs", value = "DeviceIds to be enable device unlock operation") @@ -89,9 +154,42 @@ public interface DeviceManagementAdminService { response = Activity.class, tags = "Android Device Management Administrative Service") @ApiResponses(value = { - @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.")}) + @ApiResponse( + code = 201, + message = "Created. \n Get-location operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new get-location operation.")}) Response getDeviceLocation( @ApiParam(name = "deviceIDs", value = "DeviceIDs to be requested to get device location") List deviceIDs); @@ -107,9 +205,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Clear password operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new clear password operation.") }) Response removePassword( @ApiParam(name = "deviceIDs", @@ -126,10 +257,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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") + @ApiResponse( + code = 201, + message = "Created. \n Control camera operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new control camera operation.") }) Response configureCamera( @ApiParam(name = "cameraBeanWrapper", value = "Camera enable/disable configurations with device IDs") @@ -149,10 +312,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Device info operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device info operation.") }) Response getDeviceInformation( @ApiParam(name = "deviceIds", value = "Device IDs to be requested to get device information") @@ -171,11 +366,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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." - )}) + @ApiResponse( + code = 201, + message = "Created. \n Enterprise wipe operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a enterprise wipe operation.")}) Response wipeDevice(@ApiParam(name = "deviceIDs", value = "Device IDs to be requested to do enterprise-wipe") List deviceIDs); @@ -191,9 +417,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.")}) + @ApiResponse( + code = 201, + message = "Created. \n Device wipe operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a device wipe operation.")}) Response wipeData( @ApiParam(name = "wipeDataBeanWrapper", value = "Configurations and DeviceIds needed to do wipe-data") WipeDataBeanWrapper wipeDataBeanWrapper); @@ -213,10 +472,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Get-applications operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new get-applications operation.") }) Response getApplications( @ApiParam(name = "deviceIDs", value = "Device Ids needed to get applications that are already installed") @@ -233,10 +524,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Device ring operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device ring operation.") }) Response ringDevice( @ApiParam(name = "deviceIDs", value = "Device Ids needed for ring") List deviceIDs); @@ -252,10 +575,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Device reboot operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device reboot operation.") }) Response rebootDevice( @ApiParam(name = "deviceIDs", value = "Device Ids needed for reboot.") List deviceIDs); @@ -270,10 +625,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Device mute operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new device mute operation.") }) @Path("/mute") Response muteDevice( @@ -293,10 +680,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Install application operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new install-application operation.") }) Response installApplication( @ApiParam(name = "applicationInstallationBeanWrapper", value = "Properties of installed apps and device IDs") @@ -316,10 +735,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Update-application operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new update-application operation.") }) Response updateApplication( @ApiParam(name = "applicationUpdateBeanWrapper", value = "Properties of updated apps and device IDs") @@ -336,10 +787,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Uninstall-application operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new uninstall-application operation.") }) Response uninstallApplication( @ApiParam(name = "applicationUninstallationBeanWrapper", @@ -358,10 +841,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Blacklist-applications operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new blacklist-applications operation.") }) Response blacklistApplications( @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " + @@ -380,10 +895,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Upgrade firmware operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new upgrade firmware operation.") }) Response upgradeFirmware( @ApiParam(name = "upgradeFirmwareBeanWrapper", @@ -402,10 +949,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Configure VPN operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new configure VPN operation.") }) Response configureVPN( @ApiParam(name = "vpnBeanWrapper", @@ -423,10 +1002,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Send notification operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new send notification operation.") }) Response sendNotification( @ApiParam(name = "notificationBeanWrapper", @@ -444,10 +1055,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Configure wifi operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new configure wifi operation.") }) Response configureWifi( @ApiParam(name = "wifiBeanWrapper", @@ -464,10 +1107,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Encrypt storage operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new encrypt storage operation.") }) Response encryptStorage( @ApiParam(name = "encryptionBeanWrapper", @@ -485,10 +1160,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Change lock code operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new change lock code operation.") }) Response changeLockCode( @ApiParam(name = "lockCodeBeanWrapper", @@ -506,10 +1213,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Set password policy operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new set password policy operation.") }) Response setPasswordPolicy( @ApiParam(name = "passwordPolicyBeanWrapper", @@ -527,9 +1266,42 @@ public interface DeviceManagementAdminService { tags = "Android Device Management Administrative Service" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 201, + message = "Created. \n Set webclip operation has successfully been scheduled", + response = Activity.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the activity instance that refers to the scheduled operation."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new set webclip operation.") }) Response setWebClip( @ApiParam(name = "webClipBeanWrapper", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java index fb80be7b1..d403581b9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementService.java @@ -45,15 +45,47 @@ public interface DeviceManagementService { tags = "Android Device Management" ) @ApiResponses(value = { - @ApiResponse(code = 200, message = "OK. \n " + - "Application list of the device has successfully been updated"), - @ApiResponse(code = 500, message = "Internal Server Error. \n " + - "Sever error occurred while modifying the application list") + @ApiResponse( + code = 200, + message = "OK. \n Application list has been updated successfully", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The URL of the updated application list."), + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while updating the application list.") }) - Response updateApplicationList(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id, - @ApiParam(name = "applications", value = "List of applications that need to be " + - "persisted against the device") - List applications); + Response updateApplicationList( + @ApiParam( + name = "id", + value = "Device Identifier") + @PathParam("id") String id, + @ApiParam( + name = "applications", + value = "List of applications that need to be persisted against the device") + List applications); @GET @Path("/{id}/pending-operations") @@ -67,33 +99,52 @@ public interface DeviceManagementService { response = Operation.class, tags = "Android Device Management") @ApiResponses(value = { - @ApiResponse(code = 200, message = "OK. \n List of pending operations of the device is returned", + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched the pending application list of the Android device.", + response = Operation.class, + responseContainer = "List", responseHeaders = { - @ResponseHeader(name = "Content-Type", description = "The content type of the body"), - @ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader(name = "Last-Modified", + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", description = "Date and time the resource has been modified the last time.\n" + - "Used by caches, or in conditional requests.")}), - @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."), - @ApiResponse(code = 404, message = "Not Found. \n Requested device not found."), - @ApiResponse(code = 406, message = "Not Acceptable. \n The requested media type is not supported."), - @ApiResponse(code = 500, message = "Internal Server Error. \n " + - "Server error occurred while retrieving the pending operation list of the device.") + "Used by caches, or in conditional requests.") + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching policies.") }) Response getPendingOperations( - @ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id, - @ApiParam(name = "resultOperations", value = "Device Operation Status") + @ApiParam( + name = "id", + value = "Device Identifier") + @PathParam("id") String id, + @ApiParam( + name = "If-Modified-Since", + value = "Validates if the requested variant has not been modified since the time specified", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince, + @ApiParam( + name = "resultOperations", + value = "Device Operation Status") List resultOperations); @POST @ApiOperation( + produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", value = "Register an Android Device", @@ -104,13 +155,41 @@ public interface DeviceManagementService { tags = "Android Device Management" ) @ApiResponses(value = { - @ApiResponse(code = 201, message = "Created. \n Device has successfully been enrolled. Location header " + - "contains URL of newly enrolled device", + @ApiResponse( + code = 201, + message = "Created. \n Device enrollment has successfully been created", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the added device enrollment."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", responseHeaders = { - @ResponseHeader(name = "Location", description = "URL of the device enrolled")}), - @ApiResponse(code = 400, message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse(code = 500, message = "Internal Server Error. \n " + - "Server error occurred while enrolling the device.") + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while adding a new policy.") }) Response enrollDevice(@ApiParam(name = "device", value = "Device Information to be enroll") Device device); @@ -123,25 +202,42 @@ public interface DeviceManagementService { tags = "Android Device Management" ) @ApiResponses(value = { - @ApiResponse(code = 200, message = "Device has already enrolled", + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched the status of the Android device enrollment.", responseHeaders = { - @ResponseHeader(name = "Content-Type", description = "The content type of the body"), - @ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader(name = "Last-Modified", + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", 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."), + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching the enrollment status of the Android device.") }) - Response isEnrolled(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id); + Response isEnrolled( + @ApiParam( + name = "id", + value = "Device Identifier") + @PathParam("id") String id, + @ApiParam( + name = "If-Modified-Since", + value = "Validates if the requested variant has not been modified since the time specified", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince); @PUT @Path("/{id}") @@ -151,47 +247,73 @@ public interface DeviceManagementService { 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", - responseHeaders = { - @ResponseHeader(name = "Content-Location", description = "The URL of the updated device."), - @ResponseHeader(name = "Content-Type", description = "The content type of the body"), - @ResponseHeader(name = "ETag", description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader(name = "Last-Modified", - description = "Date and time the resource has been modified the last time.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 204, - message = "No Content. \n Enrollment of the device has not been updated"), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 404, - message = "Not Found. \n Resource to be deleted does not exist."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while modifying the current enrollment of the device.") - }) - Response modifyEnrollment(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id, - @ApiParam(name = "device", value = "Device information to be modify") Device device); + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Device enrollment has been updated successfully", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the updated device enrollment."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while updating the device enrollment.") + }) + Response modifyEnrollment( + @ApiParam( + name = "id", + value = "Device Identifier") + @PathParam("id") String id, + @ApiParam( + name = "device", + value = "Device information to be modify") Device device); @DELETE @Path("/{id}") @ApiOperation( httpMethod = "DELETE", - value = "Un-registering an Android Device", + value = "Un-register an 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"), - @ApiResponse(code = 404, message = "Not Found. \n Device requested to be dis-enrolled does not exist."), - @ApiResponse(code = 500, message = "Internal Server Error. \n " + - "Server error occurred while dis-enrolling the the device."), + @ApiResponse( + code = 200, + message = "OK. \n Device has successfully been dis-enrolled"), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while dis-enrolling the device.") }) - Response disEnrollDevice(@ApiParam(name = "id", value = "Device Identifier") @PathParam("id") String id); + Response disEnrollDevice( + @ApiParam( + name = "id", + value = "Device Identifier") + @PathParam("id") String id); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java index f13b4a4a3..7d74b700d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceTypeConfigurationService.java @@ -33,28 +33,9 @@ import javax.ws.rs.core.Response; @Consumes(MediaType.APPLICATION_JSON) public interface DeviceTypeConfigurationService { - @POST - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Configuring Android platform settings.", - notes = "Configure the Android platform settings using this REST API.", - tags = "Android Configuration Management" - ) - @ApiResponses(value = { - @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 = "Android platform related configurations that must be added.") - PlatformConfiguration configuration); @GET @ApiOperation( + produces = MediaType.APPLICATION_JSON, httpMethod = "GET", value = "Getting Android Platform Configurations", notes = "Get the Android platform configuration details using this REST API", @@ -62,18 +43,42 @@ public interface DeviceTypeConfigurationService { tags = "Android Configuration Management" ) @ApiResponses(value = { - @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.", + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched Android platform configuration.", + response = PlatformConfiguration.class, 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.") + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching Android platform configuration.") }) - Response getConfiguration() throws AndroidAgentException; + Response getConfiguration( + @ApiParam( + name = "If-Modified-Since", + value = "Validates if the requested variant has not been modified since the time specified", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince); @PUT @ApiOperation( @@ -85,20 +90,48 @@ public interface DeviceTypeConfigurationService { tags = "Android Configuration Management" ) @ApiResponses(value = { - @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.") + @ApiResponse( + code = 200, + message = "OK. \n Android platform configuration has been updated successfully", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "URL of the updated Android platform configuration."), + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while modifying Android platform configuration.") }) - Response updateConfiguration(@ApiParam(name = "configuration", value = "AndroidPlatformConfiguration") - PlatformConfiguration configuration) throws AndroidAgentException; + Response updateConfiguration( + @ApiParam(name = "configuration", + value = "AndroidPlatformConfiguration") + PlatformConfiguration configuration); @GET @Path("license") - @Produces("text/plain") + @Produces(MediaType.TEXT_PLAIN) @ApiOperation( - produces = MediaType.APPLICATION_JSON, + produces = MediaType.TEXT_PLAIN, 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 " + @@ -106,10 +139,41 @@ public interface DeviceTypeConfigurationService { 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") + @ApiResponse( + code = 200, + message = "OK. \n Successfully fetched Android license configuration.", + response = PlatformConfiguration.class, + responseHeaders = { + @ResponseHeader( + name = "Content-Type", + description = "Content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests."), + }), + @ApiResponse( + code = 304, + message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."), + @ApiResponse( + code = 404, + message = "Not Found. \n Resource to be deleted does not exist."), + @ApiResponse( + code = 406, + message = "Not Acceptable.\n The requested media type is not supported"), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n Server error occurred while fetching Android license configuration.") }) - Response getLicense() throws AndroidAgentException; + Response getLicense( + @ApiParam( + name = "If-Modified-Since", + value = "Validates if the requested variant has not been modified since the time specified", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince) throws AndroidAgentException; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java index a86e69a12..7dc619cd8 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java @@ -35,24 +35,55 @@ public interface EventReceiverService { @POST @Path("/publish") @ApiOperation( + produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, httpMethod = "POST", 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 = 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.") - }) + @ApiResponses( + value = { + @ApiResponse(code = 201, message = "Created. \n Event is published successfully. Location header " + + "contains URL of newly enrolled device", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The URL of the added policy."), + @ResponseHeader( + name = "Content-Type", + description = "The content type of the body"), + @ResponseHeader( + name = "ETag", + description = "Entity Tag of the response resource.\n" + + "Used by caches, or in conditional requests."), + @ResponseHeader( + name = "Last-Modified", + description = "Date and time the resource has been modified the last time.\n" + + "Used by caches, or in conditional requests.") + }), + @ApiResponse( + code = 303, + message = "See Other. \n Source can be retrieved from the URL specified at the Location header.", + responseHeaders = { + @ResponseHeader( + name = "Content-Location", + description = "The Source URL of the document.")}), + @ApiResponse( + code = 400, + message = "Bad Request. \n Invalid request or validation error."), + @ApiResponse( + code = 415, + message = "Unsupported media type. \n The entity of the request was in a not supported format."), + @ApiResponse( + code = 500, + message = "Internal Server Error. \n " + + "Server error occurred while publishing events.") + }) 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 @@ -68,30 +99,57 @@ public interface EventReceiverService { responseContainer = "List", tags = "Event Receiver" ) - @ApiResponses(value = { - @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.") - }) + @ApiResponses( + value = { + @ApiResponse( + code = 200, + message = "OK. \n Event details of a device for a given time duration have been successfully fetched", + 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 = "Content-Location", description = "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 retrieveAlerts( - @ApiParam(name = "id", value = "Device Identifier to be need to retrieve events.", required = true) + @ApiParam( + name = "id", + value = "Device Identifier to be need to retrieve events.", + required = true) @QueryParam("id") String deviceId, - @ApiParam(name = "from", value = "From Date.") + @ApiParam( + name = "from", + value = "From Date.") @QueryParam("from") long from, - @ApiParam(name = "to", value = "To Date.") + @ApiParam( + name = "to", + value = "To Date.") @QueryParam("to") long to, - @ApiParam(name = "type", value = "Type of the Alert to be need to retrieve events.") - @QueryParam("type") String type); + @ApiParam( + name = "type", + value = "Type of the Alert to be need to retrieve events.") + @QueryParam("type") String type, + @ApiParam( + name = "If-Modified-Since", + value = "Validates if the requested variant has not been modified since the time specified", + required = false) + @HeaderParam("If-Modified-Since") String ifModifiedSince); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java index 35a03a399..3c5f4a5f3 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementServiceImpl.java @@ -76,7 +76,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @PUT @Path("/{id}/pending-operations") @Override - public Response getPendingOperations(@PathParam("id") String id, List resultOperations) { + public Response getPendingOperations(@PathParam("id") String id, + @HeaderParam("If-Modified-Since") String ifModifiedSince, + List resultOperations) { if (id == null || id.isEmpty()) { String msg = "Device identifier is null or empty, hence returning device not found"; log.error(msg); @@ -189,7 +191,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @GET @Path("/{id}/status") @Override - public Response isEnrolled(@PathParam("id") String id) { + public Response isEnrolled(@PathParam("id") String id, @HeaderParam("If-Modified-Since") String ifModifiedSince) { boolean result; DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); try { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java index 4cc359456..f20e31f4d 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceTypeConfigurationServiceImpl.java @@ -43,51 +43,13 @@ import java.util.List; public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurationService { private static final Log log = LogFactory.getLog(DeviceTypeConfigurationServiceImpl.class); - - @POST - @Override - public Response addConfiguration(PlatformConfiguration configuration){ - Message responseMsg = new Message(); - String msg; - ConfigurationEntry licenseEntry = null; - try { - configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - List configs = configuration.getConfiguration(); - for (ConfigurationEntry entry : configs) { - if (AndroidConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { - License license = new License(); - license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - license.setLanguage(AndroidConstants.TenantConfigProperties.LANGUAGE_US); - license.setVersion("1.0.0"); - license.setText(entry.getValue().toString()); - AndroidAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, license); - licenseEntry = entry; - break; - } - } - - if (licenseEntry != null) { - configs.remove(licenseEntry); - } - configuration.setConfiguration(configs); - AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration); - Response.status(Response.Status.CREATED); - responseMsg.setResponseMessage("Android platform configuration saved successfully."); - responseMsg.setResponseCode(Response.Status.CREATED.toString()); - } catch (DeviceManagementException e) { - msg = "Error occurred while configuring the android platform"; - log.error(msg, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - return Response.status(Response.Status.CREATED).entity(responseMsg).build(); - } @GET @Override - public Response getConfiguration() throws AndroidAgentException { + public Response getConfiguration( + @HeaderParam("If-Modified-Since") String ifModifiedSince) { String msg; - PlatformConfiguration PlatformConfiguration = null; + PlatformConfiguration PlatformConfiguration; List configs; try { PlatformConfiguration = AndroidAPIUtils.getDeviceManagementService(). @@ -121,7 +83,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati @PUT @Override - public Response updateConfiguration(PlatformConfiguration configuration) throws AndroidAgentException { + public Response updateConfiguration(PlatformConfiguration configuration) { String msg; Message responseMsg = new Message(); ConfigurationEntry licenseEntry = null; @@ -161,9 +123,10 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati @GET @Path("license") - @Produces("text/plain") - public Response getLicense() throws AndroidAgentException { - License license = null; + @Produces(MediaType.TEXT_PLAIN) + public Response getLicense( + @HeaderParam("If-Modified-Since") String ifModifiedSince) { + License license; try { license = diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java index e1015ca6d..e93dfbee9 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java @@ -71,10 +71,11 @@ public class EventReceiverServiceImpl implements EventReceiverService { @GET @Override - public Response retrieveAlerts(@QueryParam("id") String deviceId, @QueryParam ("from") long from, - @QueryParam ("to") long to, @QueryParam("type") String type) { + public Response retrieveAlerts(@QueryParam("id") String deviceId, @QueryParam("from") long from, + @QueryParam("to") long to, @QueryParam("type") String type, + @HeaderParam("If-Modified-Since") String ifModifiedSince) { - if(from != 0l && to != 0l && deviceId != null) { + if (from != 0l && to != 0l && deviceId != null) { return retrieveAlertFromDate(deviceId, from, to); } else if (deviceId != null && type != null) { return retrieveAlertByType(deviceId, type); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 20b48f434..3abaca367 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -45,7 +45,7 @@ - +