[ https://issues.apache.org/jira/browse/RANGER-3500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Xuze Yang updated RANGER-3500: ------------------------------ Description: When getting the ranger policy list, we may want to sort the returned policy list according to certain fields, such as policyId, policyName and etc. But case shows that adding the parameters sortBy and sortType to the url has no effect (eg: [http://192.168.0.12:6080/service/plugins/]policies/service/2?sortBy=policyName&sortType=desc&serviceName=default-Hdfs). I look through the source code and find that code supports sorting by fields, but due to some code bugs, it did not really take effect. The main reason for the problem is that when the SearchFilter is copied deeply, only the params is copied, the sortBy and sortType attributes is omitted. The code show as follows: {code:java} Map<String, String> paramsCopy = new HashMap<>(filter.getParams()); SearchFilter searchFilter = new SearchFilter(paramsCopy); {code} was: When getting the ranger policy list, we may want to sort the returned policy list according to certain fields, such as policyId, policyName and etc. But case shows that adding the parameters sortBy and sortType to the url has no effect (eg: http://192.168.0.12:6080/service/plugins/ policies/service/2?sortBy=policyName&sortType=desc&serviceName=default-Hdfs). I look through the source code and find that code supports sorting by fields, but due to some code bugs, it did not really take effect. The main reason for the problem is that when the SearchFilter is copied deeply, only the params is copied, the sortBy and sortType attributes is omitted. The code show as follows: {code:java} Map<String, String> paramsCopy = new HashMap<>(filter.getParams()); SearchFilter searchFilter = new SearchFilter(paramsCopy); {code} > Ranger policy list doesn't support sorting by field > --------------------------------------------------- > > Key: RANGER-3500 > URL: https://issues.apache.org/jira/browse/RANGER-3500 > Project: Ranger > Issue Type: Bug > Components: admin > Affects Versions: 2.1.0 > Reporter: Xuze Yang > Priority: Major > > When getting the ranger policy list, we may want to sort the returned policy > list according to certain fields, such as policyId, policyName and etc. But > case shows that adding the parameters sortBy and sortType to the url has no > effect (eg: > [http://192.168.0.12:6080/service/plugins/]policies/service/2?sortBy=policyName&sortType=desc&serviceName=default-Hdfs). > I look through the source code and find that code supports sorting by > fields, but due to some code bugs, it did not really take effect. > The main reason for the problem is that when the SearchFilter is copied > deeply, only the params is copied, the sortBy and sortType attributes is > omitted. The code show as follows: > {code:java} > Map<String, String> paramsCopy = new HashMap<>(filter.getParams()); > SearchFilter searchFilter = new SearchFilter(paramsCopy); > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)