Class MCRRestAPIObjects

java.lang.Object
org.mycore.restapi.v1.MCRRestAPIObjects

@Path("/objects") public class MCRRestAPIObjects extends Object
REST API methods to retrieve objects and derivates.
Version:
$Revision: $ $Date: $
Author:
Robert Stephan
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.ws.rs.core.Response
    deleteDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String mcrDerID)
    delete a whole derivate
    jakarta.ws.rs.core.Response
    deleteFiles(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String mcrDerID)
    delete all file from a given derivate
    jakarta.ws.rs.core.Response
    listContents(jakarta.ws.rs.core.UriInfo info, jakarta.ws.rs.core.Request request, String mcrid, String derid, String path, String format, int depth)
    returns a list of derivates for a given MyCoRe Object
    jakarta.ws.rs.core.Response
    listContents(jakarta.ws.rs.core.UriInfo info, String mcrObjID, String mcrDerID)
    redirects to the maindoc of the given derivate
    jakarta.ws.rs.core.Response
    listDerivates(jakarta.ws.rs.core.UriInfo info, String mcrid, String format, String sort)
    returns a list of derivates for a given MyCoRe Object
    jakarta.ws.rs.core.Response
    listObjects(jakarta.ws.rs.core.UriInfo info, String format, String filter, String sort)
    returns a list of mcrObjects
    jakarta.ws.rs.core.Response
    returnDerivate(jakarta.ws.rs.core.UriInfo info, String mcrid, String derid, String style)
    returns a single object in XML Format
    jakarta.ws.rs.core.Response
    returnMCRObject(jakarta.ws.rs.core.UriInfo info, String id, String style)
    returns a single derivate object in XML Format
    jakarta.ws.rs.core.Response
    uploadDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String label, String classifications, boolean overwrite)
    create a new (empty) MyCoRe derivate or returns one that already exists (by label)
    jakarta.ws.rs.core.Response
    uploadFile(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String mcrDerID, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails, String path, boolean maindoc, boolean unzip, String md5, Long size)
    upload a file into a given derivate
    jakarta.ws.rs.core.Response
    uploadObject(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails)
    create / update a MyCoRe object

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • MCRRestAPIObjects

      public MCRRestAPIObjects()
  • Method Details

    • listObjects

      @GET @Produces({"text/xml;charset=UTF-8","application/json;charset=UTF-8"}) public jakarta.ws.rs.core.Response listObjects(@Context jakarta.ws.rs.core.UriInfo info, @QueryParam("format") @DefaultValue("xml") String format, @QueryParam("filter") String filter, @QueryParam("sort") @DefaultValue("ID:asc") String sort) throws MCRRestAPIException
      returns a list of mcrObjects
      Parameters:
      info - - the injected Jersey URIInfo object
      format - - parameter for return format, values are * xml (default value) * json
      filter - - parameter with filters as colon-separated key-value-pairs, pair separator is semicolon, allowed values are * project - the MyCoRe ProjectID - first Part of a MyCoRe ID * type - the MyCoRe ObjectType - middle Part of a MyCoRe ID * lastModifiedBefore - last modified date in UTC is lesser than or equals to given value * lastModifiedAfter - last modified date in UTC is greater than or equals to given value;
      sort - - sortfield and sortorder combined by ':' * sortfield = ID | lastModified * sortorder = asc | desc
      Returns:
      a Jersey response object
      Throws:
      MCRRestAPIException
    • listDerivates

      @GET @Produces({"text/xml;charset=UTF-8","application/json;charset=UTF-8"}) @Path("/{mcrid}/derivates") public jakarta.ws.rs.core.Response listDerivates(@Context jakarta.ws.rs.core.UriInfo info, @PathParam("mcrid") String mcrid, @QueryParam("format") @DefaultValue("xml") String format, @QueryParam("sort") @DefaultValue("ID:asc") String sort) throws MCRRestAPIException
      returns a list of derivates for a given MyCoRe Object
      Parameters:
      info - - the injected Jersey URIInfo object
      mcrid - - an object identifier of syntax [id] or [prefix]:[id] Allowed Prefixes are "mcr" or application specific search keys "mcr" is the default prefix for MyCoRe IDs.
      format - - parameter for return format, values are * xml (default value) * json
      sort - - sortfield and sortorder combined by ':' * sortfield = ID | lastModified * sortorder = asc | desc
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • returnMCRObject

      @GET @Produces("text/xml") @Path("/{mcrid}") public jakarta.ws.rs.core.Response returnMCRObject(@Context jakarta.ws.rs.core.UriInfo info, @PathParam("mcrid") String id, @QueryParam("style") String style) throws MCRRestAPIException
      returns a single derivate object in XML Format
      Parameters:
      info - - the injected Jersey URIInfo object
      id - an object identifier of syntax [id] or [prefix]:[id] Allowed Prefixes are "mcr" or application specific search keys "mcr" is the default prefix for MyCoRe IDs.
      style - allowed values are "derivatedetails" derivate details will be integrated into the output.
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • returnDerivate

      @GET @Produces("text/xml") @Path("/{mcrid}/derivates/{derid}") public jakarta.ws.rs.core.Response returnDerivate(@Context jakarta.ws.rs.core.UriInfo info, @PathParam("mcrid") String mcrid, @PathParam("derid") String derid, @QueryParam("style") String style) throws MCRRestAPIException
      returns a single object in XML Format
      Parameters:
      info - - the injected Jersey URIInfo object
      mcrid - - a object identifier of syntax [id] or [prefix]:[id]
      derid - - a derivate identifier of syntax [id] or [prefix]:[id] Allowed Prefixes are "mcr" or application specific search keys "mcr" is the default prefix for MyCoRe IDs.
      style - - controls the output: allowed values are "derivatedetails" to integrate derivate details into the output.
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • listContents

      @GET @Produces({"text/xml;charset=UTF-8","application/json;charset=utf-8"}) @Path("/{mcrid}/derivates/{derid}/contents{path:(/.*)*}") public jakarta.ws.rs.core.Response listContents(@Context jakarta.ws.rs.core.UriInfo info, @Context jakarta.ws.rs.core.Request request, @PathParam("mcrid") String mcrid, @PathParam("derid") String derid, @PathParam("path") @DefaultValue("/") String path, @QueryParam("format") @DefaultValue("xml") String format, @QueryParam("depth") @DefaultValue("-1") int depth) throws MCRRestAPIException
      returns a list of derivates for a given MyCoRe Object
      Parameters:
      info - - the injected Jersey URIInfo object
      request - - the injected JAX-WS request object
      mcrid - - a object identifier of syntax [id] or [prefix]:[id]
      derid - - a derivate identifier of syntax [id] or [prefix]:[id] Allowed Prefixes are "mcr" or application specific search keys "mcr" is the default prefix for MyCoRe IDs.
      path - - the relative path to a directory inside a derivate
      format - - specifies the return format, allowed values are: * xml (default value) * json
      depth - - the level of subdirectories that should be returned
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • listContents

      @GET @Path("/{mcrid}/derivates/{derid}/open") public jakarta.ws.rs.core.Response listContents(@Context jakarta.ws.rs.core.UriInfo info, @PathParam("mcrid") String mcrObjID, @PathParam("derid") String mcrDerID) throws MCRRestAPIException
      redirects to the maindoc of the given derivate
      Parameters:
      info - - the injected Jersey URIInfo object
      mcrObjID - - a object identifier of syntax [id] or [prefix]:[id]
      mcrDerID - - a derivate identifier of syntax [id] or [prefix]:[id] Allowed Prefixes are "mcr" or application specific search keys "mcr" is the default prefix for MyCoRe IDs.
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • uploadObject

      @POST @Produces("text/xml;charset=UTF-8") @Consumes("multipart/form-data") public jakarta.ws.rs.core.Response uploadObject(@Context jakarta.ws.rs.core.UriInfo info, @Context jakarta.servlet.http.HttpServletRequest request, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails) throws MCRRestAPIException
      create / update a MyCoRe object
      Parameters:
      info - - the injected Jersey URIInfo object
      request - - the injected HTTPServletRequest object
      uploadedInputStream - - the MyCoRe Object (XML) as inputstream from HTTP Post
      fileDetails - - file metadata from HTTP Post
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • uploadDerivate

      @POST @Path("/{mcrid}/derivates") @Produces("text/xml;charset=UTF-8") @Consumes("multipart/form-data") public jakarta.ws.rs.core.Response uploadDerivate(@Context jakarta.ws.rs.core.UriInfo info, @Context jakarta.servlet.http.HttpServletRequest request, @PathParam("mcrid") String mcrObjID, String label, String classifications, @DefaultValue("false") boolean overwrite) throws MCRRestAPIException
      create a new (empty) MyCoRe derivate or returns one that already exists (by label)
      Parameters:
      info - - the injected Jersey URIInfo object
      request - - the injected HTTPServletRequest object
      mcrObjID - - a MyCoRe Object ID
      label - - the label of the new derivate
      overwrite - - if true, return an existing derivate (with same label)
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • uploadFile

      @POST @Path("/{mcrid}/derivates/{derid}/contents{path:(/.*)*}") @Produces("text/xml;charset=UTF-8") @Consumes("multipart/form-data") public jakarta.ws.rs.core.Response uploadFile(@Context jakarta.ws.rs.core.UriInfo info, @Context jakarta.servlet.http.HttpServletRequest request, @PathParam("mcrid") String mcrObjID, @PathParam("derid") String mcrDerID, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails, String path, @DefaultValue("false") boolean maindoc, @DefaultValue("false") boolean unzip, String md5, Long size) throws MCRRestAPIException
      upload a file into a given derivate
      Parameters:
      info - - the injected Jersey URIInfo object
      request - - the injected HTTPServletRequest object
      mcrObjID - - a MyCoRe Object ID
      mcrDerID - - a MyCoRe Derivate ID
      uploadedInputStream - - the inputstream from HTTP Post
      fileDetails - - file information from HTTP Post
      path - - the target path inside the derivate
      maindoc - - true, if the file should be set as maindoc
      unzip - - true, if the file is a zip file, that should be extracted
      md5 - - the md5 sum of the uploaded file
      size - - the size of the uploaded file
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • deleteFiles

      @DELETE @Path("/{mcrid}/derivates/{derid}/contents") public jakarta.ws.rs.core.Response deleteFiles(@Context jakarta.ws.rs.core.UriInfo info, @Context jakarta.servlet.http.HttpServletRequest request, @PathParam("mcrid") String mcrObjID, @PathParam("derid") String mcrDerID) throws MCRRestAPIException
      delete all file from a given derivate
      Parameters:
      info - - the injected Jersey URIInfo object
      request - - the injected HTTPServletRequest object
      mcrObjID - - a MyCoRe Object ID
      mcrDerID - - a MyCoRe Derivate ID
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • deleteDerivate

      @DELETE @Path("/{mcrid}/derivates/{derid}") public jakarta.ws.rs.core.Response deleteDerivate(@Context jakarta.ws.rs.core.UriInfo info, @Context jakarta.servlet.http.HttpServletRequest request, @PathParam("mcrid") String mcrObjID, @PathParam("derid") String mcrDerID) throws MCRRestAPIException
      delete a whole derivate
      Parameters:
      info - - the injected Jersey URIInfo object
      request - - the injected HTTPServletRequest object
      mcrObjID - - a MyCoRe Object ID
      mcrDerID - - a MyCoRe Derivate ID
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException