[ 
https://issues.apache.org/jira/browse/RANGER-3500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xuze Yang updated RANGER-3500:
------------------------------
    Attachment: 0002-RANGER-3500-Ranger-policy-list-doesn-t-support-sorti.patch

> 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
>            Assignee: Xuze Yang
>            Priority: Major
>         Attachments: 
> 0001-RANGER-3500-Ranger-policy-list-doesn-t-support-sorti.patch, 
> 0002-RANGER-3500-Ranger-policy-list-doesn-t-support-sorti.patch
>
>
> 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}
> // ServiceDBStore # getServicePolicies()
> Map<String, String> paramsCopy = new HashMap<>(filter.getParams()); 
> SearchFilter searchFilter = new SearchFilter(paramsCopy); {code}
>  
> {code:java}
> // SearchFilter.java
> private Map<String, String> params;
> private int                 startIndex;
> private int                 maxRows    = Integer.MAX_VALUE;
> private boolean             getCount   = true;
> private String              sortBy;
> private String              sortType;
> public SearchFilter(Map<String, String> values) {
>    setParams(values);
> }
> public void setParams(Map<String, String> params) {
>    this.params = params;
> }  {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to