Improving ceritificate management webapp impl

4.x.x
prabathabey 9 years ago
parent ddfd678b2a
commit 3e21c6d50d

@ -227,7 +227,8 @@ public interface CertificateManagementAdminService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "DELETE",
value = "Delete an SSL certificate",
notes = "Delete an SSL certificate that's on the client end")
notes = "Delete an SSL certificate that's on the client end",
tags = "Certificate Management")
@ApiResponses(value = {
@ApiResponse(
code = 200,

@ -22,7 +22,7 @@ import javax.ws.rs.core.Response;
import java.util.ArrayList;
import java.util.List;
@Path("/certificates")
@Path("/admin/certificates")
public class CertificateManagementAdminServiceImpl implements CertificateManagementAdminService {
private static Log log = LogFactory.getLog(CertificateManagementAdminServiceImpl.class);

@ -27,73 +27,73 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Date;
@Path("/admin/groups")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Api(value = "Group Management Administrative Service", description = "This an API intended to be used by " +
"'internal' components to log in as an admin user and do a selected number of operations. " +
"Further, this is strictly restricted to admin users only ")
//@Path("/admin/groups")
//@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON)
//@Api(value = "Group Management Administrative Service", description = "This an API intended to be used by " +
// "'internal' components to log in as an admin user and do a selected number of operations. " +
// "Further, this is strictly restricted to admin users only ")
public interface GroupManagementAdminService {
@GET
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get groups by the name.",
notes = "Get devices the name of device and tenant.",
response = DeviceGroupWrapper.class,
responseContainer = "List",
tags = "Group Management Administrative Service")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of groups.",
response = DeviceGroupWrapper.class,
responseContainer = "List",
responseHeaders = {
@ResponseHeader(
name = "Content-Type",
description = "The content type of the body"),
@ResponseHeader(
name = "ETag",
description = "Entity Tag of the response resource.\n" +
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse(
code = 500,
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the group list.")
})
@Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
Response getGroupsOfUser(
@ApiParam(
name = "username",
value = "Username of the user.",
required = true)
@QueryParam("username") String username,
@ApiParam(
name = "If-Modified-Since",
value = "Timestamp of the last modified date",
required = false)
@HeaderParam("If-Modified-Since") String timestamp,
@ApiParam(
name = "offset",
value = "Starting point within the complete list of items qualified.",
required = false)
@QueryParam("offset") int offset,
@ApiParam(
name = "limit",
value = "Maximum size of resource array to return.",
required = false)
@QueryParam("limit") int limit);
// @GET
// @ApiOperation(
// produces = MediaType.APPLICATION_JSON,
// httpMethod = "GET",
// value = "Get groups by the name.",
// notes = "Get devices the name of device and tenant.",
// response = DeviceGroupWrapper.class,
// responseContainer = "List",
// tags = "Group Management Administrative Service")
// @ApiResponses(value = {
// @ApiResponse(code = 200, message = "OK. \n Successfully fetched the list of groups.",
// response = DeviceGroupWrapper.class,
// responseContainer = "List",
// responseHeaders = {
// @ResponseHeader(
// name = "Content-Type",
// description = "The content type of the body"),
// @ResponseHeader(
// name = "ETag",
// description = "Entity Tag of the response resource.\n" +
// "Used by caches, or in conditional requests."),
// @ResponseHeader(
// name = "Last-Modified",
// description = "Date and time the resource has been modified the last time.\n" +
// "Used by caches, or in conditional requests."),
// }),
// @ApiResponse(
// code = 304,
// message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
// @ApiResponse(
// code = 406,
// message = "Not Acceptable.\n The requested media type is not supported"),
// @ApiResponse(
// code = 500,
// message = "Internal Server ErrorResponse. \n Server error occurred while fetching the group list.")
// })
// @Permission(scope = "group-view", permissions = {"/permission/admin/device-mgt/user/groups/list"})
// Response getGroupsOfUser(
// @ApiParam(
// name = "username",
// value = "Username of the user.",
// required = true)
// @QueryParam("username") String username,
// @ApiParam(
// name = "If-Modified-Since",
// value = "Timestamp of the last modified date",
// required = false)
// @HeaderParam("If-Modified-Since") String timestamp,
// @ApiParam(
// name = "offset",
// value = "Starting point within the complete list of items qualified.",
// required = false)
// @QueryParam("offset") int offset,
// @ApiParam(
// name = "limit",
// value = "Maximum size of resource array to return.",
// required = false)
// @QueryParam("limit") int limit);
//
}

@ -31,32 +31,32 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.Date;
@Path("/admin/groups")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
//@Path("/admin/groups")
//@Produces(MediaType.APPLICATION_JSON)
//@Consumes(MediaType.APPLICATION_JSON)
public class GroupManagementAdminServiceImpl implements GroupManagementAdminService {
private static final Log log = LogFactory.getLog(GroupManagementAdminServiceImpl.class);
@Override
public Response getGroupsOfUser(
@QueryParam("username") String username,
@HeaderParam("If-Modified-Since") String timestamp,
@QueryParam("offset") int offset,
@QueryParam("limit") int limit) {
try {
PaginationResult result =
DeviceMgtAPIUtils.getGroupManagementProviderService().getGroups(username, offset, limit);
if (result != null && result.getRecordsTotal() > 0) {
return Response.status(Response.Status.OK).entity(result).build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
} catch (GroupManagementException e) {
String msg = "ErrorResponse occurred while retrieving the groups of user '" + username + "'";
log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
}
//
// private static final Log log = LogFactory.getLog(GroupManagementAdminServiceImpl.class);
//
// @Override
// public Response getGroupsOfUser(
// @QueryParam("username") String username,
// @HeaderParam("If-Modified-Since") String timestamp,
// @QueryParam("offset") int offset,
// @QueryParam("limit") int limit) {
// try {
// PaginationResult result =
// DeviceMgtAPIUtils.getGroupManagementProviderService().getGroups(username, offset, limit);
// if (result != null && result.getRecordsTotal() > 0) {
// return Response.status(Response.Status.OK).entity(result).build();
// } else {
// return Response.status(Response.Status.NOT_FOUND).build();
// }
// } catch (GroupManagementException e) {
// String msg = "ErrorResponse occurred while retrieving the groups of user '" + username + "'";
// log.error(msg, e);
// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
// }
// }
}

Loading…
Cancel
Save