From 30b01fc3bc5699007186bd9a7730277ac7992ecf Mon Sep 17 00:00:00 2001 From: geethkokila Date: Fri, 22 May 2015 10:27:34 +0530 Subject: [PATCH] Fixing the sort issue --- .../carbon/policy/mgt/core/mgt/impl/PolicyManagerImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 bac0a22c7e..d9fac30acc 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 @@ -33,6 +33,7 @@ import org.wso2.carbon.policy.mgt.core.mgt.ProfileManager; import java.sql.Timestamp; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collections; import java.util.List; public class PolicyManagerImpl implements PolicyManager { @@ -494,6 +495,7 @@ public class PolicyManagerImpl implements PolicyManager { // policyDAO.getTimesOfPolicy(policy); // policyDAO.getLocationsOfPolicy(policy); } + Collections.sort(policyList); } catch (PolicyManagerDAOException e) { String msg = "Error occurred while getting all the policies."; @@ -525,6 +527,7 @@ public class PolicyManagerImpl implements PolicyManager { } } + Collections.sort(policies); } catch (PolicyManagerDAOException e) { String msg = "Error occurred while getting the policies for device identifier (" + deviceIdentifier.getId() + " - " + deviceIdentifier.getType() + ")"; @@ -560,6 +563,7 @@ public class PolicyManagerImpl implements PolicyManager { } } + Collections.sort(policies); // } catch (PolicyManagerDAOException e) { // String msg = "Error occurred while getting all the policies."; // log.error(msg, e); @@ -603,6 +607,7 @@ public class PolicyManagerImpl implements PolicyManager { log.error(msg, e); throw new PolicyManagementException(msg, e); } + Collections.sort(policies); return policies; } @@ -629,6 +634,7 @@ public class PolicyManagerImpl implements PolicyManager { log.error(msg, e); throw new PolicyManagementException(msg, e); } + Collections.sort(policies); return policies; }