Class MCRRestAPIObjectsHelper

java.lang.Object
org.mycore.restapi.v1.utils.MCRRestAPIObjectsHelper

public class MCRRestAPIObjectsHelper extends Object
main utility class that handles REST requests to filter the XML output of showMCRObject, set the properties: MCR.RestAPI.v1.Filter.XML to your ContentTransformer-ID, MCR.ContentTransformer.[your ContentTransformer-ID here].Class to your ContentTransformer's class and MCR.ContentTransformer.[your ContentTransformer-ID here].Stylesheet to your filtering stylesheet.
Version:
$Revision: $ $Date: $
Author:
Robert Stephan, Christoph Neidahl
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    checks if the given path is a directory and contains children
    static jakarta.ws.rs.core.Response
    listContents(jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Application app, jakarta.ws.rs.core.Request request, String mcrObjID, String mcrDerID, String format, String path, int depth)
    lists derivate content (file listing)
    static jakarta.ws.rs.core.Response
    listDerivates(jakarta.ws.rs.core.UriInfo info, String mcrObjID, String format, String sort)
    returns a list of derivate objects
    static jakarta.ws.rs.core.Response
    listObjects(jakarta.ws.rs.core.UriInfo info, String format, String filter, String sort)
    returns a list of objects
    static String
    retrieveMaindocURL(jakarta.ws.rs.core.UriInfo info, String mcrObjID, String mcrDerID, jakarta.ws.rs.core.Application app)
    returns the URL of the main document of a derivate
    static jakarta.ws.rs.core.Response
    showMCRDerivate(String pathParamMcrID, String pathParamDerID, jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Application app, boolean withDetails)
     
    static jakarta.ws.rs.core.Response
    showMCRObject(String pathParamId, String queryParamStyle, jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Application app)
     

    Methods inherited from class java.lang.Object

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

    • MCRRestAPIObjectsHelper

      public MCRRestAPIObjectsHelper()
  • Method Details

    • showMCRObject

      public static jakarta.ws.rs.core.Response showMCRObject(String pathParamId, String queryParamStyle, jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Application app) throws MCRRestAPIException
      Throws:
      MCRRestAPIException
    • showMCRDerivate

      public static jakarta.ws.rs.core.Response showMCRDerivate(String pathParamMcrID, String pathParamDerID, jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Application app, boolean withDetails) throws MCRRestAPIException
      Throws:
      MCRRestAPIException
    • listObjects

      public static jakarta.ws.rs.core.Response listObjects(jakarta.ws.rs.core.UriInfo info, String format, String filter, String sort) throws MCRRestAPIException
      returns a list of objects
      Parameters:
      info - - the injected Jersey URIInfo object
      format - - the output format ('xml'|'json')
      filter - - a filter criteria
      sort - - the sort criteria
      Returns:
      a Jersey response object
      Throws:
      MCRRestAPIException
      See Also:
    • listDerivates

      public static jakarta.ws.rs.core.Response listDerivates(jakarta.ws.rs.core.UriInfo info, String mcrObjID, String format, String sort) throws MCRRestAPIException
      returns a list of derivate objects
      Parameters:
      info - - the injected Jersey URIInfo object
      mcrObjID - - the MyCoRe Object ID
      format - - the output format ('xml'|'json')
      sort - - the sort criteria
      Returns:
      a Jersey response object
      Throws:
      MCRRestAPIException
      See Also:
    • listContents

      public static jakarta.ws.rs.core.Response listContents(jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Application app, jakarta.ws.rs.core.Request request, String mcrObjID, String mcrDerID, String format, String path, int depth) throws MCRRestAPIException
      lists derivate content (file listing)
      Parameters:
      info - - the Jersey UriInfo Object
      request - - the HTTPServletRequest object
      mcrObjID - - the MyCoRe Object ID
      mcrDerID - - the MyCoRe Derivate ID
      format - - the output format ('xml'|'json')
      path - - the sub path of a directory inside the derivate
      depth - - the level of subdirectories to be returned
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • retrieveMaindocURL

      public static String retrieveMaindocURL(jakarta.ws.rs.core.UriInfo info, String mcrObjID, String mcrDerID, jakarta.ws.rs.core.Application app) throws IOException
      returns the URL of the main document of a derivate
      Parameters:
      info - - the Jersey UriInfo object
      mcrObjID - - the MyCoRe Object ID
      mcrDerID - - the MyCoRe Derivate ID
      Returns:
      the Resolving URL for the main document of the derivate
      Throws:
      IOException
    • hasChildren

      public static boolean hasChildren(Path p)
      checks if the given path is a directory and contains children
      Parameters:
      p - - the path to check
      Returns:
      true, if there are children