From f66aad9e0e4f2160534df3accf631aa1f4a3b6d3 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 13 May 2016 02:39:30 +0530 Subject: [PATCH 1/2] Adding swagger annotations --- .../android/bean/ApplicationInstallation.java | 2 +- .../android/bean/ApplicationUninstallation.java | 13 +++++++++++++ .../android/bean/BlacklistApplications.java | 7 +++++++ .../carbon/mdm/services/android/bean/Camera.java | 7 +++++++ 4 files changed, 28 insertions(+), 1 deletion(-) 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/bean/ApplicationInstallation.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationInstallation.java index c7583ad7a..b0ed37377 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationInstallation.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationInstallation.java @@ -30,7 +30,7 @@ import java.io.Serializable; description = "This class carries all information related to install application") public class ApplicationInstallation extends AndroidOperation implements Serializable { - @ApiModelProperty(name = "appIdentifier", value = "DeviceIdentifier", required = true) + @ApiModelProperty(name = "appIdentifier", value = "Application Identifier", required = true) private String appIdentifier; @ApiModelProperty(name = "type", value = "Application type(Enterprise/Web/public)", required = true) 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/bean/ApplicationUninstallation.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUninstallation.java index 5efb16a5b..a946eedc7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUninstallation.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/ApplicationUninstallation.java @@ -18,16 +18,29 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** * This class represents the information of uninstall application operation. */ +@ApiModel(value = "ApplicationUninstallation", + description = "This class carries all information related to application uninstallation.") public class ApplicationUninstallation extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "appIdentifier", value = "The package name of the application to be uninstalled.", required = true) private String appIdentifier; + + @ApiModelProperty(name = "type", value = "The type of the application. The following types of applications " + + "are supported: enterprise, public and webapp.", required = true) private String type; + + @ApiModelProperty(name = "url", value = "The URL of the application.", required = true) private String url; + + @ApiModelProperty(name = "name", value = "The name of the application.", required = true) private String name; public String getAppIdentifier() { 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/bean/BlacklistApplications.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java index c66dbe89a..665735b51 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java @@ -18,14 +18,21 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.List; /** * This class represents the blacklist applications information. */ +@ApiModel(value = "BlacklistApplications", + description = "This class represents the blacklist applications information.") public class BlacklistApplications extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "appIdentifiers", value = "A list of application package names to be blacklisted.", + required = true) private List appIdentifiers; public List getAppIdentifier() { 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/bean/Camera.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Camera.java index 77c0773c1..0dad70364 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Camera.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Camera.java @@ -18,13 +18,20 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** * This class represents the information of camera operation. */ +@ApiModel(value = "Camera", + description = "This class represents the information of camera operation.") public class Camera extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "enabled", value = "Disable the camera on the device by assigning false as the value or " + + "enable the camera on the device to function by defining true as the value.", required = true) private boolean enabled; public boolean isEnabled() { From 0d8010c25aa7a9c91bbbd8eb979e75be58bd2e43 Mon Sep 17 00:00:00 2001 From: Madhawa Perera Date: Fri, 13 May 2016 02:43:23 +0530 Subject: [PATCH 2/2] Adding swagger annotations to beans --- .../services/android/bean/PasscodePolicy.java | 23 +++++++++++++++++++ .../mdm/services/android/bean/WebClip.java | 9 ++++++++ .../mdm/services/android/bean/Wifi.java | 8 +++++++ .../mdm/services/android/bean/WipeData.java | 5 ++++ 4 files changed, 45 insertions(+) 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/bean/PasscodePolicy.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/PasscodePolicy.java index 488d7a011..0b1f93743 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/PasscodePolicy.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/PasscodePolicy.java @@ -18,19 +18,42 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** * This class represents the information of setting up password policy. */ +@ApiModel(value = "PasscodePolicy", description = "This class represents the information of setting up " + + "password policy") public class PasscodePolicy extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "maxFailedAttempts", value = "The maximum number of times the end-user can enter" + + " his/her device passcode incorrectly. EMM will take different courses of action based on the" + + " OS when the failed attempts exceed the maximum failed attempts. Android devices will be " + + "automatically reset to the original factory settings", required = true) private int maxFailedAttempts; + @ApiModelProperty(name = "minLength", value = "The minimum number of alphanumerical values that the " + + "end-user can enter as his/her passcode", required = true) private int minLength; + @ApiModelProperty(name = "pinHistory", value = "The end-user will not be allowed to reuse a passcode that" + + " he/she previously entered until he/she exceeds the set pin history length", required = true) private int pinHistory; + @ApiModelProperty(name = "minComplexChars", value = "The minimum number of special characters that the " + + "end-user will have to enter in his/her passcode", required = true) private int minComplexChars; + @ApiModelProperty(name = "maxPINAgeInDays", value = "The number of days after which the device owner has" + + " to change his/her passcode", required = true) private int maxPINAgeInDays; + @ApiModelProperty(name = "requireAlphanumeric", value = "Whether or not it is mandatory for the end-user" + + " to have a mix of digits and characters in his/her passcode", required = true) private boolean requireAlphanumeric; + @ApiModelProperty(name = "allowSimple", value = "If this field is set to 'true', the device owner will be" + + " able to have a simple passcode and the following criteria in the passcode policy will not be" + + " applicable:\n" + + "Minimum length\n" + "Minimum complex characters", required = true) private boolean allowSimple; public int getMaxFailedAttempts() { 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/bean/WebClip.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WebClip.java index 8adf05b1d..cf39b1070 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WebClip.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WebClip.java @@ -18,15 +18,24 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** * This class represents the information of setting up webclip. */ +@ApiModel(value = "WebClip", description = "This class represents the information of setting up webclip") public class WebClip extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "identity", value = "The URL of the application", required = true) private String identity; + @ApiModelProperty(name = "title", value = "The name of the web application", required = true) private String title; + @ApiModelProperty(name = "type", value = "The type of the operation. Following are the possible operation" + + " types: install and uninstall. If the operation type is install, the web clip is added, and " + + "if the operation type is uninstall, the existing web clip is removed", required = true) private String type; public String getIdentity() { 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/bean/Wifi.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Wifi.java index aa0246c0a..8cdf3c58b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Wifi.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/Wifi.java @@ -18,14 +18,22 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** * This class represents the information of configuring wifi operation. */ +@ApiModel(value = "Wifi", description = "This class represents the information of configuring wifi operation") public class Wifi extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "ssid", value = "The name of the Wifi network that you wish to configure", + required = true) private String ssid; + @ApiModelProperty(name = "password", value = "The password to connect to the specified Wifi network", + required = true) private String password; public String getSsid() { 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/bean/WipeData.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WipeData.java index a3ce49c0b..83efddc12 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WipeData.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/WipeData.java @@ -18,13 +18,18 @@ package org.wso2.carbon.mdm.services.android.bean; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** * This class represents the information of wipedata operation. */ +@ApiModel(value = "WipeData", description = "This class represents the information of wipedata operation") public class WipeData extends AndroidOperation implements Serializable { + @ApiModelProperty(name = "pin", value = "PIN number to proceed with the data wipe", required = true) private String pin; public String getPin() {