From 1513c6cf8a9ceff94c6cd659981bc582e37b18e6 Mon Sep 17 00:00:00 2001 From: dilanua Date: Fri, 17 Jun 2016 12:05:35 +0530 Subject: [PATCH] Adding isActive property to PolicyWrapper --- .../device/mgt/jaxrs/beans/PolicyWrapper.java | 15 +++++++++++++-- .../service/impl/PolicyManagementServiceImpl.java | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/PolicyWrapper.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/PolicyWrapper.java index 31420dae88..1795e29982 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/PolicyWrapper.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/beans/PolicyWrapper.java @@ -20,7 +20,6 @@ package org.wso2.carbon.device.mgt.jaxrs.beans; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import java.util.List; @@ -52,6 +51,10 @@ public class PolicyWrapper { + "device type", required = true) private String ownershipType; + @ApiModelProperty(name = "active", value = "If the value is true it indicates that the policy is active. " + + "If the value is false it indicates that the policy is inactive", required = true) + private boolean active; + @ApiModelProperty(name = "profile", value = "Contains the details of the profile that is included in the" + " policy", required = true) private Profile profile; @@ -115,11 +118,19 @@ public class PolicyWrapper { this.ownershipType = ownershipType; } + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + public List getDeviceIdentifiers() { return deviceIdentifiers; } - public void setDeviceIdentifier(List deviceIdentifier) { + public void setDeviceIdentifier(List deviceIdentifiers) { this.deviceIdentifiers = deviceIdentifiers; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java index 520285fe57..e22b3996d1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -106,6 +106,7 @@ public class PolicyManagementServiceImpl implements PolicyManagementService { policy.setDescription(policyWrapper.getDescription()); policy.setProfile(DeviceMgtUtil.convertProfile(policyWrapper.getProfile())); policy.setOwnershipType(policyWrapper.getOwnershipType()); + policy.setActive(policyWrapper.isActive()); policy.setRoles(policyWrapper.getRoles()); policy.setUsers(policyWrapper.getUsers()); policy.setCompliance(policyWrapper.getCompliance());