Adding swagger annotations to beans
4.x.x
Madhawa Perera 9 years ago
commit fca80273bc

@ -36,7 +36,8 @@ import javax.ws.rs.core.Response;
/** /**
* All the certificate related tasks such as saving certificates, can be done through this endpoint. * All the certificate related tasks such as saving certificates, can be done through this endpoint.
*/ */
@Api(value = "Certificate", description = "Certificate related tasks such as saving certificates") @Api(value = "Certificate", description = "Certificate related tasks such as saving certificates, " +
"can be done through this API")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
@Produces({ "application/json", "application/xml" }) @Produces({ "application/json", "application/xml" })
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })

@ -34,7 +34,9 @@ import javax.ws.rs.core.Response;
* General Tenant Configuration REST-API implementation. * General Tenant Configuration REST-API implementation.
* All end points support JSON, XMl with content negotiation. * All end points support JSON, XMl with content negotiation.
*/ */
@Api(value = "Configuration", description = "General Tenant Configuration implementation") @Api(value = "Configuration", description = "General Tenant Configuration management capabilities are exposed " +
"through " +
"this API")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
@Produces({ "application/json", "application/xml" }) @Produces({ "application/json", "application/xml" })
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })

@ -29,7 +29,8 @@ import javax.ws.rs.core.Response;
/** /**
* Device related operations such as get all the available devices, etc. * Device related operations such as get all the available devices, etc.
*/ */
@Api(value = "Devices")
@Api(value = "Device", description = "Device related operations such as get all the available devices, etc.")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
public interface Device { public interface Device {

@ -36,7 +36,8 @@ import javax.ws.rs.core.Response;
/** /**
* Device information related operations. * Device information related operations.
*/ */
@Api(value = "DeviceInfo")
@Api(value = "DeviceInformation", description = "Device information related operations can be found here.")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
public interface DeviceInformation { public interface DeviceInformation {

@ -40,7 +40,7 @@ import javax.ws.rs.core.Response;
* DeviceNotification management REST-API implementation. * DeviceNotification management REST-API implementation.
* All end points support JSON, XMl with content negotiation. * All end points support JSON, XMl with content negotiation.
*/ */
@Api(value = "DeviceNotification") @Api(value = "DeviceNotification", description = "Device notification related operations can be found here.")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
@Produces({"application/json", "application/xml"}) @Produces({"application/json", "application/xml"})
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })

@ -34,7 +34,8 @@ import javax.ws.rs.core.Response;
/** /**
* Device search related operations such as getting device information. * Device search related operations such as getting device information.
*/ */
@Api(value = "DeviceSearch")
@Api(value = "DeviceSearch", description = "Device searching related operations can be found here.")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
public interface DeviceSearch { public interface DeviceSearch {

@ -31,7 +31,8 @@ import javax.ws.rs.core.Response;
/** /**
* Features * Features
*/ */
@Api(value = "Feature")
@Api(value = "Feature", description = "Feature management related operations can be found here.")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
@Produces({"application/json", "application/xml"}) @Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"})

@ -37,7 +37,8 @@ import javax.ws.rs.core.Response;
/** /**
* *
*/ */
@Api(value = "Operation")
@Api(value = "Operation", description = "Operation management related operations can be found here.")
public interface Operation { public interface Operation {
/* @deprecated */ /* @deprecated */

@ -38,7 +38,8 @@ import java.util.List;
/** /**
* *
*/ */
@Api(value = "Policy")
@Api(value = "Policy", description = "Policy management related operations can be found here.")
public interface Policy { public interface Policy {
@POST @POST

@ -39,7 +39,7 @@ import java.util.List;
/** /**
* *
*/ */
@Api(value = "Role") @Api(value = "Role", description = "Role management related operations can be found here.")
public interface Role { public interface Role {
@GET @GET

@ -44,7 +44,7 @@ import java.util.List;
/** /**
* This represents the JAX-RS services of User related functionality. * This represents the JAX-RS services of User related functionality.
*/ */
@Api(value = "User") @Api(value = "User", description = "User management related operations can be found here.")
public interface User { public interface User {
@POST @POST

@ -18,14 +18,23 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import java.util.List; import java.util.List;
@ApiModel(value = "ApplicationWrapper", description = "Application details together with user, " +
"role or devices the application is associated with.")
public class ApplicationWrapper { public class ApplicationWrapper {
@ApiModelProperty(name = "userNameList", value = "List of user names.", required = true )
private List<String> userNameList; private List<String> userNameList;
@ApiModelProperty(name = "roleNameList", value = "List of role names.", required = true )
private List<String> roleNameList; private List<String> roleNameList;
@ApiModelProperty(name = "deviceIdentifiers", value = "List of device identifiers.", required = true )
private List<DeviceIdentifier> deviceIdentifiers; private List<DeviceIdentifier> deviceIdentifiers;
@ApiModelProperty(name = "application", value = "Details of the mobile application.", required = true )
private MobileApp application; private MobileApp application;
public MobileApp getApplication() { public MobileApp getApplication() {

@ -18,9 +18,19 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "EnrollmentCertificate", description = "Details of certificates used in enrollment.")
public class EnrollmentCertificate { public class EnrollmentCertificate {
@ApiModelProperty(name = "serial", value = "The unique ID used to identify a certificate. This is the devices " +
"serial number in case of mutual SSL is used for enrollment.",
required = true )
String serial; String serial;
@ApiModelProperty(name = "pem", value = "Case 64 encode .pem file content.", required = true )
String pem; String pem;
@ApiModelProperty(name = "tenantId", value = "The ID of the tenant who adds the certificate.", required = true )
int tenantId; int tenantId;
public int getTenantId() { public int getTenantId() {

@ -18,24 +18,51 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Properties; import java.util.Properties;
/** /**
* This class represents the generic mobile AuthenticationImpl information * This class represents the generic mobile AuthenticationImpl information
* which is used by AppM. * which is used by AppM.
*/ */
@ApiModel(value = "ApplicationWrapper", description = "Details of a mobile application.")
public class MobileApp { public class MobileApp {
@ApiModelProperty(name = "id", value = "Id of the app used internally.", required = true )
private String id; private String id;
@ApiModelProperty(name = "name", value = "The name of the application.", required = true )
private String name; private String name;
@ApiModelProperty(name = "type", value = "The type of the application. The following types of applications are " +
"supported: enterprise, public and webapp..", required = true )
private MobileAppTypes type; private MobileAppTypes type;
@ApiModelProperty(name = "platform", value = "Platform the app can be installed on .", required = true )
private String platform; private String platform;
@ApiModelProperty(name = "version", value = "Version of the application.", required = true )
private String version; private String version;
@ApiModelProperty(name = "identifier", value = "The package name of the application.", required = true )
private String identifier; private String identifier;
@ApiModelProperty(name = "iconImage", value = "Link to the icon of the app.", required = true )
private String iconImage; private String iconImage;
@ApiModelProperty(name = "packageName", value = "Define the exact name of the application package. You can use one " +
"of the following methods to get the package name.\n" +
"Go to the respective application in the play store and copy the" +
" ID or package name from the URL.\n" +
"Example: The play store application URL for the Viber app is " +
"https://play.google.com/store/apps/details?id=com.viber.voip&hl=en." +
" Therefore, the package name or " +
"the application ID is: id=com.viber.voip \n" +
"Download the System Info for Android to your device from the" +
" play store. \n" +
"Once the application is successfully installed go to the Tasks " +
"tab and you will see the package name under the respective " +
"application..", required = true )
private String packageName; private String packageName;
@ApiModelProperty(name = "appIdentifier", value = "The package name of the application.", required = true )
private String appIdentifier; private String appIdentifier;
private String location; private String location;
@ApiModelProperty(name = "properties", value = "List of meta data.", required = true )
private Properties properties; private Properties properties;
public MobileAppTypes getType() { public MobileAppTypes getType() {

@ -18,13 +18,20 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "UserCredentialWrapper", description = "User credentials are included in this class.")
public class UserCredentialWrapper { public class UserCredentialWrapper {
@ApiModelProperty(name = "username", value = "Username of the user.", required = true )
private String username; private String username;
/* /*
Base64 encoded password Base64 encoded password
*/ */
@ApiModelProperty(name = "oldPassword", value = "Old password of the user.", required = true )
private String oldPassword; private String oldPassword;
@ApiModelProperty(name = "newPassword", value = "New password of the user.", required = true )
private String newPassword; private String newPassword;
public String getNewPassword() { public String getNewPassword() {

@ -18,16 +18,26 @@
package org.wso2.carbon.device.mgt.jaxrs.beans; package org.wso2.carbon.device.mgt.jaxrs.beans;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "UserWrapper", description = "User details and the roles of the user.")
public class UserWrapper { public class UserWrapper {
private String username; private String username;
/* /*
Base64 encoded password Base64 encoded password
*/ */
@ApiModelProperty(name = "password", value = "Base64 encoded password.", required = true )
private String password; private String password;
@ApiModelProperty(name = "firstname", value = "The first name of the user.", required = true )
private String firstname; private String firstname;
@ApiModelProperty(name = "lastname", value = "The last name of the user.", required = true )
private String lastname; private String lastname;
@ApiModelProperty(name = "emailAddress", value = "The email address of the user.", required = true )
private String emailAddress; private String emailAddress;
@ApiModelProperty(name = "roles", value = "List of roles.", required = true )
private String[] roles; private String[] roles;
public String getUsername() { public String getUsername() {

@ -18,11 +18,15 @@
package org.wso2.carbon.device.mgt.common.notification.mgt; package org.wso2.carbon.device.mgt.common.notification.mgt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
/** /**
* DTO of Notification object which is used to communicate Operation notifications to MDM core. * DTO of Notification object which is used to communicate Operation notifications to MDM core.
*/ */
@ApiModel(value = "Notification", description = "This is used to communicate Operation notifications to MDM.")
public class Notification { public class Notification {
public enum Status{ public enum Status{
@ -33,10 +37,20 @@ public class Notification {
ALERT, ALERT,
} }
@ApiModelProperty(name = "notificationId", value = "Defines the notification ID.", required = true )
private int notificationId; private int notificationId;
@ApiModelProperty(name = "deviceIdentifier", value = "Defines the device identification properties.",
required = true )
private DeviceIdentifier deviceIdentifier; private DeviceIdentifier deviceIdentifier;
@ApiModelProperty(name = "description", value = "Provides the message you want to send to the user.",
required = true )
private String description; private String description;
@ApiModelProperty(name = "operationId", value = "Provides the operationID.", required = true )
private int operationId; private int operationId;
@ApiModelProperty(name = "status", value = "Provides the status of the message." +
"The following values can be assigned for the status.\n" +
"NEW: The message is in the unread state.\n" +
"CHECKED: The message is in the read state.", required = true )
private Status status; private Status status;
public Status getStatus() { public Status getStatus() {

Loading…
Cancel
Save