Class InmemPagedTrs

java.lang.Object
org.eclipse.lyo.oslc4j.trs.server.InmemPagedTrs
All Implemented Interfaces:
PagedTrs, TrsEventHandler

public class InmemPagedTrs extends Object implements PagedTrs, TrsEventHandler
This class is the backbone of the Tracked resource set service class. This class is extended by oslc adapters wishing to implement an OSLC TRS interface. The implementing classes need to implement one method returning the change history of the resources living in the tool exposed by the OSLC adapter
Since:
2.3.0
Version:
$version-stub$
  • Constructor Details

    • InmemPagedTrs

      public InmemPagedTrs(int basePageLimit, int changelogPageLimit, URI uriBase, String baseRelativePath, String changeLogRelativePath, Collection<URI> baseResourceUris)
      Parameters:
      basePageLimit - Max items per Base page
      changelogPageLimit - Max items per Changelog page
      uriBase - Set it via eg
      UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("trs").build()
      baseRelativePath - The relative path of the base, may contain URI template parameters.
      changeLogRelativePath - The relative path of the changeLog, may contain URI template parameters.
      baseResourceUris - Initial set of the TRS Base resource URIs
    • InmemPagedTrs

      public InmemPagedTrs(int basePageLimit, int changelogPageLimit, URI uriBase, Collection<URI> baseResourceUris)
      Parameters:
      basePageLimit - Max items per Base page
      changelogPageLimit - Max items per Changelog page
      uriBase - Set it via eg
      UriBuilder.fromUri(OSLC4JUtils.getServletURI()).path("trs").build()
      baseResourceUris - Initial set of the TRS Base resource URIs
  • Method Details

    • getBaseResource

      public Base getBaseResource(Integer pageId)
      Description copied from interface: PagedTrs
      Get a page from the paged Base
      Specified by:
      getBaseResource in interface PagedTrs
      Parameters:
      pageId - Base page number
      Returns:
      Base resource with the populated Page
    • getBaseResource

      public Base getBaseResource(URI uri)
      Description copied from interface: PagedTrs
      Get a Base resource by its URI
      Specified by:
      getBaseResource in interface PagedTrs
      Parameters:
      uri - URI of the Base resource
      Returns:
      Base resource or null if not found
    • getBaseFirst

      public Base getBaseFirst()
      Description copied from interface: PagedTrs
      Get the first Base resource.
      Specified by:
      getBaseFirst in interface PagedTrs
      Returns:
      the first Base resource, or null if none exist
    • getNext

      public Base getNext(Base base)
      Description copied from interface: PagedTrs
      Get the Base resource following the given Base.
      Specified by:
      getNext in interface PagedTrs
      Parameters:
      base - the current Base resource
      Returns:
      the next Base resource, or null if current is the last page
    • basePageCount

      public int basePageCount()
      Specified by:
      basePageCount in interface PagedTrs
      Returns:
      number of the Base pages
    • getChangeLog

      public ChangeLog getChangeLog(Integer pageId)
      Description copied from interface: PagedTrs
      Get a ChangeLog page
      Specified by:
      getChangeLog in interface PagedTrs
      Parameters:
      pageId - ChangeLog page number
      Returns:
      ChangeLog page with the populated link to the previous ChangeLog page.
    • getChangeLog

      public ChangeLog getChangeLog(URI uri)
      Description copied from interface: PagedTrs
      Get a ChangeLog page by its URI
      Specified by:
      getChangeLog in interface PagedTrs
      Parameters:
      uri - URI of the ChangeLog page
      Returns:
      ChangeLog page or null if not found
    • getChangeLogLast

      public ChangeLog getChangeLogLast()
      Description copied from interface: PagedTrs
      Get the last ChangeLog page.
      Specified by:
      getChangeLogLast in interface PagedTrs
      Returns:
      the last ChangeLog page
    • getPrevious

      public ChangeLog getPrevious(ChangeLog changeLog)
      Description copied from interface: PagedTrs
      Get the previous ChangeLog of the given changeLog.
      Specified by:
      getPrevious in interface PagedTrs
      Returns:
      the previous ChangeLog page
    • changelogPageCount

      public int changelogPageCount()
      Specified by:
      changelogPageCount in interface PagedTrs
      Returns:
      number of the ChangeLog pages
    • onCreated

      public void onCreated(IResource resource)
      Specified by:
      onCreated in interface TrsEventHandler
    • onModified

      public void onModified(IResource resource)
      Specified by:
      onModified in interface TrsEventHandler
    • onDeleted

      public void onDeleted(URI resourceUri)
      Specified by:
      onDeleted in interface TrsEventHandler
    • onHistoryData

      public void onHistoryData(HistoryData event)