Package org.mycore.restapi.v1
Class MCRRestAPIObjects
java.lang.Object
org.mycore.restapi.v1.MCRRestAPIObjects
REST API methods to retrieve objects and derivates.
- Version:
- $Revision: $ $Date: $
- Author:
- Robert Stephan
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionjakarta.ws.rs.core.Response
deleteDerivate
(jakarta.ws.rs.core.UriInfo info, jakarta.servlet.http.HttpServletRequest request, String mcrObjID, String mcrDerID) delete a whole derivatejakarta.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 derivatejakarta.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 Objectjakarta.ws.rs.core.Response
listContents
(jakarta.ws.rs.core.UriInfo info, String mcrObjID, String mcrDerID) redirects to the maindoc of the given derivatejakarta.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 Objectjakarta.ws.rs.core.Response
listObjects
(jakarta.ws.rs.core.UriInfo info, String format, String filter, String sort) returns a list of mcrObjectsjakarta.ws.rs.core.Response
returnDerivate
(jakarta.ws.rs.core.UriInfo info, String mcrid, String derid, String style) returns a single object in XML Formatjakarta.ws.rs.core.Response
returnMCRObject
(jakarta.ws.rs.core.UriInfo info, String id, String style) returns a single derivate object in XML Formatjakarta.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 derivatejakarta.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
-
Field Details
-
STYLE_DERIVATEDETAILS
- See Also:
-
FORMAT_JSON
- See Also:
-
FORMAT_XML
- See Also:
-
SORT_ASC
- See Also:
-
SORT_DESC
- See Also:
-
-
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 objectformat
- - parameter for return format, values are * xml (default value) * jsonfilter
- - 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 objectmcrid
- - 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) * jsonsort
- - 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 objectid
- 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 objectmcrid
- - 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 objectrequest
- - the injected JAX-WS request objectmcrid
- - 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 derivateformat
- - specifies the return format, allowed values are: * xml (default value) * jsondepth
- - 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 objectmcrObjID
- - 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 objectrequest
- - the injected HTTPServletRequest objectuploadedInputStream
- - the MyCoRe Object (XML) as inputstream from HTTP PostfileDetails
- - 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 objectrequest
- - the injected HTTPServletRequest objectmcrObjID
- - a MyCoRe Object IDlabel
- - the label of the new derivateoverwrite
- - 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 objectrequest
- - the injected HTTPServletRequest objectmcrObjID
- - a MyCoRe Object IDmcrDerID
- - a MyCoRe Derivate IDuploadedInputStream
- - the inputstream from HTTP PostfileDetails
- - file information from HTTP Postpath
- - the target path inside the derivatemaindoc
- - true, if the file should be set as maindocunzip
- - true, if the file is a zip file, that should be extractedmd5
- - the md5 sum of the uploaded filesize
- - 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 objectrequest
- - the injected HTTPServletRequest objectmcrObjID
- - a MyCoRe Object IDmcrDerID
- - 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 objectrequest
- - the injected HTTPServletRequest objectmcrObjID
- - a MyCoRe Object IDmcrDerID
- - a MyCoRe Derivate ID- Returns:
- a Jersey Response object
- Throws:
MCRRestAPIException
-