Improving swagger annotations of CDM-F core APIs further

revert-70aa11f8
prabathabey 9 years ago
parent 95458ce9b0
commit 425c0e7498

@ -32,6 +32,7 @@ import javax.ws.rs.core.Response;
* Activity related REST-API implementation.
*/
@API(name = "Activities", version = "1.0.0", context = "/devicemgt_admin/activities", tags = {"devicemgt_admin"})
@Path("/activities")
@Api(value = "Activity Info Provider", description = "Activity related information manipulation. For example operation details " +
"and responses from devices.")
@ -48,7 +49,8 @@ public interface ActivityInfoProviderService {
response = Activity.class,
value = "Retrieve details of a particular activity.",
notes = "This will return information of a particular activity i.e. meta information of an operation, " +
"etc; including the responses from the devices.")
"etc; including the responses from the devices.",
tags = "Activity Info Provider")
@ApiResponses(value = {
@ApiResponse(
code = 200,

@ -45,7 +45,8 @@ public interface ConfigurationManagementService {
httpMethod = "GET",
value = "Get the general platform configurations.",
notes = "Get the general platform level configuration details.",
response = PlatformConfiguration.class)
response = PlatformConfiguration.class,
tags = "Configuration Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -90,7 +91,8 @@ public interface ConfigurationManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Update General Platform Configurations.",
notes = "This resource is used to update the general platform configuration.")
notes = "This resource is used to update the general platform configuration.",
tags = "Configuration Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,

@ -7,75 +7,75 @@ import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
@Path("/dashboard")
@Api(value = "Dashboard", description = "Dashboard related operations are described here.")
//@Path("/dashboard")
//@Api(value = "Dashboard", description = "Dashboard related operations are described here.")
@SuppressWarnings("NonJaxWsWebServices")
public interface Dashboard {
String CONNECTIVITY_STATUS = "connectivity-status";
String POTENTIAL_VULNERABILITY = "potential-vulnerability";
String NON_COMPLIANT_FEATURE_CODE = "non-compliant-feature-code";
String PLATFORM = "platform";
String OWNERSHIP = "ownership";
// Constants related to pagination
String PAGINATION_ENABLED = "pagination-enabled";
String START_INDEX = "start";
String RESULT_COUNT = "length";
@GET
@Path("device-count-overview")
Response getOverviewDeviceCounts();
@GET
@Path("device-counts-by-potential-vulnerabilities")
Response getDeviceCountsByPotentialVulnerabilities();
@GET
@Path("non-compliant-device-counts-by-features")
Response getNonCompliantDeviceCountsByFeatures(@QueryParam(START_INDEX) int startIndex,
@QueryParam(RESULT_COUNT) int resultCount);
@GET
@Path("device-counts-by-groups")
Response getDeviceCountsByGroups(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("feature-non-compliant-device-counts-by-groups")
Response getFeatureNonCompliantDeviceCountsByGroups(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("filtered-device-count-over-total")
Response getFilteredDeviceCountOverTotal(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("feature-non-compliant-device-count-over-total")
Response getFeatureNonCompliantDeviceCountOverTotal(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership);
@GET
@Path("devices-with-details")
Response getDevicesWithDetails(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
@QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership,
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
@QueryParam(START_INDEX) int startIndex,
@QueryParam(RESULT_COUNT) int resultCount);
@GET
@Path("feature-non-compliant-devices-with-details")
Response getFeatureNonCompliantDevicesWithDetails(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
@QueryParam(PLATFORM) String platform,
@QueryParam(OWNERSHIP) String ownership,
@QueryParam(PAGINATION_ENABLED) String paginationEnabled,
@QueryParam(START_INDEX) int startIndex,
@QueryParam(RESULT_COUNT) int resultCount);
// String CONNECTIVITY_STATUS = "connectivity-status";
// String POTENTIAL_VULNERABILITY = "potential-vulnerability";
// String NON_COMPLIANT_FEATURE_CODE = "non-compliant-feature-code";
// String PLATFORM = "platform";
// String OWNERSHIP = "ownership";
// // Constants related to pagination
// String PAGINATION_ENABLED = "pagination-enabled";
// String START_INDEX = "start";
// String RESULT_COUNT = "length";
//
// @GET
// @Path("device-count-overview")
// Response getOverviewDeviceCounts();
//
// @GET
// @Path("device-counts-by-potential-vulnerabilities")
// Response getDeviceCountsByPotentialVulnerabilities();
//
// @GET
// @Path("non-compliant-device-counts-by-features")
// Response getNonCompliantDeviceCountsByFeatures(@QueryParam(START_INDEX) int startIndex,
// @QueryParam(RESULT_COUNT) int resultCount);
//
// @GET
// @Path("device-counts-by-groups")
// Response getDeviceCountsByGroups(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
// @QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
//
// @GET
// @Path("feature-non-compliant-device-counts-by-groups")
// Response getFeatureNonCompliantDeviceCountsByGroups(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
// @GET
// @Path("filtered-device-count-over-total")
// Response getFilteredDeviceCountOverTotal(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
// @QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
//
// @GET
// @Path("feature-non-compliant-device-count-over-total")
// Response getFeatureNonCompliantDeviceCountOverTotal(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership);
//
// @GET
// @Path("devices-with-details")
// Response getDevicesWithDetails(@QueryParam(CONNECTIVITY_STATUS) String connectivityStatus,
// @QueryParam(POTENTIAL_VULNERABILITY) String potentialVulnerability,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership,
// @QueryParam(PAGINATION_ENABLED) String paginationEnabled,
// @QueryParam(START_INDEX) int startIndex,
// @QueryParam(RESULT_COUNT) int resultCount);
//
// @GET
// @Path("feature-non-compliant-devices-with-details")
// Response getFeatureNonCompliantDevicesWithDetails(@QueryParam(NON_COMPLIANT_FEATURE_CODE) String nonCompliantFeatureCode,
// @QueryParam(PLATFORM) String platform,
// @QueryParam(OWNERSHIP) String ownership,
// @QueryParam(PAGINATION_ENABLED) String paginationEnabled,
// @QueryParam(START_INDEX) int startIndex,
// @QueryParam(RESULT_COUNT) int resultCount);
}

@ -42,6 +42,7 @@ import java.util.List;
* Device related REST-API. This can be used to manipulated device related details.
*/
@API(name = "Device", version = "1.0.0", context = "/api/device-mgt/admin/devices", tags = {"devicemgt_admin"})
@Path("/devices")
@Api(value = "Device Management", description = "This API carries all device management related operations " +
"such as get all the available devices, etc.")
@ -56,7 +57,8 @@ public interface DeviceManagementService {
value = "Get the list of devices enrolled with the system.",
notes = "Returns all devices enrolled with the system.",
response = Device.class,
responseContainer = "List")
responseContainer = "List",
tags = "Device Management")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of devices.",
response = Device.class,
@ -136,7 +138,8 @@ public interface DeviceManagementService {
notes = "This will return device information such as CPU usage, memory usage etc for supplied device " +
"identifiers.",
response = DeviceInfo.class,
responseContainer = "List")
responseContainer = "List",
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -198,7 +201,8 @@ public interface DeviceManagementService {
httpMethod = "GET",
value = "Get information of the requested device.",
notes = "Returns information of the requested device.",
response = Device.class)
response = Device.class,
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -259,7 +263,8 @@ public interface DeviceManagementService {
value = "Get the device location of a given device and a device type.",
notes = "This will return the device location including latitude and longitude as well the "
+ "physical address.",
response = DeviceLocation.class)
response = DeviceLocation.class,
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -306,7 +311,8 @@ public interface DeviceManagementService {
"Using this REST API you can get the features that can be carried out on a preferred device type," +
" such as iOS, Android or Windows.",
response = Feature.class,
responseContainer = "List")
responseContainer = "List",
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -380,7 +386,8 @@ public interface DeviceManagementService {
value = "Advanced search for devices.",
notes = "Carry out an advanced search of devices.",
response = DeviceWrapper.class,
responseContainer = "List")
responseContainer = "List",
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -421,10 +428,6 @@ public interface DeviceManagementService {
})
@Permission(scope = "device-search", permissions = {"/permission/admin/device-mgt/admin/devices/list"})
Response searchDevices(
@ApiParam(
name = "searchContext",
value = "List of search conditions.",
required = true) SearchContext searchContext,
@ApiParam(
name = "offset",
value = "Starting point within the complete list of items qualified.",
@ -434,7 +437,12 @@ public interface DeviceManagementService {
name = "limit",
value = "Maximum size of resource array to return.",
required = false)
@QueryParam("limit") int limit);
@QueryParam("limit") int limit,
@ApiParam(
name = "searchContext",
value = "List of search conditions.",
required = true)
SearchContext searchContext);
@GET
@Path("/{type}/{id}/applications")
@ -444,7 +452,8 @@ public interface DeviceManagementService {
value = "Getting installed application details of a device.",
responseContainer = "List",
notes = "Get the list of applications that a device has subscribed.",
response = Application.class)
response = Application.class,
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -530,7 +539,9 @@ public interface DeviceManagementService {
notes = "You will carry out many operations on a device. In a situation where you wish to view the all" +
" the operations carried out on a device it is not feasible to show all the details on one page" +
" therefore the details are paginated.",
response = Operation.class)
response = Operation.class,
responseContainer = "List",
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(
@ -615,7 +626,8 @@ public interface DeviceManagementService {
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" +
" type , filters based on the user role or name and finally the policy is enforced on the device.",
response = Policy.class)
response = Policy.class,
tags = "Device Management")
@ApiResponses(
value = {
@ApiResponse(

@ -26,79 +26,77 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
@Path("/groups")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
//@Path("/groups")
//@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON)
public interface GroupManagementService {
@GET
@Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
Response getGroups(@QueryParam("offset") int offset, @QueryParam("limit") int limit);
@POST
@Permission(scope = "group-add", permissions = {"/permission/admin/device-mgt/user/groups/add"})
Response createGroup(DeviceGroup group);
@Path("/{groupName}")
@GET
@Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/view"})
Response getGroup(@PathParam("groupName") String groupName);
@Path("/{groupName}")
@PUT
@Permission(scope = "group-modify", permissions = {"/permission/admin/device-mgt/user/groups/update"})
Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup);
@Path("/{groupName}")
@DELETE
@Permission(scope = "group-remove", permissions = {"/permission/admin/device-mgt/user/groups/remove"})
Response deleteGroup(@PathParam("groupName") String groupName);
@Path("/share-group-with-user")
@POST
@Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/share"})
Response shareGroupWithUser(String groupName, String targetUser);
@Path("/share-group-with-role")
@POST
@Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/share"})
Response shareGroupWithRole(String groupName, String targetRole);
@Path("/remove-share-with-user")
@POST
@Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/unshare"})
Response removeShareWithUser(@PathParam("groupName") String groupName, @QueryParam("username") String targetUser);
@Path("/remove-share-with-role")
@POST
@Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/unshare"})
Response removeShareWithRole(@PathParam("groupName") String groupName, @QueryParam("roleName") String targetUser);
@GET
@Path("/{groupName}/users")
@Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
Response getUsersOfGroup(@PathParam("groupName") String groupName);
@GET
@Path("/{groupName}/devices")
@Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/admin/groups/roles"})
Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
@QueryParam("limit") int limit);
@POST
@Path("/{groupName}/devices")
@Produces("application/json")
@Permission(scope = "group-add", permissions = {"/permission/admin/device-mgt/user/groups/devices/add"})
Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier);
@DELETE
@Path("/{groupName}/devices")
@Permission(scope = "group-remove", permissions = {"/permission/admin/device-mgt/user/groups/devices/remove"})
Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
@QueryParam("id") String id);
// @GET
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
// Response getGroups(@QueryParam("user") String user, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit);
//
// @POST
// @Permission(scope = "group-add", permissions = {"/permission/admin/device-mgt/user/groups/add"})
// Response createGroup(DeviceGroup group);
//
// @Path("/{groupName}")
// @GET
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/view"})
// Response getGroup(@PathParam("groupName") String groupName);
//
// @Path("/{groupName}")
// @PUT
// @Permission(scope = "group-modify", permissions = {"/permission/admin/device-mgt/user/groups/update"})
// Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup);
//
// @Path("/{groupName}")
// @DELETE
// @Permission(scope = "group-remove", permissions = {"/permission/admin/device-mgt/user/groups/remove"})
// Response deleteGroup(@PathParam("groupName") String groupName);
//
// @Path("/{groupName}/share-with-user")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/share"})
// Response shareGroupWithUser(@PathParam("groupName") String groupName, String targetUser);
//
// @Path("/{groupName}/share-with-role")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/share"})
// Response shareGroupWithRole(@PathParam("groupName") String groupName, String targetRole);
//
// @Path("/{groupName}/remove-share-with-user")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/unshare"})
// Response removeShareWithUser(@PathParam("groupName") String groupName, String targetUser);
//
// @Path("/{groupName}/remove-share-with-role")
// @POST
// @Permission(scope = "group-share", permissions = {"/permission/admin/device-mgt/user/groups/unshare"})
// Response removeShareWithRole(@PathParam("groupName") String groupName, String targetUser);
//
// @GET
// @Path("/{groupName}/users")
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
// Response getUsersOfGroup(@PathParam("groupName") String groupName);
//
// @GET
// @Path("/{groupName}/devices")
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/admin/groups/roles"})
// Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit);
//
// @POST
// @Path("/{groupName}/devices")
// @Produces("application/json")
// @Permission(scope = "group-add", permissions = {"/permission/admin/device-mgt/user/groups/devices/add"})
// Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier);
//
// @DELETE
// @Path("/{groupName}/devices")
// @Permission(scope = "group-remove", permissions = {"/permission/admin/device-mgt/user/groups/devices/remove"})
// Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
// @QueryParam("id") String id);
@GET
Response getGroupsByUser(@QueryParam("user") String user);
}

@ -46,7 +46,8 @@ public interface NotificationManagementService {
notes = "Get the details of all notifications that were pushed to the device in WSO2 EMM using "
+ "this REST API",
response = Notification.class,
responseContainer = "List")
responseContainer = "List",
tags = "Device Notification Management")
@ApiResponses(
value = {
@ApiResponse(
@ -112,7 +113,8 @@ public interface NotificationManagementService {
httpMethod = "PUT",
value = "Update the device notification status",
notes = "When a user has read the the device notifications, 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.",
tags = "Device Notification Management")
@ApiResponses(
value = {
@ApiResponse(
@ -167,7 +169,8 @@ public interface NotificationManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Add a device notification.",
notes = "Add a device notification, which will then be sent to a device.")
notes = "Add a device notification, which will then be sent to a device.",
tags = "Device Notification Management")
@ApiResponses(
value = {
@ApiResponse(code = 201, message = "Created. \n Notification has been added successfully.",

@ -45,7 +45,8 @@ public interface PolicyManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Add a new policy.",
notes = "This particular resource can be used to add a new policy, which will be created in in-active state.")
notes = "This particular resource can be used to add a new policy, which will be created in in-active state.",
tags = "Device Policy Management")
@ApiResponses(
value = {
@ApiResponse(
@ -97,7 +98,8 @@ public interface PolicyManagementService {
value = "Get details of policies.",
responseContainer = "List",
notes = "Retrieve the details of all the policies that have been created in EMM.",
response = Policy.class)
response = Policy.class,
tags = "Device Policy Management")
@ApiResponses(
value = {
@ApiResponse(
@ -153,7 +155,8 @@ public interface PolicyManagementService {
httpMethod = "GET",
value = "Get details of a policy.",
notes = "Retrieve the details of a given policy that has been created in EMM.",
response = Policy.class)
response = Policy.class,
tags = "Device Policy Management")
@ApiResponses(
value = {
@ApiResponse(
@ -207,7 +210,8 @@ public interface PolicyManagementService {
httpMethod = "PUT",
value = "Update a policy.",
notes = "If you wish to make changes to an existing policy, that can be done by updating the policy using " +
"this resource.")
"this resource.",
tags = "Device Policy Management")
@ApiResponses(
value = {
@ApiResponse(
@ -259,7 +263,8 @@ public interface PolicyManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Remove multiple policies.",
notes = "In situations where you need to delete more than one policy you can do so using this API.")
notes = "In situations where you need to delete more than one policy you can do so using this API.",
tags = "Device Policy Management")
@ApiResponses(
value = {
@ApiResponse(
@ -294,7 +299,8 @@ public interface PolicyManagementService {
httpMethod = "PUT",
value = "Activating policies.",
notes = "Using the REST API command you are able to publish a policy in order to bring a policy that is " +
"in the inactive state to the active state.")
"in the inactive state to the active state.",
tags = "Device Policy Management")
@ApiResponses(
value = {
@ApiResponse(code = 200, message = "Policies have been successfully activated."),
@ -315,7 +321,8 @@ public interface PolicyManagementService {
httpMethod = "PUT",
value = "Deactivating policies.",
notes = "Using the REST API command you are able to unpublish a policy in order to bring a policy that " +
"is in the active state to the inactive state.")
"is in the active state to the inactive state.",
tags = "Device Policy Management")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Policies have been successfully deactivated."),
@ApiResponse(code = 500, message = "Error in deactivating policies.")

@ -31,6 +31,7 @@ import javax.ws.rs.core.Response;
import java.util.List;
@API(name = "Role", version = "1.0.0", context = "/devicemgt_admin/roles", tags = {"devicemgt_admin"})
@Path("/roles")
@Api(value = "Role Management", description = "Role management related operations can be found here.")
@Produces(MediaType.APPLICATION_JSON)
@ -45,7 +46,8 @@ public interface RoleManagementService {
responseContainer = "List",
notes = "If you wish to get the details of all the roles in EMM, you can do so using this REST API. All " +
"internal roles, roles created for Service-providers and application related roles are omitted.",
response = String.class)
response = String.class,
tags = "Role Management")
@ApiResponses(
value = {
@ApiResponse(
@ -119,7 +121,8 @@ public interface RoleManagementService {
"out by a role. Therefore if you wish to retrieve the permission details of a role, you can do " +
"so using this REST API.",
response = UIPermissionNode.class,
responseContainer = "List"
responseContainer = "List",
tags = "Role Management"
)
@ApiResponses(
value = {
@ -174,7 +177,8 @@ public interface RoleManagementService {
httpMethod = "GET",
value = "Get details of a role.",
notes = "If you wish to get the details of a role in EMM, you can do so using this REST API.",
response = RoleWrapper.class)
response = RoleWrapper.class,
tags = "Role Management")
@ApiResponses(
value = {
@ApiResponse(
@ -226,7 +230,8 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Add a role.",
notes = "You are able to add a new role to EMM using the REST API.")
notes = "You are able to add a new role to EMM using the REST API.",
tags = "Role Management")
@ApiResponses(value = {
@ApiResponse(
code = 201,
@ -279,7 +284,8 @@ public interface RoleManagementService {
httpMethod = "PUT",
value = "Update a role.",
notes = "There will be situations where you will need to update the role details, such as the permissions" +
" or the role name. In such situation you can update the role details.")
" or the role name. In such situation you can update the role details.",
tags = "Role Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -331,7 +337,8 @@ public interface RoleManagementService {
httpMethod = "DELETE",
value = "Delete a role.",
notes = "In a situation when your Organization identifies that a specific role is no longer required you " +
"will need to remove the role details from EMM.")
"will need to remove the role details from EMM.",
tags = "Role Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -364,7 +371,8 @@ public interface RoleManagementService {
"a role using this REST API." +
"Example: Your Organization hires 30 new engineers. Updating the role details for each user can " +
"be cumbersome, therefore you can define all the new employees that belong to the engineering " +
"role using this API.")
"role using this API.",
tags = "Role Management")
@ApiResponses(
value = {
@ApiResponse(

@ -31,6 +31,7 @@ import java.util.Date;
@API(name = "User Management API", version = "1.0.0", context = "/devicemgt_admin/users", tags = {"devicemgt_admin"})
@Path("/users")
@Api(value = "User Management", description = "User management related operations can be found here.")
@Produces(MediaType.APPLICATION_JSON)
@ -43,7 +44,8 @@ public interface UserManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Add a user.",
notes = "A new user can be added to the user management system via this resource")
notes = "A new user can be added to the user management system via this resource",
tags = "User Management")
@ApiResponses(
value = {
@ApiResponse(
@ -92,13 +94,13 @@ public interface UserManagementService {
@GET
@Path("/{username}")
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting details of a user.",
notes = "If you wish to get the details of a specific user that is registered with EMM,"
+ " you can do so using the REST API.",
response = UserWrapper.class)
response = UserWrapper.class,
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -151,7 +153,8 @@ public interface UserManagementService {
httpMethod = "PUT",
value = "Update details of a user",
notes = "There will be situations where you will want to update the user details. In such "
+ "situation you can update the user details using this REST API.")
+ "situation you can update the user details using this REST API.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -203,7 +206,8 @@ public interface UserManagementService {
httpMethod = "DELETE",
value = "Deleting a user.",
notes = "In a situation where an employee leaves the organization you will need to remove the"
+ " user details from EMM. In such situations you can use this REST API to remove a user.")
+ " user details from EMM. In such situations you can use this REST API to remove a user.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -230,7 +234,8 @@ public interface UserManagementService {
notes = "A user can be assigned to one or more role in EMM. Using this REST API you are "
+ "able to get the role/roles a user is assigned to.",
response = String.class,
responseContainer = "List")
responseContainer = "List",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -276,7 +281,8 @@ public interface UserManagementService {
notes = "If you wish to get the details of all the users registered with EMM, you can do so "
+ "using the REST API",
response = UserWrapper.class,
responseContainer = "List")
responseContainer = "List",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -341,7 +347,8 @@ public interface UserManagementService {
+ "You will be given a list of users having the user name with the exact order of the "
+ "characters you provided.",
response = String.class,
responseContainer = "List")
responseContainer = "List",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -401,7 +408,8 @@ public interface UserManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
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.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,

@ -46,7 +46,8 @@ public interface ApplicationManagementAdminService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Application installation API.(Internal API)",
notes = "This is an internal API used for application installation on a device.")
notes = "This is an internal API used for application installation on a device.",
tags = "Application Management Administrative Service")
@ApiResponses(value = {
@ApiResponse(
code = 200,
@ -79,7 +80,8 @@ public interface ApplicationManagementAdminService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Application un-installation API.(Internal API)",
notes = "This is an internal API used for application uninstallation on a device.")
notes = "This is an internal API used for application un-installation on a device.",
tags = "Application Management Administrative Service")
@ApiResponses(value = {
@ApiResponse(
code = 200,

@ -43,7 +43,8 @@ public interface DeviceManagementAdminService {
value = "Get devices by name.",
notes = "Get devices by name of the device and tenant that they belong to.",
response = Device.class,
responseContainer = "List")
responseContainer = "List",
tags = "Device Management Administrative Service")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of devices.",
response = Device.class,

@ -42,7 +42,8 @@ public interface GroupManagementAdminService {
value = "Get groups by the name.",
notes = "Get devices the name of device and tenant.",
response = DeviceGroupWrapper.class,
responseContainer = "List")
responseContainer = "List",
tags = "Group Management Administrative Service")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of groups.",
response = DeviceGroupWrapper.class,

@ -41,7 +41,8 @@ public interface UserManagementAdminService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "POST",
value = "Change 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.",
tags = "User Management Administrative Service")
@ApiResponses(value = {
@ApiResponse(
code = 200,

@ -42,11 +42,14 @@ import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Date;
import java.util.List;
@Path("/devices")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class DeviceManagementServiceImpl implements DeviceManagementService{
private static final Log log = LogFactory.getLog(DeviceManagementServiceImpl.class);
@ -177,7 +180,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService{
@POST
@Path("/search-devices")
@Override
public Response searchDevices(SearchContext searchContext, @QueryParam("offset") int offset, int limit) {
public Response searchDevices(@QueryParam("offset") int offset, int limit, SearchContext searchContext) {
SearchManagerService searchManagerService;
List<DeviceWrapper> devices;
try {

@ -33,106 +33,105 @@ import org.wso2.carbon.device.mgt.jaxrs.service.api.GroupManagementService;
import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtAPIUtils;
import org.wso2.carbon.policy.mgt.common.DeviceGroupWrapper;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
//@Path("/groups")
//@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON)
public class GroupManagementServiceImpl implements GroupManagementService {
private static final Log log = LogFactory.getLog(GroupManagementServiceImpl.class);
@Override
public Response getGroups(@QueryParam("offset") int offset, @QueryParam("limit") int limit) {
return null;
}
@Override
public Response createGroup(DeviceGroup group) {
return null;
}
@Override
public Response getGroup(@PathParam("groupName") String groupName) {
return null;
}
@Override
public Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup) {
return null;
}
@Override
public Response deleteGroup(@PathParam("groupName") String groupName) {
return null;
}
@Override
public Response shareGroupWithUser(String groupName, String targetUser) {
return null;
}
@Override
public Response shareGroupWithRole(String groupName, String targetRole) {
return null;
}
@Override
public Response removeShareWithUser(@PathParam("groupName") String groupName,
@QueryParam("username") String targetUser) {
return null;
}
@Override
public Response removeShareWithRole(@PathParam("groupName") String groupName,
@QueryParam("roleName") String targetUser) {
return null;
}
@Override
public Response getUsersOfGroup(@PathParam("groupName") String groupName) {
return null;
}
@Override
public Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
@QueryParam("limit") int limit) {
return null;
}
@Override
public Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier) {
return null;
}
@Override
public Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
@QueryParam("id") String id) {
return null;
}
@Override
public Response getGroupsByUser(@QueryParam("user") String user) {
try {
List<DeviceGroupWrapper> groupWrappers = new ArrayList<>();
GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
List<DeviceGroup> deviceGroups = service.getGroups(user);
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
for (DeviceGroup dg : deviceGroups) {
DeviceGroupWrapper gw = new DeviceGroupWrapper();
gw.setId(dg.getId());
gw.setOwner(dg.getOwner());
gw.setName(dg.getName());
gw.setTenantId(tenantId);
groupWrappers.add(gw);
}
return Response.status(Response.Status.OK).entity(groupWrappers).build();
} catch (GroupManagementException e) {
String error = "Error occurred while getting the groups related to users for policy.";
log.error(error, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
}
}
// private static final Log log = LogFactory.getLog(GroupManagementServiceImpl.class);
//
// @Override
// public Response getGroups(@QueryParam("user") String user, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit) {
// try {
// List<DeviceGroupWrapper> groupWrappers = new ArrayList<>();
// GroupManagementProviderService service = DeviceMgtAPIUtils.getGroupManagementProviderService();
// List<DeviceGroup> deviceGroups = service.getGroups(user);
// int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
// for (DeviceGroup dg : deviceGroups) {
// DeviceGroupWrapper gw = new DeviceGroupWrapper();
// gw.setId(dg.getId());
// gw.setOwner(dg.getOwner());
// gw.setName(dg.getName());
// gw.setTenantId(tenantId);
// groupWrappers.add(gw);
// }
// return Response.status(Response.Status.OK).entity(groupWrappers).build();
// } catch (GroupManagementException e) {
// String error = "Error occurred while getting the groups related to users for policy.";
// log.error(error, e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build();
// }
// }
//
// @Override
// public Response createGroup(DeviceGroup group) {
// return null;
// }
//
// @Override
// public Response getGroup(@PathParam("groupName") String groupName) {
// return null;
// }
//
// @Override
// public Response updateGroup(@PathParam("groupName") String groupName, DeviceGroup deviceGroup) {
// return null;
// }
//
// @Override
// public Response deleteGroup(@PathParam("groupName") String groupName) {
// return null;
// }
//
// @Override
// public Response shareGroupWithUser(String groupName, String targetUser) {
// return null;
// }
//
// @Override
// public Response shareGroupWithRole(String groupName, String targetRole) {
// return null;
// }
//
// @Override
// public Response removeShareWithUser(@PathParam("groupName") String groupName,
// @QueryParam("username") String targetUser) {
// return null;
// }
//
// @Override
// public Response removeShareWithRole(@PathParam("groupName") String groupName,
// @QueryParam("roleName") String targetUser) {
// return null;
// }
//
// @Override
// public Response getUsersOfGroup(@PathParam("groupName") String groupName) {
// return null;
// }
//
// @Override
// public Response getDevicesOfGroup(@PathParam("groupName") String groupName, @QueryParam("offset") int offset,
// @QueryParam("limit") int limit) {
// return null;
// }
//
// @Override
// public Response addDeviceToGroup(@PathParam("groupName") String groupName, DeviceIdentifier deviceIdentifier) {
// return null;
// }
//
// @Override
// public Response removeDeviceFromGroup(@PathParam("groupName") String groupName, @QueryParam("type") String type,
// @QueryParam("id") String id) {
// return null;
// }
}

@ -36,10 +36,13 @@ import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
@Path("/policies")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class PolicyManagementServiceImpl implements PolicyManagementService {
private static final Log log = LogFactory.getLog(PolicyManagementServiceImpl.class);

@ -33,11 +33,15 @@ import org.wso2.carbon.user.mgt.common.UIPermissionNode;
import org.wso2.carbon.user.mgt.common.UserAdminException;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Path("/roles")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class RoleManagementServiceImpl implements RoleManagementService {
private static final Log log = LogFactory.getLog(RoleManagementServiceImpl.class);

@ -35,7 +35,7 @@
<ref bean="roleManagementService"/>
<ref bean="userManagementService"/>
<ref bean="userManagementAdminService"/>
<ref bean="groupManagementService"/>
<!--<ref bean="groupManagementService"/>-->
<ref bean="groupManagementAdminService"/>
<ref bean="applicationManagementAdminService"/>
<ref bean="dashboardServiceBean"/>
@ -70,7 +70,7 @@
<bean id="policyManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.PolicyManagementServiceImpl"/>
<bean id="roleManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.RoleManagementServiceImpl"/>
<bean id="userManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.UserManagementServiceImpl"/>
<bean id="groupManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.GroupManagementServiceImpl"/>
<!--<bean id="groupManagementService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.GroupManagementServiceImpl"/>-->
<bean id="deviceManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.DeviceManagementAdminServiceImpl"/>
<bean id="applicationManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.ApplicationManagementAdminServiceImpl"/>
<bean id="groupManagementAdminService" class="org.wso2.carbon.device.mgt.jaxrs.service.impl.admin.GroupManagementAdminServiceImpl"/>

@ -19,18 +19,44 @@
package org.wso2.carbon.device.mgt.common.operation.mgt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "Activity", description = "An activity instance carries a unique identifier that can be " +
"used to identify a particular operation instance uniquely")
public class Activity {
public enum Type {
CONFIG, MESSAGE, INFO, COMMAND, PROFILE, POLICY
}
@ApiModelProperty(
name = "activityId",
value = "Activity identifier",
required = true)
private String activityId;
@ApiModelProperty(
name = "code",
value = "Activity code",
required = true)
private String code;
@ApiModelProperty(
name = "type",
value = "Activity type",
required = true,
allowableValues = "CONFIG, MESSAGE, INFO, COMMAND, PROFILE, POLICY")
private Type type;
@ApiModelProperty(
name = "createdTimeStamp",
value = "Timestamp recorded when the activity took place",
required = true)
private String createdTimeStamp;
@ApiModelProperty(
name = "activityStatuses",
value = "Collection of statuses corresponding to the activity",
required = true)
private List<ActivityStatus> activityStatus;
public String getActivityId() {

Loading…
Cancel
Save