@@ -0,0 +1,2196 @@
+package com.celements.collections.services;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.xwiki.component.annotation.Component;%0Aimport org.xwiki.component.annotation.Requirement;%0Aimport org.xwiki.context.Execution;%0Aimport org.xwiki.model.reference.DocumentReference;%0Aimport org.xwiki.script.service.ScriptService;%0A%0Aimport com.celements.web.service.IWebUtilsService;%0Aimport com.xpn.xwiki.XWikiContext;%0Aimport com.xpn.xwiki.api.Document;%0Aimport com.xpn.xwiki.objects.BaseObject;%0A%0A@Component(%22collections%22)%0Apublic class CollectionsScriptService implements ScriptService %7B%0A%0A  @Requirement%0A  IWebUtilsService webUtilsService;%0A  %0A  @Requirement%0A  Execution execution;%0A  %0A  %0A  public List%3Ccom.xpn.xwiki.api.Object%3E getObjectsOrdered(Document doc, %0A      DocumentReference classRef,%0A      String orderField, boolean asc) %7B%0A    return getObjectsOrdered(doc, classRef, orderField, asc, null, false);%0A  %7D%0A  %0A  /**%0A   * Get a list of Objects for a Document sorted by one or two fields.%0A   * %0A   * @param doc The Document where the Objects are attached.%0A   * @param classRef The reference to the class of the Objects to return%0A   * @param orderField1 Field to order the objects by. First priority.%0A   * @param asc1 Order first priority ascending or descending.%0A   * @param orderField2 Field to order the objects by. Second priority.%0A   * @param asc2 Order second priority ascending or descending.%0A   * @return List of objects ordered as specified%0A   */%0A  public List%3Ccom.xpn.xwiki.api.Object%3E getObjectsOrdered(Document doc, %0A      DocumentReference classRef, String orderField1, boolean asc1, String orderField2, %0A      boolean asc2) %7B%0A    List%3CBaseObject%3E bObjs = webUtilsService.getObjectsOrdered(doc.getDocument(), %0A        classRef, orderField1, asc1, orderField2, asc2);%0A    List%3Ccom.xpn.xwiki.api.Object%3E objs = new ArrayList%3Ccom.xpn.xwiki.api.Object%3E();%0A    for (BaseObject bObj : bObjs) %7B%0A      com.xpn.xwiki.api.Object obj = new com.xpn.xwiki.api.Object(bObj, getContext());%0A      if(obj != null) %7B%0A        objs.add(obj);%0A      %7D%0A    %7D%0A    return objs;%0A  %7D%0A  %0A  private XWikiContext getContext() %7B%0A    return (XWikiContext)execution.getContext().getProperty(%22xwikicontext%22);%0A  %7D%0A%7D%0A

add API for getObjectsOrdered method in new ScriptService CollectionsScriptService