cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting KM Files

Former Member
0 Kudos

Hi ,

Requirement is Sort the Km files which is displayed in JSP dynpage by filename , by created date, by size.

Please suggest the solution.

Regards

Priya

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Priya

While creating the ResourceList you can use the Collator class which is used to sort the resource list according to the specified property. Here comes the Code for it


//To Get handle for the Folder where the Files reside
ICollection collection=(ICollection)resourceFactory.getResource(rid,context); 

//Proceding if the Folder Exixt
if(collection!=null && collection.hasChildren())
{				
      //Creating a Prperty by which we need to Sort the Files
       IPropertyName propName=new PropertyName("http://sapportals.com/xmlns/cm","displayname");
       //Creating Collator object
       Collator collator =new Collator();
       
       //Adding the Property as sort Criteria
       collator.addCriteria(propName,true);

       //Generating resource list by the sort order
       IResourceList resourceList=collection.getChildren(null,collator,null);
      
       resourceListItr = resourceList.listIterator();
}

Hope this will help you..

Regards

Noel

Answers (0)