mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixing code conflicts and improving swagger annotations
This commit is contained in:
commit
a0dbb25824
@ -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() {
|
||||||
|
|||||||
@ -18,15 +18,10 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.api;
|
package org.wso2.carbon.device.mgt.jaxrs.api;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import io.swagger.annotations.ApiResponses;
|
|
||||||
import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse;
|
import org.wso2.carbon.certificate.mgt.core.dto.CertificateResponse;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload;
|
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.EnrollmentCertificate;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.EnrollmentCertificate;
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
@ -36,7 +31,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")
|
||||||
@Path("/certificates")
|
@Path("/certificates")
|
||||||
@Produces({ "application/json", "application/xml" })
|
@Produces({ "application/json", "application/xml" })
|
||||||
@ -57,8 +53,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")
|
||||||
@ -84,7 +79,7 @@ public interface Certificate {
|
|||||||
notes = "Get the client side SSL certificate details",
|
notes = "Get the client side SSL certificate details",
|
||||||
response = CertificateResponse.class)
|
response = CertificateResponse.class)
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "OK"),
|
@ApiResponse(code = 200, message = "OK", response = CertificateResponse.class),
|
||||||
@ApiResponse(code = 400, message = "Notification status updated successfully"),
|
@ApiResponse(code = 400, message = "Notification status updated successfully"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while converting PEM file to X509Certificate")
|
@ApiResponse(code = 500, message = "Error occurred while converting PEM file to X509Certificate")
|
||||||
})
|
})
|
||||||
@ -113,7 +108,7 @@ public interface Certificate {
|
|||||||
+ "page therefore the details are paginated",
|
+ "page therefore the details are paginated",
|
||||||
response = PaginationResult.class)
|
response = PaginationResult.class)
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "OK"),
|
@ApiResponse(code = 200, message = "OK", response = PaginationResult.class),
|
||||||
@ApiResponse(code = 400, message = "Invalid start index"),
|
@ApiResponse(code = 400, message = "Invalid start index"),
|
||||||
@ApiResponse(code = 400, message = "Invalid length value"),
|
@ApiResponse(code = 400, message = "Invalid length value"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while fetching all certificates")
|
@ApiResponse(code = 500, message = "Error occurred while fetching all certificates")
|
||||||
|
|||||||
@ -18,13 +18,8 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.api;
|
package org.wso2.carbon.device.mgt.jaxrs.api;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import io.swagger.annotations.ApiResponses;
|
|
||||||
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload;
|
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
@ -34,8 +29,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")
|
|
||||||
@Path("/configuration")
|
@Path("/configuration")
|
||||||
|
@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" })
|
||||||
@ -47,10 +43,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 "
|
||||||
@ -77,10 +72,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"
|
||||||
|
|||||||
@ -29,8 +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", description = "")
|
|
||||||
@Path("/devices")
|
@Path("/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 {
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ public interface Device {
|
|||||||
httpMethod = "GET",
|
httpMethod = "GET",
|
||||||
value = "Getting the Device Count",
|
value = "Getting the Device Count",
|
||||||
notes = "Get the number of devices that are registered with WSO2 EMM.",
|
notes = "Get the number of devices that are registered with WSO2 EMM.",
|
||||||
response = Integer.class)
|
response = int.class)
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "Device count"),
|
@ApiResponse(code = 200, message = "Device count"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while fetching the device count")
|
@ApiResponse(code = 500, message = "Error occurred while fetching the device count")
|
||||||
|
|||||||
@ -18,14 +18,9 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.api;
|
package org.wso2.carbon.device.mgt.jaxrs.api;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import io.swagger.annotations.ApiResponses;
|
|
||||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
|
import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo;
|
||||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;
|
import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.UserCredentialWrapper;
|
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
@ -36,8 +31,8 @@ import javax.ws.rs.core.Response;
|
|||||||
/**
|
/**
|
||||||
* Device information related operations.
|
* Device information related operations.
|
||||||
*/
|
*/
|
||||||
@Api(value = "DeviceInfo")
|
|
||||||
@Path("/information")
|
@Path("/information")
|
||||||
|
@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")
|
||||||
@Path("/notifications")
|
@Path("/notifications")
|
||||||
@Produces({"application/json", "application/xml"})
|
@Produces({"application/json", "application/xml"})
|
||||||
@ -58,7 +58,8 @@ public interface DeviceNotification {
|
|||||||
response = Notification.class,
|
response = Notification.class,
|
||||||
responseContainer = "List")
|
responseContainer = "List")
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "List of Notifications"),
|
@ApiResponse(code = 200, message = "List of Notifications", response = Notification.class,
|
||||||
|
responseContainer = "List"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while retrieving the notification list")
|
@ApiResponse(code = 500, message = "Error occurred while retrieving the notification list")
|
||||||
})
|
})
|
||||||
Response getNotifications();
|
Response getNotifications();
|
||||||
@ -75,7 +76,8 @@ public interface DeviceNotification {
|
|||||||
response = Notification.class,
|
response = Notification.class,
|
||||||
responseContainer = "List")
|
responseContainer = "List")
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "List of Notifications"),
|
@ApiResponse(code = 200, message = "List of Notifications", response = Notification.class,
|
||||||
|
responseContainer = "List"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while retrieving the notification list")
|
@ApiResponse(code = 500, message = "Error occurred while retrieving the notification list")
|
||||||
})
|
})
|
||||||
Response getNotificationsByStatus(@ApiParam(name = "status", value = "Provide the notification status as"
|
Response getNotificationsByStatus(@ApiParam(name = "status", value = "Provide the notification status as"
|
||||||
@ -90,10 +92,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"
|
||||||
@ -108,10 +109,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);
|
||||||
|
|||||||
@ -18,12 +18,7 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.api;
|
package org.wso2.carbon.device.mgt.jaxrs.api;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import io.swagger.annotations.ApiResponses;
|
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
|
||||||
import org.wso2.carbon.device.mgt.common.device.details.DeviceWrapper;
|
import org.wso2.carbon.device.mgt.common.device.details.DeviceWrapper;
|
||||||
import org.wso2.carbon.device.mgt.common.search.SearchContext;
|
import org.wso2.carbon.device.mgt.common.search.SearchContext;
|
||||||
|
|
||||||
@ -35,8 +30,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")
|
|
||||||
@Path("/search")
|
@Path("/search")
|
||||||
|
@Api(value = "DeviceSearch", description = "Device searching related operations can be found here.")
|
||||||
@SuppressWarnings("NonJaxWsWebServices")
|
@SuppressWarnings("NonJaxWsWebServices")
|
||||||
public interface DeviceSearch {
|
public interface DeviceSearch {
|
||||||
|
|
||||||
@ -49,7 +44,7 @@ public interface DeviceSearch {
|
|||||||
response = DeviceWrapper.class,
|
response = DeviceWrapper.class,
|
||||||
responseContainer = "List")
|
responseContainer = "List")
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "OK"),
|
@ApiResponse(code = 200, message = "OK", response = DeviceWrapper.class, responseContainer = "List"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while searching the device information")
|
@ApiResponse(code = 500, message = "Error occurred while searching the device information")
|
||||||
})
|
})
|
||||||
Response getFilteredDeviceInfo(@ApiParam(name = "enrollmentCertificates", value = "List of search conditions",
|
Response getFilteredDeviceInfo(@ApiParam(name = "enrollmentCertificates", value = "List of search conditions",
|
||||||
|
|||||||
@ -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")
|
||||||
@Path("/features")
|
@Path("/features")
|
||||||
@Produces({"application/json", "application/xml"})
|
@Produces({"application/json", "application/xml"})
|
||||||
|
|||||||
@ -19,25 +19,20 @@
|
|||||||
package org.wso2.carbon.device.mgt.jaxrs.api;
|
package org.wso2.carbon.device.mgt.jaxrs.api;
|
||||||
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
|
||||||
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
|
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
|
||||||
|
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.context.DeviceOperationContext;
|
import org.wso2.carbon.device.mgt.jaxrs.api.context.DeviceOperationContext;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload;
|
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.ApplicationWrapper;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.ApplicationWrapper;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.QueryParam;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Api(value = "Operation")
|
|
||||||
@Path("/operations")
|
@Path("/operations")
|
||||||
|
@Api(value = "Operation", description = "Operation management related operations can be found here.")
|
||||||
public interface Operation {
|
public interface Operation {
|
||||||
|
|
||||||
/* @deprecated */
|
/* @deprecated */
|
||||||
@ -110,7 +105,7 @@ public interface Operation {
|
|||||||
responseContainer = "List",
|
responseContainer = "List",
|
||||||
notes = "Get the list of applications that a device has subscribed.",
|
notes = "Get the list of applications that a device has subscribed.",
|
||||||
response = Application.class)
|
response = Application.class)
|
||||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "List of installed application details of a device."),
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "List of installed application details of a device.", response = Application.class, responseContainer = "List"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while fetching the apps of the device" +
|
@ApiResponse(code = 500, message = "Error occurred while fetching the apps of the device" +
|
||||||
".")})
|
".")})
|
||||||
Response getInstalledApps(@ApiParam(name = "type", value = "Define the device type as the value for {type}. " +
|
Response getInstalledApps(@ApiParam(name = "type", value = "Define the device type as the value for {type}. " +
|
||||||
@ -156,4 +151,19 @@ public interface Operation {
|
|||||||
"{tenantDomain}. The default tenant domain " +
|
"{tenantDomain}. The default tenant domain " +
|
||||||
"of WSO2 EMM is carbon.super.",
|
"of WSO2 EMM is carbon.super.",
|
||||||
required = true) @PathParam("tenantDomain") String tenantDomain);
|
required = true) @PathParam("tenantDomain") String tenantDomain);
|
||||||
|
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("activity/{id}")
|
||||||
|
@ApiOperation(
|
||||||
|
consumes = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
|
||||||
|
produces = MediaType.APPLICATION_JSON + ", " + MediaType.APPLICATION_XML,
|
||||||
|
httpMethod = "POST",
|
||||||
|
value = "Retrieving the operation details.",
|
||||||
|
notes = "This will return the operation details including the responses from the devices")
|
||||||
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "Activity details provided successfully.."),
|
||||||
|
@ApiResponse(code = 500, message = "Error occurred while fetching the activity for the supplied id.")})
|
||||||
|
Response getActivity(@ApiParam(name = "id", value = "Provide activity id {id} as ACTIVITY_(number)",
|
||||||
|
required = true) @PathParam("id") String id)
|
||||||
|
throws MDMAPIException;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,26 +20,16 @@ package org.wso2.carbon.device.mgt.jaxrs.api;
|
|||||||
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
import org.wso2.carbon.device.mgt.jaxrs.api.common.MDMAPIException;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload;
|
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.PolicyWrapper;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.PolicyWrapper;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.PriorityUpdatedPolicyWrapper;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.PUT;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Api(value = "Policy")
|
|
||||||
@Path("/policies")
|
@Path("/policies")
|
||||||
|
@Api(value = "Policy", description = "Policy management related operations can be found here.")
|
||||||
public interface Policy {
|
public interface Policy {
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@ -85,7 +75,8 @@ public interface Policy {
|
|||||||
responseContainer = "List",
|
responseContainer = "List",
|
||||||
notes = "Retrieve the details of all the policies that you have created in WSO2 EMM.",
|
notes = "Retrieve the details of all the policies that you have created in WSO2 EMM.",
|
||||||
response = org.wso2.carbon.policy.mgt.common.Policy.class)
|
response = org.wso2.carbon.policy.mgt.common.Policy.class)
|
||||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fetched all policies."),
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "Fetched all policies.",
|
||||||
|
response = org.wso2.carbon.policy.mgt.common.Policy.class, responseContainer = "List"),
|
||||||
@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.")})
|
||||||
Response getAllPolicies();
|
Response getAllPolicies();
|
||||||
@ -98,7 +89,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.")})
|
||||||
@ -113,7 +105,7 @@ public interface Policy {
|
|||||||
httpMethod = "GET",
|
httpMethod = "GET",
|
||||||
value = "Getting the Policy Count.",
|
value = "Getting the Policy Count.",
|
||||||
notes = "Get the number of policies that are created in WSO2 EMM.",
|
notes = "Get the number of policies that are created in WSO2 EMM.",
|
||||||
response = Integer.class)
|
response = int.class)
|
||||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "Fetched the policy count."),
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "Fetched the policy count."),
|
||||||
@ApiResponse(code = 500, message = "Error while Fetching the policy count.")})
|
@ApiResponse(code = 500, message = "Error while Fetching the policy count.")})
|
||||||
Response getPolicyCount();
|
Response getPolicyCount();
|
||||||
@ -255,7 +247,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}." +
|
||||||
|
|||||||
@ -27,8 +27,8 @@ import javax.ws.rs.core.MediaType;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Api(value = "Role")
|
|
||||||
@Path("/roles")
|
@Path("/roles")
|
||||||
|
@Api(value = "Role", description = "Role management related operations can be found here.")
|
||||||
public interface Role {
|
public interface Role {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@ -192,7 +192,7 @@ public interface Role {
|
|||||||
produces = MediaType.APPLICATION_JSON,
|
produces = MediaType.APPLICATION_JSON,
|
||||||
httpMethod = "GET",
|
httpMethod = "GET",
|
||||||
value = "Getting the Role Count.",
|
value = "Getting the Role Count.",
|
||||||
response = Integer.class,
|
response = int.class,
|
||||||
notes = "Get the number of roles in WSO2 EMM.")
|
notes = "Get the number of roles in WSO2 EMM.")
|
||||||
@ApiResponses(value = { @ApiResponse(code = 200, message = "Retrieved the role count."),
|
@ApiResponses(value = { @ApiResponse(code = 200, message = "Retrieved the role count."),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while retrieving the role count.") })
|
@ApiResponse(code = 500, message = "Error occurred while retrieving the role count.") })
|
||||||
|
|||||||
@ -18,25 +18,12 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.api;
|
package org.wso2.carbon.device.mgt.jaxrs.api;
|
||||||
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.*;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
|
||||||
import io.swagger.annotations.ApiResponses;
|
|
||||||
import org.apache.axis2.databinding.types.soapencoding.Integer;
|
import org.apache.axis2.databinding.types.soapencoding.Integer;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.api.util.ResponsePayload;
|
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.UserCredentialWrapper;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.UserCredentialWrapper;
|
||||||
import org.wso2.carbon.device.mgt.jaxrs.beans.UserWrapper;
|
import org.wso2.carbon.device.mgt.jaxrs.beans.UserWrapper;
|
||||||
|
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.DELETE;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.PUT;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.QueryParam;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -44,8 +31,8 @@ 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")
|
|
||||||
@Path("/users")
|
@Path("/users")
|
||||||
|
@Api(value = "User", description = "User management related operations can be found here.")
|
||||||
public interface User {
|
public interface User {
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@ -113,8 +100,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"),
|
||||||
@ -151,7 +137,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")
|
||||||
@ -254,7 +241,7 @@ public interface User {
|
|||||||
httpMethod = "GET",
|
httpMethod = "GET",
|
||||||
value = "Getting the User Count",
|
value = "Getting the User Count",
|
||||||
notes = "Get the number of users in WSO2 EMM",
|
notes = "Get the number of users in WSO2 EMM",
|
||||||
response = Integer.class)
|
response = int.class)
|
||||||
@ApiResponses(value = {
|
@ApiResponses(value = {
|
||||||
@ApiResponse(code = 200, message = "OK"),
|
@ApiResponse(code = 200, message = "OK"),
|
||||||
@ApiResponse(code = 500, message = "Error occurred while retrieving the list of users that exist"
|
@ApiResponse(code = 500, message = "Error occurred while retrieving the list of users that exist"
|
||||||
@ -276,10 +263,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"
|
||||||
@ -302,10 +288,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"
|
||||||
|
|||||||
@ -224,4 +224,22 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
|||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GET
|
||||||
|
@Path("activity/{id}")
|
||||||
|
public Response getActivity(@PathParam("id") String id)
|
||||||
|
throws MDMAPIException {
|
||||||
|
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation;
|
||||||
|
DeviceManagementProviderService dmService;
|
||||||
|
try {
|
||||||
|
dmService = DeviceMgtAPIUtils.getDeviceManagementService();
|
||||||
|
operation = dmService.getOperationByActivityId(id);
|
||||||
|
} catch (OperationManagementException e) {
|
||||||
|
String msg = "Error occurred while fetching the activity for the supplied id.";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MDMAPIException(msg, e);
|
||||||
|
}
|
||||||
|
return Response.status(Response.Status.OK).entity(operation).build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -18,14 +18,25 @@
|
|||||||
|
|
||||||
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,
|
||||||
|
dataType = "List[org.wso2.carbon.device.mgt.common.DeviceIdentifier]")
|
||||||
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() {
|
||||||
@ -35,6 +46,7 @@ public class ApplicationWrapper {
|
|||||||
public void setApplication(MobileApp application) {
|
public void setApplication(MobileApp application) {
|
||||||
this.application = application;
|
this.application = application;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getUserNameList() {
|
public List<String> getUserNameList() {
|
||||||
return userNameList;
|
return userNameList;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 = "MobileApp", 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,21 +18,52 @@
|
|||||||
|
|
||||||
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.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel(value = "PolicyWrapper", description = "This class carries all information related to Policy "
|
||||||
|
+ "Wrappers")
|
||||||
public class PolicyWrapper {
|
public class PolicyWrapper {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "The policy ID", required = true)
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "profile", value = "Contains the details of the profile that is included in the"
|
||||||
|
+ " policy", required = true)
|
||||||
private Profile profile;
|
private Profile profile;
|
||||||
|
@ApiModelProperty(name = "policyName", value = "The name of the policy", required = true)
|
||||||
private String policyName;
|
private String policyName;
|
||||||
|
@ApiModelProperty(name = "description", value = "Gives a description on the policy", required = true)
|
||||||
private String description;
|
private String description;
|
||||||
|
@ApiModelProperty(name = "compliance", value = "Provides the non-compliance rules. WSO2 EMM provides the"
|
||||||
|
+ " following non-compliance rules:\n"
|
||||||
|
+ "Enforce - Forcefully enforce the policies on the devices\n"
|
||||||
|
+ "Warning - If the device does not adhere to the given policies a warning message will be sent\n"
|
||||||
|
+ "Monitor - If the device does not adhere to the given policies the server is notified of the "
|
||||||
|
+ "violation unknown to the user and the administrator can take the necessary actions with regard"
|
||||||
|
+ " to the reported", required = true)
|
||||||
private String compliance;
|
private String compliance;
|
||||||
|
@ApiModelProperty(name = "roles", value = "The roles to whom the policy is applied on", required = true)
|
||||||
private List<String> roles;
|
private List<String> roles;
|
||||||
|
@ApiModelProperty(name = "ownershipType", value = "The policy ownership type. It can be any of the "
|
||||||
|
+ "following values:\n"
|
||||||
|
+ "ANY - The policy will be applied on the BYOD and COPE device types\n"
|
||||||
|
+ "BYOD (Bring Your Own Device) - The policy will only be applied on the BYOD device type\n"
|
||||||
|
+ "COPE (Corporate-Owned, Personally-Enabled) - The policy will only be applied on the COPE "
|
||||||
|
+ "device type", required = true)
|
||||||
private String ownershipType;
|
private String ownershipType;
|
||||||
|
@ApiModelProperty(name = "devices", value = "Lists out the devices the policy is enforced on",
|
||||||
|
required = true)
|
||||||
private List<Device> devices;
|
private List<Device> devices;
|
||||||
|
@ApiModelProperty(name = "users", value = "Lists out the users on whose devices the policy is enforced",
|
||||||
|
required = true)
|
||||||
private List<String> users;
|
private List<String> users;
|
||||||
|
@ApiModelProperty(name = "tenantId", value = "The ID of the tenant that created the policy",
|
||||||
|
required = true)
|
||||||
private int tenantId;
|
private int tenantId;
|
||||||
|
@ApiModelProperty(name = "profileId", value = "The ID of each profile that is in the selected policy",
|
||||||
|
required = true)
|
||||||
private int profileId;
|
private int profileId;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
|||||||
@ -18,9 +18,17 @@
|
|||||||
|
|
||||||
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 = "PriorityUpdatedPolicyWrapper", description = "This class carries all information related "
|
||||||
|
+ "to Priority Updated Policy Wrapper ")
|
||||||
public class PriorityUpdatedPolicyWrapper {
|
public class PriorityUpdatedPolicyWrapper {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "Define the ID of the policy", required = true)
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "priority", value = "Define the priority of the order, where 1 indicates the "
|
||||||
|
+ "highest priority", required = true)
|
||||||
private int priority;
|
private int priority;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
|||||||
@ -18,15 +18,16 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.jaxrs.beans;
|
package org.wso2.carbon.device.mgt.jaxrs.beans;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
|
@ApiModel(value = "Profile", description = "testttt")
|
||||||
public class Profile {
|
public class Profile {
|
||||||
|
|
||||||
private int profileId;
|
private int profileId;
|
||||||
|
|||||||
@ -18,12 +18,28 @@
|
|||||||
|
|
||||||
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.user.mgt.common.UIPermissionNode;
|
import org.wso2.carbon.user.mgt.common.UIPermissionNode;
|
||||||
|
|
||||||
|
@ApiModel(value = "RoleWrapper", description = "Role details including permission and the users in the roles are " +
|
||||||
|
"wrapped here.")
|
||||||
public class RoleWrapper {
|
public class RoleWrapper {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "roleName", value = "The name of the role.", required = true)
|
||||||
private String roleName;
|
private String roleName;
|
||||||
|
@ApiModelProperty(name = "permissions", value = "Lists out all the permissions associated with roles.",
|
||||||
|
required = true, dataType = "List[java.lang.String]")
|
||||||
private String[] permissions;
|
private String[] permissions;
|
||||||
|
@ApiModelProperty(name = "users", value = "The list of users assigned to the selected role.",
|
||||||
|
required = true, dataType = "List[java.lang.String]")
|
||||||
private String[] users;
|
private String[] users;
|
||||||
|
@ApiModelProperty(name = "permissionList", value = "This contain the following, " +
|
||||||
|
"\n resourcePath\tThe path related to the API.\n " +
|
||||||
|
"displayName\tThe name of the permission that is shown " +
|
||||||
|
"in the UI.\n" +
|
||||||
|
"nodeList\tLists out the nested permissions.",
|
||||||
|
required = true)
|
||||||
private UIPermissionNode permissionList;
|
private UIPermissionNode permissionList;
|
||||||
|
|
||||||
public String getRoleName() {
|
public String getRoleName() {
|
||||||
|
|||||||
@ -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() {
|
||||||
|
|||||||
@ -48,6 +48,10 @@
|
|||||||
<Export-Package>
|
<Export-Package>
|
||||||
org.wso2.carbon.device.mgt.common.*
|
org.wso2.carbon.device.mgt.common.*
|
||||||
</Export-Package>
|
</Export-Package>
|
||||||
|
<Import-Package>
|
||||||
|
javax.xml.bind.annotation,
|
||||||
|
io.swagger.annotations.*;resolution:=optional
|
||||||
|
</Import-Package>
|
||||||
</instructions>
|
</instructions>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@ -17,23 +17,43 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
|
@ApiModel(value = "Device", description = "This class carries all information related to a managed device.")
|
||||||
public class Device implements Serializable {
|
public class Device implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1998101711L;
|
private static final long serialVersionUID = 1998101711L;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "ID of the device in the WSO2 EMM device information database.",
|
||||||
|
required = true)
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "name", value = "The device name that can be set on the device by the device user.",
|
||||||
|
required = true)
|
||||||
private String name;
|
private String name;
|
||||||
|
@ApiModelProperty(name = "type", value = "The OS type of the device.", required = true)
|
||||||
private String type;
|
private String type;
|
||||||
|
@ApiModelProperty(name = "description", value = "Additional information on the device.", required = true)
|
||||||
private String description;
|
private String description;
|
||||||
|
@ApiModelProperty(name = "deviceIdentifier", value = "This is a 64-bit number (as a hex string) that is randomly" +
|
||||||
|
" generated when the user first sets up the device and should" +
|
||||||
|
" remain constant for the lifetime of the user's device." +
|
||||||
|
" The value may change if a factory reset is performed on " +
|
||||||
|
"the device.",
|
||||||
|
required = true)
|
||||||
private String deviceIdentifier;
|
private String deviceIdentifier;
|
||||||
|
@ApiModelProperty(name = "enrolmentInfo", value = "This defines the device registration related information. " +
|
||||||
|
"It is mandatory to define this information.", required = true)
|
||||||
private EnrolmentInfo enrolmentInfo;
|
private EnrolmentInfo enrolmentInfo;
|
||||||
|
@ApiModelProperty(name = "features", value = "List of features.", required = true)
|
||||||
private List<Feature> features;
|
private List<Feature> features;
|
||||||
private List<Device.Property> properties;
|
private List<Device.Property> properties;
|
||||||
|
|
||||||
public Device() {}
|
public Device() {
|
||||||
|
}
|
||||||
|
|
||||||
public Device(String name, String type, String description, String deviceId, EnrolmentInfo enrolmentInfo,
|
public Device(String name, String type, String description, String deviceId, EnrolmentInfo enrolmentInfo,
|
||||||
List<Feature> features, List<Property> properties) {
|
List<Feature> features, List<Property> properties) {
|
||||||
|
|||||||
@ -17,11 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModel(value = "DeviceIdentifier", description = "This contains device details that is used to identify a device " +
|
||||||
|
"uniquely.")
|
||||||
public class DeviceIdentifier implements Serializable{
|
public class DeviceIdentifier implements Serializable{
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "Identity of the device.", required = true)
|
||||||
private String id;
|
private String id;
|
||||||
|
@ApiModelProperty(name = "type", value = "Type of the device.", required = true)
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
public DeviceIdentifier() {}
|
public DeviceIdentifier() {}
|
||||||
|
|||||||
@ -18,8 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
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;
|
||||||
|
|
||||||
|
@ApiModel(value = "EnrolmentInfo", description = "This class carries all information related to a devices enrollment" +
|
||||||
|
" status.")
|
||||||
public class EnrolmentInfo implements Serializable {
|
public class EnrolmentInfo implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1998101712L;
|
private static final long serialVersionUID = 1998101712L;
|
||||||
@ -32,12 +37,24 @@ public class EnrolmentInfo implements Serializable {
|
|||||||
BYOD, COPE
|
BYOD, COPE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "ID of the device in the WSO2 EMM device information database.",
|
||||||
|
required = true)
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "device", value = "Enrolled device.", required = true)
|
||||||
private Device device;
|
private Device device;
|
||||||
|
@ApiModelProperty(name = "dateOfEnrolment", value = "Date of the device enrollment.", required = true )
|
||||||
private Long dateOfEnrolment;
|
private Long dateOfEnrolment;
|
||||||
|
@ApiModelProperty(name = "dateOfLastUpdate", value = "Date of the device's last update.", required = true )
|
||||||
private Long dateOfLastUpdate;
|
private Long dateOfLastUpdate;
|
||||||
|
@ApiModelProperty(name = "ownership", value = "Defines the ownership details. The ownership type can be any of the" +
|
||||||
|
" following values.\n" +
|
||||||
|
"BYOD - Bring your own device (BYOD).\n" +
|
||||||
|
"COPE - Corporate owned personally enabled (COPE).", required = true )
|
||||||
private OwnerShip ownership;
|
private OwnerShip ownership;
|
||||||
|
@ApiModelProperty(name = "status", value = "Current status of the device, such as whether the device " +
|
||||||
|
"is active, removed etc.", required = true )
|
||||||
private Status status;
|
private Status status;
|
||||||
|
@ApiModelProperty(name = "owner", value = "The device owner's name.", required = true )
|
||||||
private String owner;
|
private String owner;
|
||||||
|
|
||||||
public EnrolmentInfo() {
|
public EnrolmentInfo() {
|
||||||
|
|||||||
@ -22,15 +22,26 @@ import java.io.Serializable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
@ApiModel(value = "Feature", description = "This class carries all information related to a devices enrollment" +
|
||||||
|
" status.")
|
||||||
public class Feature implements Serializable {
|
public class Feature implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "Feature Id.", required = true )
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "code", value = "The code of the feature. For example the code to lock a device" +
|
||||||
|
" is DEVICE_LOCK.", required = true )
|
||||||
private String code;
|
private String code;
|
||||||
|
@ApiModelProperty(name = "name", value = "A name that describes a feature.", required = true )
|
||||||
private String name;
|
private String name;
|
||||||
|
@ApiModelProperty(name = "description", value = "Provides a description of the features..", required = true )
|
||||||
private String description;
|
private String description;
|
||||||
|
@ApiModelProperty(name = "deviceType", value = "Provide the device type for the respective feature. " +
|
||||||
|
"Features allow you to perform operations on any device type, " +
|
||||||
|
"such as android, iOS or windows..", required = true )
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
private String method;
|
private String method;
|
||||||
private String type;
|
private String type;
|
||||||
|
@ApiModelProperty(name = "metadataEntries", value = "Properties related to features.", required = true )
|
||||||
private List<MetadataEntry> metadataEntries;
|
private List<MetadataEntry> metadataEntries;
|
||||||
|
|
||||||
@XmlElement
|
@XmlElement
|
||||||
|
|||||||
@ -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 imageUrl;
|
|
||||||
private String version;
|
|
||||||
private String type;
|
|
||||||
private Properties appProperties;
|
|
||||||
private String applicationIdentifier;
|
|
||||||
|
|
||||||
|
private String locationUrl;
|
||||||
|
@ApiModelProperty(name = "imageUrl", value = "The icon url of the application", required = true)
|
||||||
|
private String imageUrl;
|
||||||
|
@ApiModelProperty(name = "version", value = "The application's version", required = true)
|
||||||
|
private String version;
|
||||||
|
@ApiModelProperty(name = "type", value = "The application type", required = true)
|
||||||
|
private String type;
|
||||||
|
@ApiModelProperty(name = "appProperties", value = "The properties of the application", required = true)
|
||||||
|
private Properties appProperties;
|
||||||
|
@ApiModelProperty(name = "applicationIdentifier", value = "The application identifier", required = true)
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common.device.details;
|
package org.wso2.carbon.device.mgt.common.device.details;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -26,34 +28,60 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ApiModel(value = "DeviceInfo", description = "This class carries all information related to the device information " +
|
||||||
|
"provided by a device.")
|
||||||
public class DeviceInfo implements Serializable {
|
public class DeviceInfo implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1998101733L;
|
private static final long serialVersionUID = 1998101733L;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "deviceId", value = "Device Id.", required = true)
|
||||||
private int deviceId;
|
private int deviceId;
|
||||||
|
@ApiModelProperty(name = "deviceType", value = "Type of the device.", required = true)
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
|
@ApiModelProperty(name = "deviceId", value = "Device identifier.", required = true)
|
||||||
private DeviceIdentifier deviceIdentifier;
|
private DeviceIdentifier deviceIdentifier;
|
||||||
|
@ApiModelProperty(name = "IMEI", value = "IMEI number of the device.", required = true)
|
||||||
private String IMEI;
|
private String IMEI;
|
||||||
|
@ApiModelProperty(name = "IMSI", value = "IMSI number of the device.", required = true)
|
||||||
private String IMSI;
|
private String IMSI;
|
||||||
|
@ApiModelProperty(name = "deviceModel", value = "Model of the device.", required = true)
|
||||||
private String deviceModel;
|
private String deviceModel;
|
||||||
|
@ApiModelProperty(name = "vendor", value = "Vendor of the device.", required = true)
|
||||||
private String vendor;
|
private String vendor;
|
||||||
|
@ApiModelProperty(name = "osVersion", value = "Operating system version.", required = true)
|
||||||
private String osVersion;
|
private String osVersion;
|
||||||
|
@ApiModelProperty(name = "batteryLevel", value = "Battery level of the device.", required = true)
|
||||||
private Double batteryLevel;
|
private Double batteryLevel;
|
||||||
|
@ApiModelProperty(name = "internalTotalMemory", value = "Total internal memory of the device.", required = true)
|
||||||
private Double internalTotalMemory;
|
private Double internalTotalMemory;
|
||||||
|
@ApiModelProperty(name = "internalAvailableMemory", value = "Total available memory of the device.",
|
||||||
|
required = true)
|
||||||
private Double internalAvailableMemory;
|
private Double internalAvailableMemory;
|
||||||
|
@ApiModelProperty(name = "externalTotalMemory", value = "Total external memory of the device.", required = true)
|
||||||
private Double externalTotalMemory;
|
private Double externalTotalMemory;
|
||||||
|
@ApiModelProperty(name = "externalAvailableMemory", value = "Total external memory avilable of the device.",
|
||||||
|
required = true)
|
||||||
private Double externalAvailableMemory;
|
private Double externalAvailableMemory;
|
||||||
|
@ApiModelProperty(name = "operator", value = "Mobile operator of the device.", required = true)
|
||||||
private String operator;
|
private String operator;
|
||||||
|
@ApiModelProperty(name = "connectionType", value = "How the device is connected to the network.", required = true)
|
||||||
private String connectionType;
|
private String connectionType;
|
||||||
|
@ApiModelProperty(name = "mobileSignalStrength", value = "Current mobile signal strength.", required = true)
|
||||||
private Double mobileSignalStrength;
|
private Double mobileSignalStrength;
|
||||||
|
@ApiModelProperty(name = "ssid", value = "ssid of the connected WiFi.", required = true)
|
||||||
private String ssid;
|
private String ssid;
|
||||||
|
@ApiModelProperty(name = "cpuUsage", value = "Current total cpu usage.", required = true)
|
||||||
private Double cpuUsage;
|
private Double cpuUsage;
|
||||||
|
@ApiModelProperty(name = "totalRAMMemory", value = "Total Ram memory size.", required = true)
|
||||||
private Double totalRAMMemory;
|
private Double totalRAMMemory;
|
||||||
|
@ApiModelProperty(name = "availableRAMMemory", value = "Available total memory of RAM.", required = true)
|
||||||
private Double availableRAMMemory;
|
private Double availableRAMMemory;
|
||||||
|
@ApiModelProperty(name = "pluggedIn", value = "Whether the device is plugged into power or not.",
|
||||||
|
required = true)
|
||||||
private boolean pluggedIn;
|
private boolean pluggedIn;
|
||||||
|
@ApiModelProperty(name = "updatedTime", value = "Device updated time.", required = true)
|
||||||
private Date updatedTime;
|
private Date updatedTime;
|
||||||
|
@ApiModelProperty(name = "deviceDetailsMap", value = ".", required = true)
|
||||||
private Map<String, String> deviceDetailsMap = new HashMap<>();
|
private Map<String, String> deviceDetailsMap = new HashMap<>();
|
||||||
|
|
||||||
public int getDeviceId() {
|
public int getDeviceId() {
|
||||||
|
|||||||
@ -19,27 +19,41 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common.device.details;
|
package org.wso2.carbon.device.mgt.common.device.details;
|
||||||
|
|
||||||
|
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.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ApiModel(value = "DeviceLocation", description = "This class carries all information related to the device location " +
|
||||||
|
"details provided by a device.")
|
||||||
public class DeviceLocation implements Serializable {
|
public class DeviceLocation implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1998101722L;
|
private static final long serialVersionUID = 1998101722L;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "deviceId", value = "Device id", required = true)
|
||||||
private int deviceId;
|
private int deviceId;
|
||||||
|
@ApiModelProperty(name = "deviceIdentifier", value = "Device identifier used to identify a device uniquely.",
|
||||||
|
required = true)
|
||||||
private DeviceIdentifier deviceIdentifier;
|
private DeviceIdentifier deviceIdentifier;
|
||||||
|
@ApiModelProperty(name = "latitude", value = "Device GPS latitude.", required = true)
|
||||||
private Double latitude;
|
private Double latitude;
|
||||||
|
@ApiModelProperty(name = "longitude", value = "Device GPS longitude.", required = true)
|
||||||
private Double longitude;
|
private Double longitude;
|
||||||
|
@ApiModelProperty(name = "street1", value = "First line of the address.", required = true)
|
||||||
private String street1;
|
private String street1;
|
||||||
|
@ApiModelProperty(name = "street2", value = "Second part of the address.", required = true)
|
||||||
private String street2;
|
private String street2;
|
||||||
|
@ApiModelProperty(name = "city", value = "City of the device location.", required = true)
|
||||||
private String city;
|
private String city;
|
||||||
|
@ApiModelProperty(name = "state", value = "State of the device address.", required = true)
|
||||||
private String state;
|
private String state;
|
||||||
|
@ApiModelProperty(name = "zip", value = "Zip code of the device address.", required = true)
|
||||||
private String zip;
|
private String zip;
|
||||||
|
@ApiModelProperty(name = "country", value = "Country of the device address.", required = true)
|
||||||
private String country;
|
private String country;
|
||||||
|
@ApiModelProperty(name = "updatedTime", value = "Update time of the device.", required = true)
|
||||||
private Date updatedTime;
|
private Date updatedTime;
|
||||||
|
|
||||||
public int getDeviceId() {
|
public int getDeviceId() {
|
||||||
|
|||||||
@ -19,14 +19,23 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common.device.details;
|
package org.wso2.carbon.device.mgt.common.device.details;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
|
||||||
|
@ApiModel(value = "DeviceWrapper", description = "This contains device details including, " +
|
||||||
|
"location and device meta information.")
|
||||||
public class DeviceWrapper {
|
public class DeviceWrapper {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "device", value = "Device's basic information", required = true)
|
||||||
private Device device;
|
private Device device;
|
||||||
|
@ApiModelProperty(name = "deviceIdentifier", value = "Device identifier used to identify a device.",
|
||||||
|
required = true)
|
||||||
private DeviceIdentifier deviceIdentifier;
|
private DeviceIdentifier deviceIdentifier;
|
||||||
|
@ApiModelProperty(name = "deviceInfo", value = "Device's runtime information", required = true)
|
||||||
private DeviceInfo deviceInfo;
|
private DeviceInfo deviceInfo;
|
||||||
|
@ApiModelProperty(name = "deviceLocation", value = "Device's current location", required = true)
|
||||||
private DeviceLocation deviceLocation;
|
private DeviceLocation deviceLocation;
|
||||||
|
|
||||||
public Device getDevice() {
|
public Device getDevice() {
|
||||||
|
|||||||
@ -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() {
|
||||||
|
|||||||
@ -18,12 +18,18 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common.operation.mgt;
|
package org.wso2.carbon.device.mgt.common.operation.mgt;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
|
@ApiModel(value = "Operation", description = "This class carries all information related to a operations that can be " +
|
||||||
|
"applied on a device.")
|
||||||
public class Operation implements Serializable {
|
public class Operation implements Serializable {
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
@ -38,18 +44,53 @@ public class Operation implements Serializable {
|
|||||||
REPEAT, NO_REPEAT, PAUSE_SEQUENCE, STOP_SEQUENCE
|
REPEAT, NO_REPEAT, PAUSE_SEQUENCE, STOP_SEQUENCE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "code", value = "The code of the operation that you carried out. For example the code of" +
|
||||||
|
" the operation carried out to device info operation is DEVICE_INFO.",
|
||||||
|
required = true)
|
||||||
private String code;
|
private String code;
|
||||||
|
@ApiModelProperty(name = "properties", value = "Properties of an operation containing meta information.",
|
||||||
|
required = true)
|
||||||
private Properties properties;
|
private Properties properties;
|
||||||
|
@ApiModelProperty(name = "type", value = "The operation type that was carried out on the device. " +
|
||||||
|
"The operations types can be one of the following: COMMAND, PROFILE",
|
||||||
|
required = true)
|
||||||
private Type type;
|
private Type type;
|
||||||
|
@ApiModelProperty(name = "id", value = "The operations carried out on a device is recorded in a database table. " +
|
||||||
|
"The ID of the operation in the database table is given as the ID " +
|
||||||
|
"in the output.",
|
||||||
|
required = true)
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "status", value = "The status of the operation that has been carried out on a device. The" +
|
||||||
|
" operation status can be any one of the following:\n" +
|
||||||
|
"IN-PROGRESS - The operation is processing on the EMM server" +
|
||||||
|
" side and has not yet been delivered to the device.\n" +
|
||||||
|
"PENDING - The operation is delivered to the device but the response " +
|
||||||
|
"from the device is pending.\n" +
|
||||||
|
"COMPLETED - The operation is delivered to the device and the server has " +
|
||||||
|
"received a response back from the device.\n" +
|
||||||
|
"ERROR - An error has occurred while carrying out the operation.",
|
||||||
|
required = true)
|
||||||
private Status status;
|
private Status status;
|
||||||
|
@ApiModelProperty(name = "control", value = "How the operation should be executed.", required = true)
|
||||||
private Control control;
|
private Control control;
|
||||||
|
@ApiModelProperty(name = "receivedTimeStamp", value = "The time WSO2 EMM received the response from the device.",
|
||||||
|
required = true)
|
||||||
private String receivedTimeStamp;
|
private String receivedTimeStamp;
|
||||||
|
@ApiModelProperty(name = "createdTimeStamp", value = "The time when the operation was requested to be carried out.",
|
||||||
|
required = true)
|
||||||
private String createdTimeStamp;
|
private String createdTimeStamp;
|
||||||
|
@ApiModelProperty(name = "isEnabled", value = "If the assigned value is true it indicates that a policy is " +
|
||||||
|
"enforced on the device. If the assigned value is false it indicates" +
|
||||||
|
" that a policy is not enforced on a device.", required = true)
|
||||||
private boolean isEnabled;
|
private boolean isEnabled;
|
||||||
|
@ApiModelProperty(name = "payLoad", value = "Payload of the operation to be sent to the device", required = true)
|
||||||
private Object payLoad;
|
private Object payLoad;
|
||||||
|
@ApiModelProperty(name = "operationResponse", value = "Response received from the device", required = true)
|
||||||
private String operationResponse;
|
private String operationResponse;
|
||||||
|
@ApiModelProperty(name = "activityId", value = "The identifier used to identify the operation uniquely.",
|
||||||
|
required = true)
|
||||||
private String activityId;
|
private String activityId;
|
||||||
|
private List<OperationResponse> responses;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
@ -218,6 +259,14 @@ public class Operation implements Serializable {
|
|||||||
this.activityId = activityId;
|
this.activityId = activityId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<OperationResponse> getResponses() {
|
||||||
|
return responses;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponses(List<OperationResponse> responses) {
|
||||||
|
this.responses = responses;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Operation{" +
|
return "Operation{" +
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common.operation.mgt;
|
||||||
|
|
||||||
|
public class OperationResponse {
|
||||||
|
|
||||||
|
private String response;
|
||||||
|
private String recievedTimeStamp;
|
||||||
|
|
||||||
|
public String getResponse() {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponse(String response) {
|
||||||
|
this.response = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecievedTimeStamp() {
|
||||||
|
return recievedTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecievedTimeStamp(String recievedTimeStamp) {
|
||||||
|
this.recievedTimeStamp = recievedTimeStamp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -19,12 +19,74 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common.search;
|
package org.wso2.carbon.device.mgt.common.search;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
@ApiModel(value = "Condition", description = "Contains the advance search parameters.")
|
||||||
public class Condition {
|
public class Condition {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "conditions", value = "Provide the operation code. You can assign the following operation " +
|
||||||
|
"codes:\n" +
|
||||||
|
"DEVICE_MODEL : The model of the device.\n" +
|
||||||
|
"VENDOR : The name of the device vendor.\n" +
|
||||||
|
"OS_VERSION : The version of the device operating system.\n" +
|
||||||
|
"BATTERY_LEVEL : The current level of the device battery.\n" +
|
||||||
|
"INTERNAL_TOTAL_MEMORY : The total capacity of the internal memory" +
|
||||||
|
" available in the device.\n" +
|
||||||
|
"INTERNAL_AVAILABLE_MEMORY : The internal memory in the device " +
|
||||||
|
"that is available.\n" +
|
||||||
|
"EXTERNAL_TOTAL_MEMORY : The total capacity of the external memory " +
|
||||||
|
"available in the device.\n" +
|
||||||
|
"EXTERNAL_AVAILABLE_MEMORY : The external memory in the device" +
|
||||||
|
" that is available.\n" +
|
||||||
|
"CONNECTION_TYPE : Define if the device is connected to the GPRS " +
|
||||||
|
"or Wi-Fi settings.\n" +
|
||||||
|
"SSID : The name of the Wifi network that the device is " +
|
||||||
|
"connected to.\n" +
|
||||||
|
"CPU_USAGE : The current CPU usage of the mobile device.\n" +
|
||||||
|
"TOTAL_RAM_MEMORY : The total capacity of the random access " +
|
||||||
|
"memory available in the device.\n" +
|
||||||
|
"AVAILABLE_RAM_MEMORY : The random access memory capacity " +
|
||||||
|
"in the device that is available.\n" +
|
||||||
|
"PLUGGED_IN : Define true if the device is plugged in for charging " +
|
||||||
|
"or define false if the device is not plugged in for charging.",
|
||||||
|
required = true)
|
||||||
private String key;
|
private String key;
|
||||||
|
@ApiModelProperty(name = "value", value = "Define the value for the key you provide.\n" +
|
||||||
|
"Example: If you provide the key as VERSION, you can provide the " +
|
||||||
|
"value as 5.1, which indicates the version of the mobile device you" +
|
||||||
|
" are searching.",
|
||||||
|
required = true)
|
||||||
private String value;
|
private String value;
|
||||||
|
@ApiModelProperty(name = "operator", value = "Define the search condition between the key and the value you " +
|
||||||
|
"provide. The following values can be used to define the search " +
|
||||||
|
"condition:\n" +
|
||||||
|
"= : Searches for devices where the key is equal to the value " +
|
||||||
|
"provided.\n" +
|
||||||
|
"=! : Searches for devices where the key is not equal to the " +
|
||||||
|
"value provided.\n" +
|
||||||
|
"<= : Searches for devices where the key is greater than or equal" +
|
||||||
|
" to the value provide.\n" +
|
||||||
|
">= : Searches for devices where the key is less than or equal to" +
|
||||||
|
" the value provided.\n" +
|
||||||
|
"> : Searches for devices where the key is greater than the value" +
|
||||||
|
" provided.\n" +
|
||||||
|
"< : Searches for devices where the key is less than the value " +
|
||||||
|
"provided.\n" +
|
||||||
|
"Example: If you wish to get the devises that have the version " +
|
||||||
|
"as 5.1, you need to use the = operator..",
|
||||||
|
required = true)
|
||||||
public String operator;
|
public String operator;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "conditions", value = "There can be many search options as shown in the sample JSON " +
|
||||||
|
"definition. The field that connects the independent search " +
|
||||||
|
"options, is known as state.\n" +
|
||||||
|
"The following values can be assigned to state.\n" +
|
||||||
|
"AND : Defines if you want the search result to match all the " +
|
||||||
|
"search conditions provided.\n" +
|
||||||
|
"OR : Defines if you want the search result to match either of" +
|
||||||
|
" the search conditions provided.",
|
||||||
|
required = true)
|
||||||
private State state;
|
private State state;
|
||||||
|
|
||||||
public enum State {
|
public enum State {
|
||||||
|
|||||||
@ -19,10 +19,17 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common.search;
|
package org.wso2.carbon.device.mgt.common.search;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModel(value = "SearchContext", description = "Search details when carrying out a search contain in this class.")
|
||||||
public class SearchContext {
|
public class SearchContext {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "conditions", value = "Contains the advance search parameters.",
|
||||||
|
required = true)
|
||||||
private List<Condition> conditions;
|
private List<Condition> conditions;
|
||||||
// private int start;
|
// private int start;
|
||||||
// private int end;
|
// private int end;
|
||||||
|
|||||||
@ -83,6 +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.*;resolution:=optional,
|
||||||
org.wso2.carbon,
|
org.wso2.carbon,
|
||||||
org.wso2.carbon.base
|
org.wso2.carbon.base
|
||||||
</Import-Package>
|
</Import-Package>
|
||||||
@ -245,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() {
|
||||||
|
|||||||
@ -46,6 +46,7 @@ public class Operation implements Serializable {
|
|||||||
private boolean isEnabled;
|
private boolean isEnabled;
|
||||||
private Object payLoad;
|
private Object payLoad;
|
||||||
private Object operationResponse;
|
private Object operationResponse;
|
||||||
|
private String activityId;
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
@ -135,4 +136,12 @@ public class Operation implements Serializable {
|
|||||||
this.operationResponse = operationResponse;
|
this.operationResponse = operationResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getActivityId() {
|
||||||
|
return activityId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivityId(String activityId) {
|
||||||
|
this.activityId = activityId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -659,12 +659,57 @@ public class OperationManagerImpl implements OperationManager {
|
|||||||
@Override
|
@Override
|
||||||
public Operation getOperationByActivityId(String activity) throws OperationManagementException {
|
public Operation getOperationByActivityId(String activity) throws OperationManagementException {
|
||||||
// This parses the operation id from activity id (ex : ACTIVITY_23) and converts to the integer.
|
// This parses the operation id from activity id (ex : ACTIVITY_23) and converts to the integer.
|
||||||
int operationId = Integer.parseInt(
|
Operation operation;
|
||||||
|
int enrollmentOpMappingId = Integer.parseInt(
|
||||||
activity.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, ""));
|
activity.replace(DeviceManagementConstants.OperationAttributes.ACTIVITY, ""));
|
||||||
if(operationId == 0){
|
if(enrollmentOpMappingId == 0){
|
||||||
throw new IllegalArgumentException("Operation ID cannot be null or zero (0).");
|
throw new IllegalArgumentException("Operation ID cannot be null or zero (0).");
|
||||||
}
|
}
|
||||||
return this.getOperation(operationId);
|
try {
|
||||||
|
OperationManagementDAOFactory.openConnection();
|
||||||
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation =
|
||||||
|
operationDAO.getOperationFromEnrollment(enrollmentOpMappingId);
|
||||||
|
|
||||||
|
if (dtoOperation == null) {
|
||||||
|
throw new OperationManagementException("Operation not found for given activity Id:" + activity);
|
||||||
|
}
|
||||||
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status status = dtoOperation.getStatus();
|
||||||
|
if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
|
||||||
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
|
||||||
|
commandOperation =
|
||||||
|
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
|
||||||
|
getOperation(dtoOperation.getId());
|
||||||
|
dtoOperation.setEnabled(commandOperation.isEnabled());
|
||||||
|
} else if (dtoOperation.getType().
|
||||||
|
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
|
||||||
|
dtoOperation = configOperationDAO.getOperation(dtoOperation.getId());
|
||||||
|
} else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.
|
||||||
|
PROFILE)) {
|
||||||
|
dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId());
|
||||||
|
} else if (dtoOperation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.
|
||||||
|
POLICY)) {
|
||||||
|
dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId());
|
||||||
|
}
|
||||||
|
operation = OperationDAOUtil.convertOperation(dtoOperation);
|
||||||
|
int enrolmentId = operationDAO.getEnrolmentIdFromMappingId(enrollmentOpMappingId);
|
||||||
|
if (enrolmentId !=0) {
|
||||||
|
operation.setResponses(operationDAO.getOperationResponses(enrolmentId, operation.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
operation.setStatus(Operation.Status.valueOf(status.toString()));
|
||||||
|
operation.setActivityId(activity);
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new OperationManagementException("Error occurred while opening a connection to the data source", e);
|
||||||
|
} catch (OperationManagementDAOException e) {
|
||||||
|
throw new OperationManagementException("Error occurred while retrieving the operation with activity Id '" +
|
||||||
|
activity, e);
|
||||||
|
} finally {
|
||||||
|
OperationManagementDAOFactory.closeConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
// return this.getOperation(operationId);
|
||||||
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OperationDAO lookupOperationDAO(Operation operation) {
|
private OperationDAO lookupOperationDAO(Operation operation) {
|
||||||
@ -722,4 +767,8 @@ public class OperationManagerImpl implements OperationManager {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setActivityId(Operation operation, int enrolmentId) {
|
||||||
|
operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + enrolmentId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
package org.wso2.carbon.device.mgt.core.operation.mgt.dao;
|
package org.wso2.carbon.device.mgt.core.operation.mgt.dao;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationResponse;
|
||||||
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -33,6 +34,8 @@ public interface OperationDAO {
|
|||||||
|
|
||||||
Operation getOperation(int operationId) throws OperationManagementDAOException;
|
Operation getOperation(int operationId) throws OperationManagementDAOException;
|
||||||
|
|
||||||
|
Operation getOperationFromEnrollment(int enrollmentOpMappingId) throws OperationManagementDAOException;
|
||||||
|
|
||||||
Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException;
|
Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException;
|
||||||
|
|
||||||
List<? extends Operation> getOperationsByDeviceAndStatus(int enrolmentId, Operation.Status status)
|
List<? extends Operation> getOperationsByDeviceAndStatus(int enrolmentId, Operation.Status status)
|
||||||
@ -58,4 +61,8 @@ public interface OperationDAO {
|
|||||||
void addOperationResponse(int enrolmentId, int operationId, Object operationResponse)
|
void addOperationResponse(int enrolmentId, int operationId, Object operationResponse)
|
||||||
throws OperationManagementDAOException;
|
throws OperationManagementDAOException;
|
||||||
|
|
||||||
|
List<OperationResponse> getOperationResponses(int enrolmentId, int operationId) throws OperationManagementDAOException;
|
||||||
|
|
||||||
|
int getEnrolmentIdFromMappingId(int enrollmentOpMappingId) throws OperationManagementDAOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -20,15 +20,15 @@ package org.wso2.carbon.device.mgt.core.operation.mgt.dao.impl;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
||||||
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationResponse;
|
||||||
|
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
|
||||||
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
||||||
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO;
|
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO;
|
||||||
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
|
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
|
||||||
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
|
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
|
||||||
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil;
|
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.*;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -149,7 +149,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
try {
|
try {
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
stmt = connection.prepareStatement("INSERT INTO DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID,ENROLMENT_ID," +
|
stmt = connection.prepareStatement("INSERT INTO DM_DEVICE_OPERATION_RESPONSE(OPERATION_ID,ENROLMENT_ID," +
|
||||||
"OPERATION_RESPONSE) VALUES(?, ?, ?)");
|
"OPERATION_RESPONSE, RECEIVED_TIMESTAMP) VALUES(?, ?, ?, ?)");
|
||||||
bao = new ByteArrayOutputStream();
|
bao = new ByteArrayOutputStream();
|
||||||
oos = new ObjectOutputStream(bao);
|
oos = new ObjectOutputStream(bao);
|
||||||
oos.writeObject(operationResponse);
|
oos.writeObject(operationResponse);
|
||||||
@ -157,6 +157,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
stmt.setInt(1, operationId);
|
stmt.setInt(1, operationId);
|
||||||
stmt.setInt(2, enrolmentId);
|
stmt.setInt(2, enrolmentId);
|
||||||
stmt.setBytes(3, bao.toByteArray());
|
stmt.setBytes(3, bao.toByteArray());
|
||||||
|
stmt.setTimestamp(4, new Timestamp(new Date().getTime()));
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new OperationManagementDAOException("Error occurred while inserting operation response", e);
|
throw new OperationManagementDAOException("Error occurred while inserting operation response", e);
|
||||||
@ -181,6 +182,92 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<OperationResponse> getOperationResponses(int enrolmentId, int operationId) throws
|
||||||
|
OperationManagementDAOException {
|
||||||
|
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
List<OperationResponse> responces = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT * FROM DM_DEVICE_OPERATION_RESPONSE WHERE ENROLMENT_ID = ? AND OPERATION_ID = ?";
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, enrolmentId);
|
||||||
|
stmt.setInt(2, operationId);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
OperationResponse response = new OperationResponse();
|
||||||
|
response.setRecievedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
||||||
|
ByteArrayInputStream bais = null;
|
||||||
|
ObjectInputStream ois = null;
|
||||||
|
byte[] contentBytes;
|
||||||
|
try {
|
||||||
|
contentBytes = (byte[]) rs.getBytes("OPERATION_RESPONSE");
|
||||||
|
bais = new ByteArrayInputStream(contentBytes);
|
||||||
|
ois = new ObjectInputStream(bais);
|
||||||
|
response.setResponse(ois.readObject().toString());
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (bais != null) {
|
||||||
|
try {
|
||||||
|
bais.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.warn("Error occurred while closing ByteArrayOutputStream", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ois != null) {
|
||||||
|
try {
|
||||||
|
ois.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.warn("Error occurred while closing ObjectOutputStream", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
responces.add(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new OperationManagementDAOException("SQL Error occurred while retrieving the operation responses for " +
|
||||||
|
"operation id " + operationId + " and enrolment id " + enrolmentId, e);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new OperationManagementDAOException("Error occurred while converting the operation responses to string" +
|
||||||
|
" for operation id " + operationId + " and enrolment id " + enrolmentId, e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new OperationManagementDAOException("Error occurred while converting the operation responses to string" +
|
||||||
|
" for operation id " + operationId + " and enrolment id " + enrolmentId, e);
|
||||||
|
} finally {
|
||||||
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return responces;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getEnrolmentIdFromMappingId(int enrollmentOpMappingId) throws OperationManagementDAOException {
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try {
|
||||||
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT * FROM DM_ENROLMENT_OP_MAPPING WHERE ID = ?";
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, enrollmentOpMappingId);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
if (rs.next()) {
|
||||||
|
return rs.getInt("ENROLMENT_ID");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new OperationManagementDAOException("SQL Error occurred while retrieving the enrolment id " +
|
||||||
|
" for the mapping id '" + enrollmentOpMappingId, e);
|
||||||
|
} finally {
|
||||||
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteOperation(int id) throws OperationManagementDAOException {
|
public void deleteOperation(int id) throws OperationManagementDAOException {
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
@ -231,6 +318,43 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Operation getOperationFromEnrollment(int enrollmentOpMappingId) throws OperationManagementDAOException {
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
Operation operation = null;
|
||||||
|
try {
|
||||||
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
|
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, \n" +
|
||||||
|
" om.STATUS FROM DM_OPERATION o \n" +
|
||||||
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm WHERE dm.ID = ? ) om \n" +
|
||||||
|
"ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC ";
|
||||||
|
stmt = conn.prepareStatement(sql);
|
||||||
|
stmt.setInt(1, enrollmentOpMappingId);
|
||||||
|
rs = stmt.executeQuery();
|
||||||
|
|
||||||
|
if (rs.next()) {
|
||||||
|
operation = new Operation();
|
||||||
|
operation.setId(rs.getInt("ID"));
|
||||||
|
operation.setType(Operation.Type.valueOf(rs.getString("TYPE")));
|
||||||
|
operation.setCreatedTimeStamp(rs.getTimestamp("CREATED_TIMESTAMP").toString());
|
||||||
|
if (rs.getTimestamp("RECEIVED_TIMESTAMP") == null) {
|
||||||
|
operation.setReceivedTimeStamp("");
|
||||||
|
} else {
|
||||||
|
operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
||||||
|
}
|
||||||
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
||||||
|
this.setActivityId(operation, enrollmentOpMappingId);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation .", e);
|
||||||
|
} finally {
|
||||||
|
OperationManagementDAOUtil.cleanupResources(stmt, rs);
|
||||||
|
}
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException {
|
public Operation getOperationByDeviceAndId(int enrolmentId, int operationId) throws OperationManagementDAOException {
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
@ -238,7 +362,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
Operation operation = null;
|
Operation operation = null;
|
||||||
try {
|
try {
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE " +
|
String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE, om.ID AS OM_MAPPING_ID " +
|
||||||
" FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS," +
|
" FROM (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS," +
|
||||||
"OPERATION_CODE FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " +
|
"OPERATION_CODE FROM DM_OPERATION WHERE id = ?) o INNER JOIN (SELECT * FROM " +
|
||||||
"DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " +
|
"DM_ENROLMENT_OP_MAPPING dm where dm.OPERATION_ID = ? AND dm.ENROLMENT_ID = ?) om " +
|
||||||
@ -260,6 +384,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
throw new OperationManagementDAOException("SQL error occurred while retrieving the operation " +
|
||||||
@ -279,7 +404,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
List<Operation> operations = new ArrayList<Operation>();
|
List<Operation> operations = new ArrayList<Operation>();
|
||||||
try {
|
try {
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
|
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, om.ID AS OM_MAPPING_ID" +
|
||||||
"FROM DM_OPERATION o " +
|
"FROM DM_OPERATION o " +
|
||||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC";
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC";
|
||||||
@ -300,6 +425,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
operation.setStatus(status);
|
operation.setStatus(status);
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
operations.add(operation);
|
operations.add(operation);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -321,7 +447,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
List<Operation> operations = new ArrayList<Operation>();
|
List<Operation> operations = new ArrayList<Operation>();
|
||||||
try {
|
try {
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
|
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, om.ID AS OM_MAPPING_ID " +
|
||||||
"FROM DM_OPERATION o " +
|
"FROM DM_OPERATION o " +
|
||||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " +
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID ORDER BY " +
|
||||||
@ -345,6 +471,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
operation.setStatus(status);
|
operation.setStatus(status);
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
operations.add(operation);
|
operations.add(operation);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -365,7 +492,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
try {
|
try {
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
||||||
"OPERATION_CODE, om.STATUS FROM DM_OPERATION o " +
|
"OPERATION_CODE, om.STATUS, om.ID AS OM_MAPPING_ID FROM DM_OPERATION o " +
|
||||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC";
|
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC";
|
||||||
stmt = conn.prepareStatement(sql);
|
stmt = conn.prepareStatement(sql);
|
||||||
@ -384,6 +511,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
operations.add(operation);
|
operations.add(operation);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -405,7 +533,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
try {
|
try {
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
||||||
"OPERATION_CODE, om.STATUS FROM DM_OPERATION o " +
|
"OPERATION_CODE, om.STATUS, om.ID AS OM_MAPPING_ID FROM DM_OPERATION o " +
|
||||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
"WHERE dm.ENROLMENT_ID = ?) om ON o.ID = om.OPERATION_ID ORDER BY o.CREATED_TIMESTAMP DESC LIMIT ?,?";
|
||||||
stmt = conn.prepareStatement(sql);
|
stmt = conn.prepareStatement(sql);
|
||||||
@ -426,6 +554,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
operation.setStatus(Operation.Status.valueOf(rs.getString("STATUS")));
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
operations.add(operation);
|
operations.add(operation);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -468,7 +597,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
try {
|
try {
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
stmt = connection.prepareStatement("SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
stmt = connection.prepareStatement("SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, " +
|
||||||
"OPERATION_CODE FROM DM_OPERATION o " +
|
"OPERATION_CODE, om.ID AS OM_MAPPING_ID FROM DM_OPERATION o " +
|
||||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID " +
|
"WHERE dm.ENROLMENT_ID = ? AND dm.STATUS = ?) om ON o.ID = om.OPERATION_ID " +
|
||||||
"ORDER BY o.CREATED_TIMESTAMP ASC LIMIT 1");
|
"ORDER BY o.CREATED_TIMESTAMP ASC LIMIT 1");
|
||||||
@ -489,6 +618,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
operation.setStatus(Operation.Status.PENDING);
|
operation.setStatus(Operation.Status.PENDING);
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
}
|
}
|
||||||
return operation;
|
return operation;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -507,7 +637,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
List<Operation> operations = new ArrayList<Operation>();
|
List<Operation> operations = new ArrayList<Operation>();
|
||||||
try {
|
try {
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE FROM " +
|
String sql = "SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, om.ID AS OM_MAPPING_ID FROM " +
|
||||||
"(SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
|
"(SELECT o.ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE " +
|
||||||
"FROM DM_OPERATION o WHERE o.TYPE = ?) o " +
|
"FROM DM_OPERATION o WHERE o.TYPE = ?) o " +
|
||||||
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
"INNER JOIN (SELECT * FROM DM_ENROLMENT_OP_MAPPING dm " +
|
||||||
@ -530,6 +660,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
operation.setReceivedTimeStamp(rs.getTimestamp("RECEIVED_TIMESTAMP").toString());
|
||||||
}
|
}
|
||||||
operation.setCode(rs.getString("OPERATION_CODE"));
|
operation.setCode(rs.getString("OPERATION_CODE"));
|
||||||
|
this.setActivityId(operation, rs.getInt("OM_MAPPING_ID"));
|
||||||
operations.add(operation);
|
operations.add(operation);
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
@ -545,4 +676,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
return Operation.Type.valueOf(type);
|
return Operation.Type.valueOf(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setActivityId(Operation operation, int enrolmentId) {
|
||||||
|
operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + enrolmentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ public class OperationDAOUtil {
|
|||||||
operation.setReceivedTimeStamp(dtoOperation.getReceivedTimeStamp());
|
operation.setReceivedTimeStamp(dtoOperation.getReceivedTimeStamp());
|
||||||
operation.setEnabled(dtoOperation.isEnabled());
|
operation.setEnabled(dtoOperation.isEnabled());
|
||||||
operation.setProperties(dtoOperation.getProperties());
|
operation.setProperties(dtoOperation.getProperties());
|
||||||
operation.setActivityId(DeviceManagementConstants.OperationAttributes.ACTIVITY + dtoOperation.getId());
|
operation.setActivityId(dtoOperation.getActivityId());
|
||||||
|
|
||||||
|
|
||||||
return operation;
|
return operation;
|
||||||
|
|||||||
@ -53,6 +53,8 @@
|
|||||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
<Bundle-Description>Policy Management Common Bundle</Bundle-Description>
|
<Bundle-Description>Policy Management Common Bundle</Bundle-Description>
|
||||||
<Import-Package>
|
<Import-Package>
|
||||||
|
javax.xml.bind.annotation,
|
||||||
|
io.swagger.annotations.*;resolution:=optional,
|
||||||
org.wso2.carbon.device.mgt.common.*,
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
org.wso2.carbon.device.mgt.core.dto.*,
|
org.wso2.carbon.device.mgt.core.dto.*,
|
||||||
javax.xml.bind.*,
|
javax.xml.bind.*,
|
||||||
@ -91,6 +93,11 @@
|
|||||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-annotations</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.wso2.carbon.policy.mgt.common;
|
package org.wso2.carbon.policy.mgt.common;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
@ -29,24 +31,50 @@ import java.util.Map;
|
|||||||
* This class will be the used to create policy object with relevant information for evaluating.
|
* This class will be the used to create policy object with relevant information for evaluating.
|
||||||
*/
|
*/
|
||||||
@XmlRootElement
|
@XmlRootElement
|
||||||
|
@ApiModel(value = "Policy", description = "This class carries all information related to Policies")
|
||||||
public class Policy implements Comparable<Policy>, Serializable {
|
public class Policy implements Comparable<Policy>, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 19981017L;
|
private static final long serialVersionUID = 19981017L;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "The policy ID", required = true)
|
||||||
private int id; // Identifier of the policy.
|
private int id; // Identifier of the policy.
|
||||||
|
@ApiModelProperty(name = "priorityId", value = "The priority order of the policy. 1 indicates the highest"
|
||||||
|
+ " priority", required = true)
|
||||||
private int priorityId; // Priority of the policies. This will be used only for simple evaluation.
|
private int priorityId; // Priority of the policies. This will be used only for simple evaluation.
|
||||||
|
@ApiModelProperty(name = "profile", value = "Contains the details of the profile that is included in the "
|
||||||
|
+ "policy", required = true)
|
||||||
private Profile profile; // Profile
|
private Profile profile; // Profile
|
||||||
|
@ApiModelProperty(name = "policyName", value = "The name of the policy", required = true)
|
||||||
private String policyName; // Name of the policy.
|
private String policyName; // Name of the policy.
|
||||||
|
@ApiModelProperty(name = "generic", value = "If true, this should be applied to all related device",
|
||||||
|
required = true)
|
||||||
private boolean generic; // If true, this should be applied to all related device.
|
private boolean generic; // If true, this should be applied to all related device.
|
||||||
|
@ApiModelProperty(name = "roles", value = "The roles to whom the policy is applied on", required = true)
|
||||||
private List<String> roles; // Roles which this policy should be applied.
|
private List<String> roles; // Roles which this policy should be applied.
|
||||||
|
@ApiModelProperty(name = "ownershipType", value = "The policy ownership type. It can be any of the "
|
||||||
|
+ "following values:\n"
|
||||||
|
+ "ANY - The policy will be applied on the BYOD and COPE device types\n"
|
||||||
|
+ "BYOD (Bring Your Own Device) - The policy will only be applied on the BYOD device type\n"
|
||||||
|
+ "COPE (Corporate-Owned, Personally-Enabled) - The policy will only be applied on the COPE "
|
||||||
|
+ "device type\n", required = true)
|
||||||
private String ownershipType; // Ownership type (COPE, BYOD, CPE)
|
private String ownershipType; // Ownership type (COPE, BYOD, CPE)
|
||||||
|
@ApiModelProperty(name = "devices", value = "Lists out the devices the policy is enforced on",
|
||||||
|
required = true)
|
||||||
private List<Device> devices; // Individual devices this policy should be applied
|
private List<Device> devices; // Individual devices this policy should be applied
|
||||||
|
@ApiModelProperty(name = "users", value = "Lists out the users on whose devices the policy is enforced",
|
||||||
|
required = true)
|
||||||
private List<String> users;
|
private List<String> users;
|
||||||
|
@ApiModelProperty(name = "active", value = "If the value is true it indicates that the policy is active. "
|
||||||
|
+ "If the value is false it indicates that the policy is inactive", required = true)
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
@ApiModelProperty(name = "updated", value = "If you have made changes to the policy but have not applied"
|
||||||
|
+ " these changes to the devices that are registered with EMM, then the value is defined as true."
|
||||||
|
+ " But if you have already applied any changes made to the policy then the value is defined as"
|
||||||
|
+ " false.", required = true)
|
||||||
private boolean updated;
|
private boolean updated;
|
||||||
|
@ApiModelProperty(name = "description", value = "Gives a description on the policy", required = true)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
/* Compliance data*/
|
/* Compliance data*/
|
||||||
private String compliance;
|
private String compliance;
|
||||||
|
|
||||||
|
|||||||
@ -18,16 +18,29 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.policy.mgt.common;
|
package org.wso2.carbon.policy.mgt.common;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ApiModel(value = "ProfileFeature", description = "This class carries all information related to profile "
|
||||||
|
+ "features")
|
||||||
public class ProfileFeature implements Serializable {
|
public class ProfileFeature implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 19981018L;
|
private static final long serialVersionUID = 19981018L;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "id", value = "Define the ID", required = true)
|
||||||
private int id;
|
private int id;
|
||||||
|
@ApiModelProperty(name = "featureCode", value = "Provide the code that defines the policy you wish to add",
|
||||||
|
required = true)
|
||||||
private String featureCode;
|
private String featureCode;
|
||||||
|
@ApiModelProperty(name = "profileId", value = "Define the ID of the profile", required = true)
|
||||||
private int profileId;
|
private int profileId;
|
||||||
|
@ApiModelProperty(name = "deviceTypeId", value = "The ID used to define the type of the device platform",
|
||||||
|
required = true)
|
||||||
private int deviceTypeId;
|
private int deviceTypeId;
|
||||||
|
@ApiModelProperty(name = "content", value = "The list of parameters that define the policy",
|
||||||
|
required = true)
|
||||||
private Object content;
|
private Object content;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
|
|||||||
@ -123,6 +123,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|||||||
ENROLMENT_ID INTEGER NOT NULL,
|
ENROLMENT_ID INTEGER NOT NULL,
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
||||||
|
RECEIVED_TIMESTAMP TIMESTAMP NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
||||||
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
|
|||||||
@ -123,6 +123,7 @@ CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
|
|||||||
ENROLMENT_ID INTEGER NOT NULL,
|
ENROLMENT_ID INTEGER NOT NULL,
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
OPERATION_RESPONSE VARBINARY(max) DEFAULT NULL,
|
OPERATION_RESPONSE VARBINARY(max) DEFAULT NULL,
|
||||||
|
RECEIVED_TIMESTAMP DATETIME2(0) NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
||||||
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
|
|||||||
@ -108,6 +108,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|||||||
ENROLMENT_ID INTEGER NOT NULL,
|
ENROLMENT_ID INTEGER NOT NULL,
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
||||||
|
RECEIVED_TIMESTAMP TIMESTAMP NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (ID),
|
||||||
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
||||||
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
|
|||||||
@ -229,6 +229,7 @@ CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
|
|||||||
ENROLMENT_ID NUMBER(10) NOT NULL,
|
ENROLMENT_ID NUMBER(10) NOT NULL,
|
||||||
OPERATION_ID NUMBER(10) NOT NULL,
|
OPERATION_ID NUMBER(10) NOT NULL,
|
||||||
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
OPERATION_RESPONSE BLOB DEFAULT NULL,
|
||||||
|
RECEIVED_TIMESTAMP TIMESTAMP(0) NULL,
|
||||||
CONSTRAINT PK_DM_DEVICE_OP_RESPONSE PRIMARY KEY (ID),
|
CONSTRAINT PK_DM_DEVICE_OP_RESPONSE PRIMARY KEY (ID),
|
||||||
CONSTRAINT FK_DM_DEVICE_OP_RES_DEVICE FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
CONSTRAINT FK_DM_DEVICE_OP_RES_DEVICE FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
||||||
DM_ENROLMENT (ID),
|
DM_ENROLMENT (ID),
|
||||||
|
|||||||
@ -94,6 +94,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE (
|
|||||||
ENROLMENT_ID INTEGER NOT NULL,
|
ENROLMENT_ID INTEGER NOT NULL,
|
||||||
OPERATION_ID INTEGER NOT NULL,
|
OPERATION_ID INTEGER NOT NULL,
|
||||||
OPERATION_RESPONSE BYTEA DEFAULT NULL,
|
OPERATION_RESPONSE BYTEA DEFAULT NULL,
|
||||||
|
RECEIVED_TIMESTAMP TIMESTAMP NULL,
|
||||||
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
CONSTRAINT fk_dm_device_operation_response_enrollment FOREIGN KEY (ENROLMENT_ID) REFERENCES
|
||||||
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
DM_ENROLMENT (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||||
CONSTRAINT fk_dm_device_operation_response_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
CONSTRAINT fk_dm_device_operation_response_operation FOREIGN KEY (OPERATION_ID) REFERENCES
|
||||||
|
|||||||
1
pom.xml
1
pom.xml
@ -1836,6 +1836,7 @@
|
|||||||
<nimbus.orbit.version.range>[2.26.1, 3.0.0)</nimbus.orbit.version.range>
|
<nimbus.orbit.version.range>[2.26.1, 3.0.0)</nimbus.orbit.version.range>
|
||||||
|
|
||||||
<swagger.version>1.5.8</swagger.version>
|
<swagger.version>1.5.8</swagger.version>
|
||||||
|
<servlet-api.version>2.5</servlet-api.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user