From de9b17f41fb4ba6edb5aa3e63f1abaab4f5ea270 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Fri, 29 May 2015 17:57:45 +0530 Subject: [PATCH] Modifying Device bean definition --- .../org/wso2/carbon/device/mgt/common/Device.java | 6 +++--- .../mgt/core/dao/util/DeviceManagementDAOUtil.java | 13 ++----------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java index cd8539aa4c3..b0e08d6fe11 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java @@ -31,7 +31,7 @@ public class Device { private Long dateOfEnrolment; private Long dateOfLastUpdate; private String ownership; - private boolean status; + private Status status; private int deviceTypeId; private String deviceIdentifier; private String owner; @@ -101,11 +101,11 @@ public class Device { } @XmlElement - public boolean isStatus() { + public Status getStatus() { return status; } - public void setStatus(boolean status) { + public void setStatus(Status status) { this.status = status; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index c8ac7e6d57a..dc39d627e64 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -126,11 +126,7 @@ public final class DeviceManagementDAOUtil { deviceBO.setId(device.getId()); deviceBO.setOwner(device.getOwnerId()); deviceBO.setOwnership(device.getOwnerShip()); - if (device.getStatus() == Status.ACTIVE) { - deviceBO.setStatus(true); - } else if (device.getStatus() == Status.INACTIVE) { - deviceBO.setStatus(false); - } + deviceBO.setStatus(device.getStatus()); return deviceBO; } @@ -141,12 +137,7 @@ public final class DeviceManagementDAOUtil { deviceBO.setName(device.getName()); deviceBO.setDateOfEnrollment(device.getDateOfEnrolment()); deviceBO.setDateOfLastUpdate(device.getDateOfLastUpdate()); - - if (!device.isStatus()) { - deviceBO.setStatus(Status.INACTIVE); - } else { - deviceBO.setStatus(Status.ACTIVE); - } + deviceBO.setStatus(device.getStatus()); deviceBO.setOwnerId(device.getOwner()); deviceBO.setOwnerShip(device.getOwnership()); deviceBO.setTenantId(DeviceManagementDAOUtil.getTenantId());