Class MCRRestAPIUploadHelper

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

public class MCRRestAPIUploadHelper extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static jakarta.ws.rs.core.Response
    deleteAllFiles(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID)
    deletes all files inside a given derivate
    static jakarta.ws.rs.core.Response
    deleteDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID)
    deletes a whole derivate
    static String
    serializes a map of Strings into a compact JSON structure
    static jakarta.ws.rs.core.Response
    uploadDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String label, String classifications, boolean overwriteOnExisting)
    creates or updates a MyCoRe derivate
    static jakarta.ws.rs.core.Response
    uploadFile(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails, String formParamPath, boolean formParamMaindoc, boolean formParamUnzip, String formParamMD5, Long formParamSize)
    uploads a file into a given derivate
    static 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)
    uploads a MyCoRe Object based upon: http://puspendu.wordpress.com/2012/08/23/restful-webservice-file-upload-with-jersey/

    Methods inherited from class java.lang.Object

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

    • MCRRestAPIUploadHelper

      public MCRRestAPIUploadHelper()
  • Method Details

    • uploadObject

      public static 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) throws MCRRestAPIException
      uploads a MyCoRe Object based upon: http://puspendu.wordpress.com/2012/08/23/restful-webservice-file-upload-with-jersey/
      Parameters:
      info - - the Jersey UriInfo object
      request - - the HTTPServletRequest object
      uploadedInputStream - - the inputstream from HTTP Post request
      fileDetails - - the file information from HTTP Post request
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • uploadDerivate

      public static jakarta.ws.rs.core.Response uploadDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String label, String classifications, boolean overwriteOnExisting) throws MCRRestAPIException
      creates or updates a MyCoRe derivate
      Parameters:
      info - - the Jersey UriInfo object
      request - - the HTTPServletRequest object
      mcrObjID - - the MyCoRe Object ID
      label - - the label of the new derivate
      overwriteOnExisting - , if true, an existing MyCoRe derivate with the given label or classification will be returned
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • uploadFile

      public static jakarta.ws.rs.core.Response uploadFile(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID, InputStream uploadedInputStream, org.glassfish.jersey.media.multipart.FormDataContentDisposition fileDetails, String formParamPath, boolean formParamMaindoc, boolean formParamUnzip, String formParamMD5, Long formParamSize) throws MCRRestAPIException
      uploads a file into a given derivate
      Parameters:
      info - - the Jersey UriInfo object
      request - - the HTTPServletRequest object
      pathParamMcrObjID - - a MyCoRe Object ID
      pathParamMcrDerID - - a MyCoRe Derivate ID
      uploadedInputStream - - the inputstream from HTTP Post request
      fileDetails - - the file information from HTTP Post request
      formParamPath - - the path of the file inside the derivate
      formParamMaindoc - - true, if this file should be marked as maindoc
      formParamUnzip - - true, if the upload is zip file that should be unzipped inside the derivate
      formParamMD5 - - the MD5 sum of the uploaded file
      formParamSize - - the size of the uploaded file
      Returns:
      a Jersey Response object
      Throws:
      MCRRestAPIException
    • deleteAllFiles

      public static jakarta.ws.rs.core.Response deleteAllFiles(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID) throws MCRRestAPIException
      deletes all files inside a given derivate
      Parameters:
      info - - the Jersey UriInfo object
      request - - the HTTPServletRequest object
      pathParamMcrObjID - - the MyCoRe Object ID
      pathParamMcrDerID - - the MyCoRe Derivate ID
      Returns:
      a Jersey Response Object
      Throws:
      MCRRestAPIException
    • deleteDerivate

      public static jakarta.ws.rs.core.Response deleteDerivate(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String pathParamMcrObjID, String pathParamMcrDerID) throws MCRRestAPIException
      deletes a whole derivate
      Parameters:
      info - - the Jersey UriInfo object
      request - - the HTTPServletRequest object
      pathParamMcrObjID - - the MyCoRe Object ID
      pathParamMcrDerID - - the MyCoRe Derivate ID
      Returns:
      a Jersey Response Object
      Throws:
      MCRRestAPIException
    • generateMessagesFromProperties

      public static String generateMessagesFromProperties(SortedMap<String,String> data)
      serializes a map of Strings into a compact JSON structure
      Parameters:
      data - a sorted Map of Strings
      Returns:
      a compact JSON