ofbiz-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Deepak Dixit (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OFBIZ-1723) Provides the core code to iterate next and previous through a table or view
Date Sat, 03 Sep 2016 20:31:20 GMT

    [ https://issues.apache.org/jira/browse/OFBIZ-1723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15461649#comment-15461649
] 

Deepak Dixit commented on OFBIZ-1723:
-------------------------------------

Can we close this ?

> 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>?listIterator=org.ofbiz.base.util.EntityListIteratorContainer@xxxx 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message