From 6f80d1993d2eef9bbd6cc7dd97b01ec8dad9b1ef Mon Sep 17 00:00:00 2001 From: Madawa Soysa Date: Thu, 13 Dec 2018 20:21:59 +1100 Subject: [PATCH] Move private constants to a public constant class --- .../wso2/carbon/device/mgt/core/search/mgt/Constants.java | 3 +++ .../mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java index 0ba5bb7d10..a944aec330 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/Constants.java @@ -25,4 +25,7 @@ public class Constants { public static final String PROP_AND = "PROP_AND"; public static final String PROP_OR = "PROP_OR"; public static final String LOCATION = "LOCATION"; + + public static final String ANY_DEVICE_PERMISSION = "/device-mgt/devices/any-device"; + public static final String UI_EXECUTE = "ui.execute"; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java index df8e1a8757..cdb6322ca6 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java @@ -37,8 +37,6 @@ import java.util.Map; public class ResultSetAggregatorImpl implements ResultSetAggregator { private static Log log = LogFactory.getLog(ResultSetAggregatorImpl.class); - private final static String ANY_DEVICE_PERMISSION = "/device-mgt/devices/any-device"; - private static final String UI_EXECUTE = "ui.execute"; @Override public List aggregate(Map> devices) { @@ -130,7 +128,8 @@ public class ResultSetAggregatorImpl implements ResultSetAggregator { UserRealm userRealm = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId); return userRealm != null && userRealm.getAuthorizationManager() != null && userRealm.getAuthorizationManager().isUserAuthorized(username, - PermissionUtils.getAbsolutePermissionPath(ANY_DEVICE_PERMISSION), UI_EXECUTE); + PermissionUtils.getAbsolutePermissionPath(Constants.ANY_DEVICE_PERMISSION), + Constants.UI_EXECUTE); } }