[ 
https://issues.apache.org/jira/browse/OFBIZ-1723?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Skip Dever updated OFBIZ-1723:
------------------------------

    Attachment: EntityListContainer.ZIP

Contains the base java file and a sample bash/ftl

I do not expect this to be adopted and so did not "ofbizize" the code.

> Provides the core code to iterate next and previous through a table or view
> ---------------------------------------------------------------------------
>
>                 Key: OFBIZ-1723
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1723
>             Project: OFBiz
>          Issue Type: New Feature
>          Components: ALL COMPONENTS
>            Reporter: Skip Dever
>            Priority: Minor
>         Attachments: EntityListContainer.ZIP
>
>
> This enhancement provides the java code to allow an application to be written 
> that allows the user to click "Next" and "Previous" buttons to cycle through 
> a table or view.  Included in the download is 
> EntityListIteratorContainer.java, and a sample bsh script and .ftl file that 
> demonstrate how to use it.
> EntityListIteratorContainer.java creates an instance of EntityListIterator 
> that is used to provide the background services in an atomic way, i.e. each 
> operation (re)creates an EntityListIterator bounded by begin/commit 
> operations and the iterator is closed at the end of each operation.
> To use the class, use one of the EntityListIterator based instantiators and 
> then call find().  If find() is not called first, the list is assumed to be 
> positioned before the beginning of the table and next() returns the first 
> record.
> Calling previous() when at the beginnng of the file returns the last record.
> This code is self contained and the list goes away and is garbage collected 
> after 5 minutes of non-use on a timer.
> The bash script accounts for this by recreating the list and doing a find().
> The key to using this is found in the sample ftl file. Which has the tag:
>     <input type="hidden" name="listIterator" value="${listIterator}"/>
> The bash script puts the listIterator in the context and a text reference of 
> the form <url>[EMAIL PROTECTED] is passed when the form is submitted.
> This is dereferenced in the subsequent  bash script with the lines:
>       String containerString = (String)parameters.get("listIterator");
>       if(containerString != null)
>               container = 
> EntityListIteratorContainer.findInstance(containerString);
> This retrieves the previously constructed listIterator and next() and 
> previous() operations can be used on it as shown in the sample bash script.
> It all works a charm.  I have tested this on a medium sized table with 10000 
> entries and the first find() consumes about 80msecs.  Subsequent next() and 
> previous() calls consume < 20msecs.
> What would make this even better is a way to add a listener on the servlet 
> controller so that when the user moved to a different url base, the instance 
> could be trashed.  But, alas, I can find no such interface.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to