revert-70aa11f8
madhawap 8 years ago
commit c3cbc5b4fb

@ -72,29 +72,29 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
@QueryParam("offset") int offset, @QueryParam("offset") int offset,
@QueryParam("limit") int limit) { @QueryParam("limit") int limit) {
try { try {
RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status); // RequestValidationUtil.validateSelectionCriteria(type, user, roleName, ownership, status);
DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService(); DeviceManagementProviderService dms = DeviceMgtAPIUtils.getDeviceManagementService();
PaginationRequest request = new PaginationRequest(offset, limit); PaginationRequest request = new PaginationRequest(offset, limit);
PaginationResult result; PaginationResult result;
DeviceList devices = new DeviceList(); DeviceList devices = new DeviceList();
if (type != null) { if (type != null && !type.isEmpty()) {
request.setDeviceType(type); request.setDeviceType(type);
} }
if (user != null) { if (user != null && !user.isEmpty()) {
request.setOwner(user); request.setOwner(user);
} }
if (ownership != null) { if (ownership != null && !ownership.isEmpty()) {
RequestValidationUtil.validateOwnershipType(ownership); RequestValidationUtil.validateOwnershipType(ownership);
request.setOwnership(ownership); request.setOwnership(ownership);
} }
if (status != null) { if (status != null && !status.isEmpty()) {
RequestValidationUtil.validateStatus(status); RequestValidationUtil.validateStatus(status);
request.setStatus(status); request.setStatus(status);
} }
if (ifModifiedSince != null) { if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
Date sinceDate; Date sinceDate;
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
try { try {
@ -110,7 +110,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " + return Response.status(Response.Status.NOT_MODIFIED).entity("No device is modified " +
"after the timestamp provided in 'If-Modified-Since' header").build(); "after the timestamp provided in 'If-Modified-Since' header").build();
} }
} else if (since != null) { } else if (since != null && !since.isEmpty()) {
Date sinceDate; Date sinceDate;
SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
try { try {

Loading…
Cancel
Save