From 57a98341457b3cfe971a153783e82316e2fc58ff Mon Sep 17 00:00:00 2001 From: geethkokila Date: Wed, 25 May 2016 11:43:19 +0530 Subject: [PATCH] Changing apis to return activity when an operation is added --- .../carbon/mdm/services/android/util/AndroidAPIUtils.java | 7 ++++--- .../device/mgt/mobile/AbstractMobileOperationManager.java | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java index 9730844ed..778d1d80b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidAPIUtils.java @@ -38,6 +38,7 @@ import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException; import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService; @@ -123,9 +124,9 @@ public class AndroidAPIUtils { message, responseMediaType); List validDeviceIds = deviceIDHolder.getValidDeviceIDList(); - int status = getDeviceManagementService().addOperation( + Activity activity = getDeviceManagementService().addOperation( DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, operation, validDeviceIds); - if (status > 0) { + if (activity != null) { GCMService gcmService = getGCMService(); if (gcmService.isGCMEnabled()) { List deviceIDList = deviceIDHolder.getValidDeviceIDList(); @@ -142,7 +143,7 @@ public class AndroidAPIUtils { responseMediaType).entity(deviceUtils. convertErrorMapIntoErrorMessage(deviceIDHolder.getErrorDeviceIdList())).build(); } - return javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.CREATED). + return javax.ws.rs.core.Response.status(javax.ws.rs.core.Response.Status.CREATED).entity(activity). type(responseMediaType).build(); } diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java index 1bf5322da..e0058b6bd 100644 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java +++ b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.mobile; import org.wso2.carbon.device.mgt.common.*; +import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager; @@ -33,9 +34,9 @@ public abstract class AbstractMobileOperationManager implements OperationManager } @Override - public int addOperation(Operation operation, List devices) throws - OperationManagementException { - return 1; + public Activity addOperation(Operation operation, List devices) throws + OperationManagementException { + return null; } } \ No newline at end of file