Merge pull request #244 from madhawap/master

Few changes to interfaces with swagger annotations
4.x.x
inoshperera 9 years ago
commit 0de8646a55

@ -83,6 +83,7 @@
javax.xml.bind, javax.xml.bind,
org.wso2.carbon.utils.*, org.wso2.carbon.utils.*,
org.wso2.carbon.device.mgt.common.*, org.wso2.carbon.device.mgt.common.*,
io.swagger.annotations.*;resolution:=optional,
org.wso2.carbon.device.mgt.core.*, org.wso2.carbon.device.mgt.core.*,
org.bouncycastle.pkcs.jcajce org.bouncycastle.pkcs.jcajce
</Import-Package> </Import-Package>
@ -166,6 +167,12 @@
<groupId>org.wso2.carbon.devicemgt</groupId> <groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId> <artifactId>org.wso2.carbon.device.mgt.common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -18,19 +18,42 @@
package org.wso2.carbon.certificate.mgt.core.dto; package org.wso2.carbon.certificate.mgt.core.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigInteger; import java.math.BigInteger;
@ApiModel(value = "CertificateResponse", description = "This class carries all information related to certificates")
public class CertificateResponse { public class CertificateResponse {
@ApiModelProperty(name = "certificate", value = "The certificate in bytes", required = true)
byte[] certificate; byte[] certificate;
@ApiModelProperty(name = "serialNumber", value = "It is the unique ID that is used to identify a certificate", required = true)
String serialNumber; String serialNumber;
@ApiModelProperty(name = "tenantId", value = "The ID of the tenant who adds the certificate", required = true)
int tenantId; int tenantId;
@ApiModelProperty(name = "commonName", value = "In mutual SSL the common name refers to the serial number of the Android device.", required = true)
String commonName; String commonName;
@ApiModelProperty(name = "notAfter", value = "The expiration date of the certificate that is inherent to the certificate", required = true)
long notAfter; long notAfter;
@ApiModelProperty(name = "notBefore", value = "The date from when the certificate is valid", required = true)
long notBefore; long notBefore;
@ApiModelProperty(name = "certificateserial", value = "The serial number of the certificate", required = true)
BigInteger certificateserial; BigInteger certificateserial;
@ApiModelProperty(name = "issuer", value = "The identity of the authority that signs the SSL certificate", required = true)
String issuer; String issuer;
@ApiModelProperty(name = "subject", value = "The identity of the certificate", required = true)
String subject; String subject;
@ApiModelProperty(name = "certificateVersion", value = "The version of the certificate", required = true)
int certificateVersion; int certificateVersion;
public long getNotAfter() { public long getNotAfter() {

@ -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" })
@ -56,8 +56,7 @@ public interface Certificate {
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
httpMethod = "POST", httpMethod = "POST",
value = "Adding an SSL Certificate", value = "Adding an SSL Certificate",
notes = "Add a new SSL certificate to the client end database", notes = "Add a new SSL certificate to the client end database")
response = MediaType.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Added successfully"), @ApiResponse(code = 200, message = "Added successfully"),
@ApiResponse(code = 500, message = "Error occurred while saving the certificate") @ApiResponse(code = 500, message = "Error occurred while saving the certificate")

@ -46,10 +46,9 @@ public interface Configuration {
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
httpMethod = "POST", httpMethod = "POST",
value = "Configuring general platform settings", value = "Configuring general platform settings",
notes = "Configure the general platform settings using this REST API", notes = "Configure the general platform settings using this REST API")
response = ResponsePayload.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Tenant configuration saved successfully"), @ApiResponse(code = 201, message = "Tenant configuration saved successfully"),
@ApiResponse(code = 500, message = "Error occurred while saving the tenant configuration") @ApiResponse(code = 500, message = "Error occurred while saving the tenant configuration")
}) })
Response saveTenantConfiguration(@ApiParam(name = "configuration", value = "The required properties to " Response saveTenantConfiguration(@ApiParam(name = "configuration", value = "The required properties to "
@ -76,10 +75,9 @@ public interface Configuration {
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating General Platform Configurations", value = "Updating General Platform Configurations",
notes = "Update the notification frequency using this REST API", notes = "Update the notification frequency using this REST API")
response = ResponsePayload.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Tenant configuration updated successfully"), @ApiResponse(code = 201, message = "Tenant configuration updated successfully"),
@ApiResponse(code = 500, message = "Error occurred while updating the tenant configuration") @ApiResponse(code = 500, message = "Error occurred while updating the tenant configuration")
}) })
Response updateConfiguration(@ApiParam(name = "configuration", value = "The required properties to update" Response updateConfiguration(@ApiParam(name = "configuration", value = "The required properties to update"

@ -89,10 +89,9 @@ public interface DeviceNotification {
httpMethod = "PUT", httpMethod = "PUT",
value = "Updating the Device Notification Status", value = "Updating the Device Notification Status",
notes = "When a user has read the the device notification the device notification status must " notes = "When a user has read the the device notification the device notification status must "
+ "change from NEW to CHECKED. Update the device notification status using this REST API", + "change from NEW to CHECKED. Update the device notification status using this REST API")
response = ResponsePayload.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "Notification status updated successfully"), @ApiResponse(code = 201, message = "Notification status updated successfully"),
@ApiResponse(code = 500, message = "Error occurred while updating notification status") @ApiResponse(code = 500, message = "Error occurred while updating notification status")
}) })
Response updateNotificationStatus( @ApiParam(name = "id", value = "Provide the ID of the notification" Response updateNotificationStatus( @ApiParam(name = "id", value = "Provide the ID of the notification"
@ -107,10 +106,9 @@ public interface DeviceNotification {
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML, produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
httpMethod = "POST", httpMethod = "POST",
value = "Sending a Device Notification", value = "Sending a Device Notification",
notes = "Notify users on device operation failures and other information using this REST API", notes = "Notify users on device operation failures and other information using this REST API")
response = ResponsePayload.class)
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(code = 200, message = "NNotification has added successfully"), @ApiResponse(code = 201, message = "NNotification has added successfully"),
@ApiResponse(code = 500, message = "Error occurred while updating notification status") @ApiResponse(code = 500, message = "Error occurred while updating notification status")
}) })
Response addNotification(Notification notification); Response addNotification(Notification notification);

@ -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"

@ -49,7 +49,8 @@
org.wso2.carbon.device.mgt.common.* org.wso2.carbon.device.mgt.common.*
</Export-Package> </Export-Package>
<Import-Package> <Import-Package>
*;resolution:=optional, javax.xml.bind.annotation,
io.swagger.annotations.*;resolution:=optional
</Import-Package> </Import-Package>
</instructions> </instructions>
</configuration> </configuration>

@ -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() {

@ -18,26 +18,41 @@
*/ */
package org.wso2.carbon.device.mgt.common.app.mgt; package org.wso2.carbon.device.mgt.common.app.mgt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
import java.util.Properties; import java.util.Properties;
@ApiModel(value = "Application", description = "This class carries all information related application")
public class Application implements Serializable { public class Application implements Serializable {
private static final long serialVersionUID = 1998101711L; private static final long serialVersionUID = 1998101711L;
@ApiModelProperty(name = "id", value = "The ID given to the application when it is stored in the EMM database", required = true)
private int id; private int id;
@ApiModelProperty(name = "platform", value = "The mobile device platform. It can be android, ios or windows", required = true)
private String platform; private String platform;
@ApiModelProperty(name = "category", value = "The application category", required = true)
private String category; private String category;
@ApiModelProperty(name = "name", value = "The application's name", required = true)
private String name; private String name;
private String locationUrl; private String locationUrl;
@ApiModelProperty(name = "imageUrl", value = "The icon url of the application", required = true)
private String imageUrl; private String imageUrl;
@ApiModelProperty(name = "version", value = "The application's version", required = true)
private String version; private String version;
@ApiModelProperty(name = "type", value = "The application type", required = true)
private String type; private String type;
@ApiModelProperty(name = "appProperties", value = "The properties of the application", required = true)
private Properties appProperties; private Properties appProperties;
@ApiModelProperty(name = "applicationIdentifier", value = "The application identifier", required = true)
private String applicationIdentifier; private String applicationIdentifier;
@ApiModelProperty(name = "memoryUsage", value = "AMount of memory used by the application", required = true)
private int memoryUsage; private int memoryUsage;
public String getType() { public String getType() {
return type; return type;
} }

@ -83,8 +83,7 @@
org.apache.catalina.core, org.apache.catalina.core,
org.apache.commons.collections, org.apache.commons.collections,
org.wso2.carbon.email.sender.*, org.wso2.carbon.email.sender.*,
io.swagger.annotations.*, io.swagger.annotations.*;resolution:=optional,
*;resolution:=optional,
org.wso2.carbon, org.wso2.carbon,
org.wso2.carbon.base org.wso2.carbon.base
</Import-Package> </Import-Package>
@ -247,6 +246,12 @@
<version>1.7.1</version> <version>1.7.1</version>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

@ -18,12 +18,19 @@
package org.wso2.carbon.device.mgt.core.dto; package org.wso2.carbon.device.mgt.core.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
@ApiModel(value = "DeviceType", description = "This class carries all information related device types")
public class DeviceType implements Serializable { public class DeviceType implements Serializable {
private static final long serialVersionUID = 7927802716452548282L; private static final long serialVersionUID = 7927802716452548282L;
@ApiModelProperty(name = "id", value = "Device type id", required = true)
private int id; private int id;
@ApiModelProperty(name = "name", value = "Device type name", required = true)
private String name; private String name;
public DeviceType() { public DeviceType() {

Loading…
Cancel
Save