Class SortNodesOperation

java.lang.Object
com.adobe.acs.commons.sorter.SortNodesOperation
All Implemented Interfaces:
org.apache.sling.servlets.post.PostOperation

public class SortNodesOperation extends Object implements org.apache.sling.servlets.post.PostOperation
The SortNodesOperation class implements the OPERATION_SORT operation for the Sling POST servlet.

Use this operation to alphabetize JCR nodes. For example, the following command line sorts the children of the /content/sample page:

     curl -u admin:admin -F":operation=acs-commons:sortNodes" http://localhost:4502/content/sample
 

You can use optional NodeNameSorter.RP_CASE_SENSITIVE and RP_SORTER_NAME parameters to control whether to sort by by node name (default) or by jcr:title and whether the sort should be case-sensitive:
     curl -u admin:admin -F":operation=acs-commons:sortNodes" \
     -F":sorterName:byTitle" -F":caseSensitive:true" \
     http://localhost:4502/content/someFolder
 
  • Field Details

    • OPERATION_SORT

      public static final String OPERATION_SORT
      Name of the sort operation. The acs-commons: prefix is to avoid name clash with other PostOperations .
      See Also:
    • RP_SORTER_NAME

      public static final String RP_SORTER_NAME
      Name of the request parameter indicating whether to sort nodes by jcr:title If this request parameter is missing then nodes will be sorted by node name.
      See Also:
    • DEFAULT_SORTER_NAME

      public static final String DEFAULT_SORTER_NAME
      See Also:
  • Constructor Details

    • SortNodesOperation

      public SortNodesOperation()
  • Method Details

    • bindNodeSorter

      protected void bindNodeSorter(NodeSorter sorter, Map<String,Object> properties)
    • unbindNodeSorter

      protected void unbindNodeSorter(NodeSorter sorter, Map<String,Object> properties)
    • run

      public void run(org.apache.sling.api.SlingHttpServletRequest slingRequest, org.apache.sling.servlets.post.PostResponse response, org.apache.sling.servlets.post.SlingPostProcessor[] processors)
      Specified by:
      run in interface org.apache.sling.servlets.post.PostOperation