diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java index da39516f414..c3020098e73 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/configuration/mgt/DeviceConfiguration.java @@ -32,7 +32,7 @@ import java.util.List; "the server") public class DeviceConfiguration { @ApiModelProperty(name = "deviceId", value = "ID of the device", required = true) - private int deviceId; + private String deviceId; @ApiModelProperty(name = "deviceType", value = "Type of the device", required = true) private String deviceType; @@ -52,11 +52,11 @@ public class DeviceConfiguration { @ApiModelProperty(name = "deviceOwner", value = "Owner of the selected device", required = true) private String deviceOwner; - public int getDeviceId() { + public String getDeviceId() { return deviceId; } - public void setDeviceId(int deviceId) { + public void setDeviceId(String deviceId) { this.deviceId = deviceId; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 3a9db4f4c0d..a6bc22a46d1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -237,6 +237,7 @@ public class OperationManagerImpl implements OperationManager { } int operationId = this.lookupOperationDAO(operation).addOperation(operationDto); + operation.setId(operationId); boolean isScheduled = false; NotificationStrategy notificationStrategy = getNotificationStrategy(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java index ff402f7e977..efabf9bee60 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java @@ -79,6 +79,10 @@ public class OperationDAOUtil { dtoOperation.setControl(Operation.Control.valueOf(operation.getControl().toString())); } + if (operation.getInitiatedBy() != null) { + dtoOperation.setInitiatedBy(operation.getInitiatedBy()); + } + return dtoOperation; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 8aa8d5e2d89..b590d185646 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -3352,7 +3352,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv List configurationEntries, String deviceOwner) { DeviceConfiguration deviceConfiguration = new DeviceConfiguration(); - deviceConfiguration.setDeviceId(device.getId()); + deviceConfiguration.setDeviceId(device.getDeviceIdentifier()); deviceConfiguration.setDeviceType(device.getType()); deviceConfiguration.setTenantDomain(tenantDomain); deviceConfiguration.setConfigurationEntries(configurationEntries);