From 59119f9167519e3a4b167f524e41b661f25d112d Mon Sep 17 00:00:00 2001 From: madhawap Date: Tue, 14 Jun 2016 18:08:43 +0530 Subject: [PATCH] add changes to 'since' QueryParam and 'if-modified-since' HeaderParam --- .../jaxrs/service/impl/ActivityProviderServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java index 5e28b29a47..fc26db284d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -83,15 +83,15 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService long sinceTimestamp =0; boolean isIfModifiedSinceSet = false; if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { - Date sinceDate; + Date ifSinceDate; SimpleDateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z"); try { - sinceDate = format.parse(ifModifiedSince); + ifSinceDate = format.parse(ifModifiedSince); } catch (ParseException e) { throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder().setCode(400l) .setMessage("Invalid date string is provided in 'If-Modified-Since' header").build()); } - ifModifiedSinceTimestamp = sinceDate.getTime(); + ifModifiedSinceTimestamp = ifSinceDate.getTime(); } if (since != null && !since.isEmpty()){ Date sinceDate; @@ -112,7 +112,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService DeviceManagementProviderService dmService; try { dmService = DeviceMgtAPIUtils.getDeviceManagementService(); - activities = dmService.getActivitiesUpdatedAfter(sinceTimestamp); + activities = dmService.getActivitiesUpdatedAfter(sinceTimestamp/1000); if (activities == null || activities.size() == 0) { if (isIfModifiedSinceSet) { return Response.status(Response.Status.NOT_MODIFIED).entity("No activities " +