From 7776e199468f77991328bb190d6839225de2aafd Mon Sep 17 00:00:00 2001 From: Chamindu Senanayake Date: Mon, 15 Nov 2021 05:30:04 +0530 Subject: [PATCH] Fix operation status issue in app subscription Fixes https://gitlab.com/entgra/product-iots/-/issues/999 --- .../mgt/jaxrs/beans/OperationStatusBean.java | 14 ++++++++++++++ .../service/impl/DeviceManagementServiceImpl.java | 1 + 2 files changed, 15 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/OperationStatusBean.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/OperationStatusBean.java index 302712e584..45d38fb678 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/OperationStatusBean.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/OperationStatusBean.java @@ -44,6 +44,12 @@ public class OperationStatusBean { ) private String status; + @ApiModelProperty( + name = "operationCode", + value = "Operation Code." + ) + private String operationCode; + public int getOperationId() { return operationId; } @@ -59,4 +65,12 @@ public class OperationStatusBean { public void setStatus(String status) { this.status = status; } + + public String getOperationCode() { + return operationCode; + } + + public void setOperationCode(String operationCode) { + this.operationCode = operationCode; + } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index df8a4b2be2..804029a13c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -1417,6 +1417,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { } Operation operation = DeviceMgtAPIUtils.validateOperationStatusBean(operationStatusBean); operation.setId(operationStatusBean.getOperationId()); + operation.setCode(operationStatusBean.getOperationCode()); DeviceMgtAPIUtils.getDeviceManagementService().updateOperation(device, operation); if (MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION.equals(operation.getCode()) ||