|
|
@ -18,6 +18,8 @@
|
|
|
|
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
|
|
|
|
package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException;
|
|
|
|
|
|
|
|
import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest;
|
|
|
|
import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest;
|
|
|
@ -146,8 +148,11 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|
|
|
@Size(max = 45) String devicetype,
|
|
|
|
@Size(max = 45) String devicetype,
|
|
|
|
@PathParam("deviceid")
|
|
|
|
@PathParam("deviceid")
|
|
|
|
@Size(max = 45) String deviceid,
|
|
|
|
@Size(max = 45) String deviceid,
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince) {
|
|
|
|
@HeaderParam("If-Modified-Since") String ifModifiedSince,
|
|
|
|
Activity activity;
|
|
|
|
@QueryParam("response") Boolean response,
|
|
|
|
|
|
|
|
@QueryParam("appInstall") Boolean appInstall) {
|
|
|
|
|
|
|
|
Activity activity = new Activity();
|
|
|
|
|
|
|
|
Activity appActivity = null;
|
|
|
|
DeviceManagementProviderService dmService;
|
|
|
|
DeviceManagementProviderService dmService;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
RequestValidationUtil.validateActivityId(id);
|
|
|
|
RequestValidationUtil.validateActivityId(id);
|
|
|
@ -157,7 +162,20 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|
|
|
deviceIdentifier.setType(devicetype);
|
|
|
|
deviceIdentifier.setType(devicetype);
|
|
|
|
|
|
|
|
|
|
|
|
dmService = DeviceMgtAPIUtils.getDeviceManagementService();
|
|
|
|
dmService = DeviceMgtAPIUtils.getDeviceManagementService();
|
|
|
|
activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier);
|
|
|
|
|
|
|
|
|
|
|
|
if (appInstall != null && appInstall) {
|
|
|
|
|
|
|
|
if (response != null && response) {
|
|
|
|
|
|
|
|
activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
SubscriptionManager subscriptionManager = DeviceMgtAPIUtils.getSubscriptionManager();
|
|
|
|
|
|
|
|
appActivity = subscriptionManager.getOperationAppDetails(id);
|
|
|
|
|
|
|
|
activity.setUsername(appActivity.getUsername());
|
|
|
|
|
|
|
|
activity.setPackageName(appActivity.getPackageName());
|
|
|
|
|
|
|
|
activity.setAppName(appActivity.getAppName());
|
|
|
|
|
|
|
|
activity.setStatus(appActivity.getStatus());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
activity = dmService.getOperationByActivityIdAndDevice(id, deviceIdentifier);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (activity == null) {
|
|
|
|
if (activity == null) {
|
|
|
|
String msg = "No activity can be " +
|
|
|
|
String msg = "No activity can be " +
|
|
|
|
"found upon the provided activity id '" + id + "'";
|
|
|
|
"found upon the provided activity id '" + id + "'";
|
|
|
@ -169,6 +187,11 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
return Response.serverError().entity(
|
|
|
|
return Response.serverError().entity(
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
|
|
|
|
} catch (SubscriptionManagementException e) {
|
|
|
|
|
|
|
|
String msg = "ErrorResponse occurred while fetching the app details for the supplied id.";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
return Response.serverError().entity(
|
|
|
|
|
|
|
|
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|