Announcement Announcement Module
Collapse
No announcement yet.
RefreshablePagedListHolder deprecated Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • RefreshablePagedListHolder deprecated

    In Spring 2.5 the RefreshablePagedListHolder has been deprecated.
    • Why?
    • Will there be a replacement class?

  • #2
    Well... I would also like to know why and what can we do to replace it ?

    Comment


    • #3
      I think RefreshablePagedListHolder was used "only" for the sample application 'countries' (last seen in Spring 2.0.8).
      I used the RefreshablePagedListHolder and PagedListSourceProvider too and migrate them to my Source.

      If you want, you could chance the code (without a Locale) for PagedListSourceProvider:

      Code:
      public interface PagedListSourceProvider {
          // if you want to handle an Exception from the Service-Layer: throw an Exception.
          List loadList(Object filter) throws Exception;
      }
      ...and use it in the RefreshablePagedListHolder as follow:

      Code:
      public class RefreshablePagedListHolder extends PagedListHolder {
          private PagedListSourceProvider sourceProvider;
          private Object filter;
          private Object filterUsed;
      
          public RefreshablePagedListHolder() {
              super();
          }
      
          public RefreshablePagedListHolder(PagedListSourceProvider sourceProvider)  {    super();
              this.sourceProvider = sourceProvider;
          }
      
          public void setSourceProvider(PagedListSourceProvider sourceProvider) {
              this.sourceProvider = sourceProvider;
          }
      
          public PagedListSourceProvider getSourceProvider() {
              return this.sourceProvider;
          }
      
          public void setFilter(Object filter) {
              this.filter = filter;
          }
      
          public Object getFilter() {
              return this.filter;
          }
      
          public void refresh(boolean force) throws Exception {
              if (this.sourceProvider != null && (force || (this.filter != null && !this.filter.equals(this.filterUsed)))) {
                  setSource(this.sourceProvider.loadList(this.filter));
      
                  if (this.filter != null && !this.filter.equals(this.filterUsed)) {
                      this.setPage(0);
                  }
      
                  if (this.filter != null) {
                      this.filterUsed = BeanUtils.instantiateClass(this.filter.getClass());
                      BeanUtils.copyProperties(this.filter, this.filterUsed);
                  }
              }
              resort();
          }
      
      }
      In the Controller:

      Code:
      RefreshablePagedListHolder listHolder = request.getSession("sessionAttribute");
      if (listHolder == null) {
          listHolder = new RefreshablePagedListHolder();
          listHolder.setSourceProvider(new AnonymousOrEmbeddedSourceProvider());
          listHolder.setFilter(new AnonymousOrEmbeddedFilter());
          request.getSession().setAttribute("sessionAttribute", listHolder);
      }
      ServletRequestDataBinder binder = new ServletRequestDataBinder(listHolder, "model");
      binder.bind(request);
      try {
          listHolder.refresh(false);
      } catch (Exception e) {
          // handling Exception from Service
      }
      return ModelAndView("viewName", binder.getBindingResult().getModel());
      I hope this will help you and the PagedListHolder will be still alive in future releases of the Spring-Framework.
      Last edited by KISS Pattern; Mar 27th, 2008, 07:25 PM.

      Comment


      • #4
        Replacement for RefreshablePagedListHolder in 3.0?

        And I want to know it too.

        It is possible to become an answer from the Spring team?

        Comment


        • #5
          Hi zaccret/Fokko,

          Did you find any replacement for the RefreshablePagedListHolder in Spring 3.0?

          Comment

          Working...
          X