Class EmbeddedPageHeader

java.lang.Object
org.dspace.app.rest.model.hateoas.EmbeddedPageHeader
Direct Known Subclasses:
EmbeddedPage

public class EmbeddedPageHeader extends Object
This class inserts pagination information into the endpoints. It constructs the "page" element (number, size, totalPages, totalElements) in the HalResource for the endpoints. It also constructs the "_links" element (next, last, prev, self, first) in the HalResource for the endpoints.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Represents a single HREF property for an single link (e.g. { "href": "[full-link-url]" } )
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.springframework.data.domain.Page
     
    protected org.springframework.web.util.UriComponentsBuilder
     
    protected boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    EmbeddedPageHeader(String self, org.springframework.data.domain.Page page, boolean totalElementsIsKnown)
     
    EmbeddedPageHeader(org.springframework.web.util.UriComponentsBuilder self, org.springframework.data.domain.Page page)
     
    EmbeddedPageHeader(org.springframework.web.util.UriComponentsBuilder self, org.springframework.data.domain.Page page, boolean totalElementsIsKnown)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Build the "_links" element with all valid pagination links (first, next, prev, last)
    Build the "page" element with all valid pagination information (number, size, totalPages, totalElements)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • page

      protected org.springframework.data.domain.Page page
    • totalElementsIsKnown

      protected boolean totalElementsIsKnown
    • self

      protected org.springframework.web.util.UriComponentsBuilder self
  • Constructor Details

    • EmbeddedPageHeader

      public EmbeddedPageHeader(org.springframework.web.util.UriComponentsBuilder self, org.springframework.data.domain.Page page, boolean totalElementsIsKnown)
    • EmbeddedPageHeader

      public EmbeddedPageHeader(String self, org.springframework.data.domain.Page page, boolean totalElementsIsKnown)
    • EmbeddedPageHeader

      public EmbeddedPageHeader(org.springframework.web.util.UriComponentsBuilder self, org.springframework.data.domain.Page page)
  • Method Details

    • getPageInfo

      public Map<String,Long> getPageInfo()
      Build the "page" element with all valid pagination information (number, size, totalPages, totalElements)
      Returns:
      Map that will be used to build the JSON of the "page" element
    • getLinks

      public Map<String,Object> getLinks()
      Build the "_links" element with all valid pagination links (first, next, prev, last)
      Returns:
      Map that will be used to build the JSON of the "_links" element