<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Pagination: Best practice ?? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/pagination-best-practice/m-p/238854#M191984</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For my Web application based on Alfresco 3.1 (Repository services), I need to display the content of a space (the list of file).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Lot of space have a lot of file (500, 1000, maybe more in the futur…).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, in my own service, I need to manage a pagination in order to get files by bloc (10 by 10 in my case).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But by using for example &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;fileFolderService.listFiles(spaceNodeRef)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;, this service return ALL files… So it is not possible to use this service's method…&amp;nbsp; &lt;img id="smileysurprised" class="emoticon emoticon-smileysurprised" src="https://connect.hyland.com/i/smilies/16x16_smiley-surprised.png" alt="Smiley Surprised" title="Smiley Surprised" /&gt;ops: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A solution that I found, is to use the searchService in order to call Lucene &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;searchService.query(params);&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;, by setting a limit of record to return &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;params.setLimit(limit); params.setLimitBy(LimitBy.FINAL_SIZE);&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;. So for the first page, I will fixe the limit to 10 (if I want 10 files per page). for the second page, I will fixe the limit to 20 (and I will filter the result list to take the last 10 files…), and so&amp;nbsp; one… So If&amp;nbsp; I want&amp;nbsp; to see the page #15, I will oblige to set the limit to 150 !! So you can imagine that for first pages my solution is simple, but for all last pages it is the same solution than using &lt;/SPAN&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;fileFolderService.listFiles(spaceNodeRef)&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Moreover, and because I need to now the count of files inside the Space (I need to have the count total to calculate the number of page), I use a freemarker&amp;nbsp; template treatment:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;// Create the model object&lt;BR /&gt;HashMap model = new HashMap(1, 1.0f); &lt;BR /&gt;TemplateNode templateNode = new TemplateNode(spaceNodeRef, this.serviceRegistry, null);&lt;BR /&gt; model.put("thespace", templateNode);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;// Template freemarker&lt;BR /&gt;String xChilds = super.getTemplateService().processTemplateString("freemarker", "&amp;lt;#list thespace.children as child&amp;gt;&amp;lt;#if child.isDocument&amp;gt;x&amp;lt;/#if&amp;gt;&amp;lt;/#list&amp;gt;", model);&lt;BR /&gt;int totalGeneral = xChilds.length();&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;Ok I agree that it is not the best solution… but how to know the number of file in a space !???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, all this explaination, just to show my solution, and to know WHAT IS BEST PRACTICE FOR MANAGE PAGINATION !!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I cannot understand that with all these big project developped over Alfresco, no-one find a GOOD solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I read that in the 3.2 version, a pagination system was propose !!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Maybe in the searchService, because I saw in the 3.2 searchService API this new method:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;setSkipCount(int skipCount) with the exaplaintation =&amp;gt; Set the skip count - the number of rows to skip at the start of the query.&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it the case !?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thansk to everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and sorry for my poor english, I am French&amp;nbsp; :mrgreen: … and As all froggies I don't speak very well english &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&amp;nbsp; &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://connect.hyland.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Apr 2010 17:36:54 GMT</pubDate>
    <dc:creator>alex54</dc:creator>
    <dc:date>2010-04-08T17:36:54Z</dc:date>
    <item>
      <title>Pagination: Best practice ??</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/pagination-best-practice/m-p/238854#M191984</link>
      <description>Hi everybody,For my Web application based on Alfresco 3.1 (Repository services), I need to display the content of a space (the list of file).Lot of space have a lot of file (500, 1000, maybe more in the futur…).So, in my own service, I need to manage a pagination in order to get files by bloc (10 by</description>
      <pubDate>Thu, 08 Apr 2010 17:36:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/pagination-best-practice/m-p/238854#M191984</guid>
      <dc:creator>alex54</dc:creator>
      <dc:date>2010-04-08T17:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Pagination: Best practice ??</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/pagination-best-practice/m-p/238855#M191985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;no one did this in the past ???&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Apr 2010 12:27:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/pagination-best-practice/m-p/238855#M191985</guid>
      <dc:creator>alex54</dc:creator>
      <dc:date>2010-04-13T12:27:06Z</dc:date>
    </item>
  </channel>
</rss>

