!--a11y-->
Resource Order in Collections 
Applications processing children in collections often need to sort them in a specific order. In particular, when they present collections on the UI, they need to display them in a user-friendly sequence. To achieve this, applications have two alternatives. Either they can retrieve all the children of a collection and then order them with their own logic, or they can use the existing order in which the children are persisted in the repository. When very large collections are involved and applications only need a subset of the children, it can be advantageous to make use of the order already persisted in the repository.
The order in which the children of a collection are persisted in a repository is controlled by the ordering mechanism. Applications can find out what kind of ordering mechanism is active in a specific repository with the help of methods offered by the repository framework. If they find out that the order meets their requirements, they can simply retrieve the children without sorting them.
Repositories implement the following types of ordering mechanisms for collections:
● None
The repository supports no ordering mechanism for the children in a collection.
● Manual
The repository allows client applications to freely re-arrange the order of the collection’s children. A collection supporting this mechanism preserves the position of its child resources as defined by the client. When a client changes the position of a resource or a new child is inserted at a specific position, the sequence is persisted exactly as defined by the client.
· Server
The
repository applies an internal ordering mechanism to the list of children. It
can support several ordering mechanisms simultaneously, for example, by
creation
date
or by content
size.
The server ordering mechanism cannot be changed. It always remains as defined
by the ordering specification. If a repository supports several mechanisms, it
might be possible for an application to choose between the available
mechanisms.
Please note: this ordering mechanism is currently not supported by the
RF’s client API!
If a collection supports manual or server ordering it is called an ordered collection. This means that when a new child is created, its position is automatically determined by the active ordering mechanism.
See also: