diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java index 7d1e7244abc..53f8411bbc5 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyAdministratorPoint.java @@ -62,6 +62,8 @@ public interface PolicyAdministratorPoint { List getPolicies() throws PolicyManagementException; + Policy getPolicy(int policyId) throws PolicyManagementException; + /** * This method gives the device specific policy. * diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java index 27edad84f50..eef48b27101 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java @@ -445,11 +445,11 @@ public class PolicyDAOImpl implements PolicyDAO { resultSet = stmt.executeQuery(); while (resultSet.next()) { - policy.setId(policyId); policy.setPolicyName(resultSet.getString("NAME")); policy.setTenantId(resultSet.getInt("TENANT_ID")); policy.setPriorityId(resultSet.getInt("PRIORITY")); + policy.setProfileId(resultSet.getInt("PROFILE_ID")); } return policy; 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 0029b269836..c1c8f73d92a 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 @@ -83,6 +83,10 @@ public class PolicyAdministratorPointImpl implements PolicyAdministratorPoint { return policyManager.getPolicies(); } + @Override public Policy getPolicy(int policyId) throws PolicyManagementException { + return policyManager.getPolicy(policyId); + } + @Override public List getPoliciesOfDevice(DeviceIdentifier deviceIdentifier) throws PolicyManagementException { return policyManager.getPoliciesOfDevice(deviceIdentifier); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index 811a7f087c2..fb8b27c2fec 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -372,7 +372,7 @@ public class PolicyManagerImpl implements PolicyManager { policyDAO.getTimesOfPolicy(policy); policyDAO.getLocationsOfPolicy(policy); - Profile profile = profileDAO.getProfiles(policy.getProfile().getProfileId()); + Profile profile = profileDAO.getProfiles(policy.getProfileId()); policy.setProfile(profile); policy.setRoles(roleNames);