From d75f48166eae6c87ae76cdd226d4ed4eb35114f5 Mon Sep 17 00:00:00 2001 From: charitha Date: Sat, 28 Nov 2020 09:26:51 +0530 Subject: [PATCH] Provide response based on headers --- .../service/impl/ActivityProviderServiceImpl.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 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 48b4b8835b..12dd29be88 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 @@ -305,16 +305,18 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService log.debug("Activity request: " + new Gson().toJson(activityPaginationRequest)); } int count = dmService.getActivitiesCount(activityPaginationRequest); - if (count > 0) { - activityList.setList(dmService.getActivities(activityPaginationRequest)); - } - activityList.setCount(count); if (log.isDebugEnabled()) { log.debug("Filtered Activity count: " + count); - if (count > 0) { + } + if (count > 0) { + activityList.setList(dmService.getActivities(activityPaginationRequest)); + if (log.isDebugEnabled()) { log.debug("Fetched Activity count: " + activityList.getList().size()); } + } else if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) { + return Response.notModified().build(); } + activityList.setCount(count); return Response.ok().entity(activityList).build(); } catch (OperationManagementException e) { String msg