Adding swagger annotations to beans and some modifications to api interfaces

4.x.x
Madhawa 9 years ago
parent 85f485df4c
commit 07c5362104

@ -36,7 +36,7 @@ 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")
@SuppressWarnings("NonJaxWsWebServices") @SuppressWarnings("NonJaxWsWebServices")
@Produces({ "application/json", "application/xml" }) @Produces({ "application/json", "application/xml" })
@Consumes({ "application/json", "application/xml" }) @Consumes({ "application/json", "application/xml" })

@ -97,7 +97,8 @@ public interface Policy {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "GET", httpMethod = "GET",
value = "Getting Details of a Policy.", value = "Getting Details of a Policy.",
notes = "Retrieve the details of a selected policy in WSO2 EMM.") notes = "Retrieve the details of a selected policy in WSO2 EMM.",
response = org.wso2.carbon.policy.mgt.common.Policy.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fetched policy details."), @ApiResponses(value = { @ApiResponse(code = 200, message = "Fetched policy details."),
@ApiResponse(code = 500, message = "Policy Management related error occurred when " + @ApiResponse(code = 500, message = "Policy Management related error occurred when " +
"fetching the policies.") }) "fetching the policies.") })
@ -254,7 +255,8 @@ public interface Policy {
value = "Getting Policy Enforced Details of a Device.", value = "Getting Policy Enforced Details of a Device.",
notes = "When a device registers with WSO2 EMM a policy is enforced on the device. Initially the EMM " + notes = "When a device registers with WSO2 EMM a policy is enforced on the device. Initially the EMM " +
"filters the policies based on the Platform (device type), filters based on the device ownership" + "filters the policies based on the Platform (device type), filters based on the device ownership" +
" type , filters based on the user role or name and finally the policy is enforced on the device.") " type , filters based on the user role or name and finally the policy is enforced on the device.",
response = org.wso2.carbon.policy.mgt.common.Policy.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fetched current policy."), @ApiResponses(value = { @ApiResponse(code = 200, message = "Fetched current policy."),
@ApiResponse(code = 500, message = "Error occurred while getting the current policy.") }) @ApiResponse(code = 500, message = "Error occurred while getting the current policy.") })
Response getDeviceActivePolicy(@ApiParam(name = "type", value = "Define the device type as the value for {type}." + Response getDeviceActivePolicy(@ApiParam(name = "type", value = "Define the device type as the value for {type}." +

@ -112,8 +112,7 @@ public interface User {
value = "Deleting a User", value = "Deleting a User",
notes = "In a situation where an employee leaves the organization you will need to remove the" notes = "In a situation where an employee leaves the organization you will need to remove the"
+ " user details from WSO2 EMM. In such situations you can use this REST API " + " user details from WSO2 EMM. In such situations you can use this REST API "
+ "to remove a user", + "to remove a user")
response = ResponsePayload.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "User by username: 'username' was successfully removed"), @ApiResponse(code = 200, message = "User by username: 'username' was successfully removed"),
@ApiResponse(code = 400, message = "User by username: 'username' does not exist for removal"), @ApiResponse(code = 400, message = "User by username: 'username' does not exist for removal"),
@ -150,7 +149,8 @@ public interface User {
value = "Getting Details of Users", value = "Getting Details of Users",
notes = "If you wish to get the details of all the user registered with WSO2 EMM, you can do so " notes = "If you wish to get the details of all the user registered with WSO2 EMM, you can do so "
+ "using the REST API", + "using the REST API",
response = ResponsePayload.class) response = UserWrapper.class,
responseContainer = "List")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 201, message = "All users were successfully retrieved"), @ApiResponse(code = 201, message = "All users were successfully retrieved"),
@ApiResponse(code = 500, message = "Error occurred while retrieving the list of users") @ApiResponse(code = 500, message = "Error occurred while retrieving the list of users")
@ -275,10 +275,9 @@ public interface User {
produces = MediaType.APPLICATION_JSON, produces = MediaType.APPLICATION_JSON,
httpMethod = "POST", httpMethod = "POST",
value = "Changing the User Password", value = "Changing the User Password",
notes = "A user is able to change the password to secure their EMM profile via this REST API", notes = "A user is able to change the password to secure their EMM profile via this REST API")
response = UserCredentialWrapper.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "UserImpl password by username: 'Username' was " @ApiResponse(code = 201, message = "UserImpl password by username: 'Username' was "
+ "successfully changed"), + "successfully changed"),
@ApiResponse(code = 400, message = "Old password does not match"), @ApiResponse(code = 400, message = "Old password does not match"),
@ApiResponse(code = 400, message = "Could not change the password of the user: 'Username'. The" @ApiResponse(code = 400, message = "Could not change the password of the user: 'Username'. The"
@ -301,10 +300,9 @@ public interface User {
notes = "In a situation where you need to block a user from accessing their EMM profile, " notes = "In a situation where you need to block a user from accessing their EMM profile, "
+ "the EMM administrator is able to reset the password. This will change the user's " + "the EMM administrator is able to reset the password. This will change the user's "
+ "password and the user will not be able to able to login to the account as he/she is " + "password and the user will not be able to able to login to the account as he/she is "
+ "not aware of the new password.", + "not aware of the new password.")
response = UserCredentialWrapper.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "UserImpl password by username: 'Username' was " @ApiResponse(code = 201, message = "UserImpl password by username: 'Username' was "
+ "successfully changed"), + "successfully changed"),
@ApiResponse(code = 400, message = "Old password does not match"), @ApiResponse(code = 400, message = "Old password does not match"),
@ApiResponse(code = 400, message = "Could not change the password of the user: 'Username'. The" @ApiResponse(code = 400, message = "Could not change the password of the user: 'Username'. The"

@ -18,18 +18,30 @@
package org.wso2.carbon.device.mgt.common; package org.wso2.carbon.device.mgt.common;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* This class holds necessary data to represent a paginated result. * This class holds necessary data to represent a paginated result.
*/ */
@ApiModel(value = "PaginationResult", description = "This class carries all information related Pagination Result")
public class PaginationResult implements Serializable { public class PaginationResult implements Serializable {
private static final long serialVersionUID = 1998101711L; private static final long serialVersionUID = 1998101711L;
@ApiModelProperty(name = "recordsTotal", value = "The total number of records that are given before filtering", required = true)
private int recordsTotal; private int recordsTotal;
@ApiModelProperty(name = "recordsFiltered", value = "The total number of records that are given after filtering", required = true)
private int recordsFiltered; private int recordsFiltered;
@ApiModelProperty(name = "draw", value = "The draw counter that this object is a response to, from the draw parameter sent as part of the data request", required = true)
private int draw; private int draw;
@ApiModelProperty(name = "data", value = "The details of the SSL certificate", required = true)
private List<?> data; private List<?> data;
public int getRecordsTotal() { public int getRecordsTotal() {

Loading…
Cancel
Save