|
|
@ -83,6 +83,10 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|
|
|
long timestamp = 0;
|
|
|
|
long timestamp = 0;
|
|
|
|
boolean isIfModifiedSinceSet = false;
|
|
|
|
boolean isIfModifiedSinceSet = false;
|
|
|
|
boolean isSinceSet = false;
|
|
|
|
boolean isSinceSet = false;
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("getActivities since: " + since + " , offset: " + offset + " ,limit: " + limit + " ," +
|
|
|
|
|
|
|
|
"ifModifiedSince: " + ifModifiedSince);
|
|
|
|
|
|
|
|
}
|
|
|
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
|
|
|
RequestValidationUtil.validatePaginationParameters(offset, limit);
|
|
|
|
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
|
|
|
|
if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
|
|
|
|
Date ifSinceDate;
|
|
|
|
Date ifSinceDate;
|
|
|
@ -112,14 +116,32 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|
|
|
timestamp = sinceTimestamp / 1000;
|
|
|
|
timestamp = sinceTimestamp / 1000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (timestamp == 0) {
|
|
|
|
|
|
|
|
//If timestamp is not sent by the user, a default value is set, that is equal to current time-12 hours.
|
|
|
|
|
|
|
|
long time = System.currentTimeMillis() / 1000;
|
|
|
|
|
|
|
|
timestamp = time - 42300;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("getActivities final timestamp " + timestamp);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<Activity> activities;
|
|
|
|
List<Activity> activities;
|
|
|
|
ActivityList activityList = new ActivityList();
|
|
|
|
ActivityList activityList = new ActivityList();
|
|
|
|
DeviceManagementProviderService dmService;
|
|
|
|
DeviceManagementProviderService dmService;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("Calling database to get activities.");
|
|
|
|
|
|
|
|
}
|
|
|
|
dmService = DeviceMgtAPIUtils.getDeviceManagementService();
|
|
|
|
dmService = DeviceMgtAPIUtils.getDeviceManagementService();
|
|
|
|
activities = dmService.getActivitiesUpdatedAfter(timestamp, limit, offset);
|
|
|
|
activities = dmService.getActivitiesUpdatedAfter(timestamp, limit, offset);
|
|
|
|
activityList.setList(activities);
|
|
|
|
activityList.setList(activities);
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("Calling database to get activity count.");
|
|
|
|
|
|
|
|
}
|
|
|
|
int count = dmService.getActivityCountUpdatedAfter(timestamp);
|
|
|
|
int count = dmService.getActivityCountUpdatedAfter(timestamp);
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("Activity count: " + count);
|
|
|
|
|
|
|
|
}
|
|
|
|
activityList.setCount(count);
|
|
|
|
activityList.setCount(count);
|
|
|
|
if (activities == null || activities.size() == 0) {
|
|
|
|
if (activities == null || activities.size() == 0) {
|
|
|
|
if (isIfModifiedSinceSet) {
|
|
|
|
if (isIfModifiedSinceSet) {
|
|
|
|