Fixing getDevice method to support status, ownership, etc as query param filters

revert-70aa11f8
prabathabey 9 years ago
parent 12a22d86ef
commit 61beca5048

@ -77,14 +77,18 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
PaginationResult result; PaginationResult result;
if (type != null) { if (type != null) {
request.setDeviceType(type);
result = dms.getDevicesByType(request); result = dms.getDevicesByType(request);
} else if (user != null) { } else if (user != null) {
request.setOwner(user);
result = dms.getDevicesOfUser(request); result = dms.getDevicesOfUser(request);
} else if (ownership != null) { } else if (ownership != null) {
RequestValidationUtil.validateOwnershipType(ownership); RequestValidationUtil.validateOwnershipType(ownership);
request.setOwnership(ownership);
result = dms.getDevicesByOwnership(request); result = dms.getDevicesByOwnership(request);
} else if (status != null) { } else if (status != null) {
RequestValidationUtil.validateStatus(status); RequestValidationUtil.validateStatus(status);
request.setStatus(status);
result = dms.getDevicesByStatus(request); result = dms.getDevicesByStatus(request);
} else { } else {
result = dms.getAllDevices(request); result = dms.getAllDevices(request);

@ -79,7 +79,7 @@ public class UserManagementServiceImpl implements UserManagementService {
this.inviteNewlyAddedUserToEnrollDevice(userWrapper.getUsername(), initialUserPassword); this.inviteNewlyAddedUserToEnrollDevice(userWrapper.getUsername(), initialUserPassword);
// Outputting debug message upon successful addition of user // Outputting debug message upon successful addition of user
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("User by username: " + userWrapper.getUsername() + " was successfully added."); log.debug("User '" + userWrapper.getUsername() + "' has successfully been added.");
} }
// returning response with success state // returning response with success state
return Response.status(Response.Status.OK).entity("User by username: " + userWrapper.getUsername() + return Response.status(Response.Status.OK).entity("User by username: " + userWrapper.getUsername() +

Loading…
Cancel
Save