Uploaded image for project: 'JCommune'
  1. JCommune
  2. JC-237

Move pagination logic to service

VotersWatchers
    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 0.15
    • Fix Version/s: 0.17
    • Labels:

      Description

      now:

              int topicsCount = topicService.getTopicsPastLastDayCount(lastLogin);
              Pagination pag = new Pagination(page, size, topicsCount);
      
              List<Topic> topics = topicService.getAllTopicsPastLastDay(pag.getStart(), pag.getPageSize(), lastLogin);
              return new ModelAndView(..)
                      .addObject("maxPages", pag.getMaxPages())
                      .addObject(PAGE, pag.getPage())
      

      Refactoring:
      move Pagination class to service module
      create class PaginationResult for collection and data needed by controller (page, max pages, etc)
      for each paginated entity (Topic, Post etc) create one service method that returns PaginationResult and encapsulate querying total count, pagination logic, querying list of objects and populating PaginationResult

        Attachments

          Issue Links

            Structure

              Activity

                People

                • Assignee:
                  jk1 Evgeniy Naumenko
                  Reporter:
                  wedens Kirill Afonin
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Structure Helper Panel