From 11ead87a5e2f5fcaf09e48497028dbf0a163772c Mon Sep 17 00:00:00 2001 From: geethkokila Date: Thu, 3 Sep 2015 20:49:26 +0530 Subject: [PATCH] Fixing the policy listing issue --- .../mgt/core/cache/impl/PolicyCacheManagerImpl.java | 10 ++++++++++ .../mgt/core/impl/PolicyAdministratorPointImpl.java | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java index 624b5ac9d4b..2e955469106 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java @@ -85,7 +85,17 @@ public class PolicyCacheManagerImpl implements PolicyCacheManager { for (Policy policy : cachedPolicy) { log.debug("Policy id in cache .. : " + policy.getId() + " policy name : " + policy. getPolicyName() + " Activated : " + policy.isActive()); + + List users = policy.getUsers(); + for (String user : users) { + log.debug("Users in cached policy : " + user); + } + List roles = policy.getRoles(); + for (String role : roles) { + log.debug("Roles in cached policy : " + role); + } } + } return lCache.get(1); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java index b17fd2bd6e4..c536987bd43 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/impl/PolicyAdministratorPointImpl.java @@ -68,7 +68,7 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint { // } catch (PolicyDelegationException e) { // throw new PolicyManagementException("Error occurred while delegating policy operation to the devices", e); // } - PolicyCacheManagerImpl.getInstance().addPolicy(resultantPolicy); + PolicyCacheManagerImpl.getInstance().rePopulateCache(); return resultantPolicy; } @@ -80,7 +80,7 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint { // } catch (PolicyDelegationException e) { // throw new PolicyManagementException("Error occurred while delegating policy operation to the devices", e); // } - PolicyCacheManagerImpl.getInstance().updatePolicy(resultantPolicy); + PolicyCacheManagerImpl.getInstance().rePopulateCache(); return resultantPolicy; }