Package com.logicaldoc.webservice.rest
Interface DocumentService
-
- All Known Implementing Classes:
RestDocumentService,RestDocumentSwagger
@Consumes({"application/xml","application/json"}) @Produces("application/json") public interface DocumentService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WSNoteaddNote(long docId, String note)Adds a new note for the given documentjavax.ws.rs.core.Responsecheckin(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)voidcheckout(long docId)javax.ws.rs.core.Responsecreate(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> atts)WSDocumentcreateAlias(long docId, long folderId, String type)Creates a new document alias for the given document inside a specified folderStringcreateDownloadTicket(long docId, String suffix, Integer expireHours, String expireDate, Integer maxDownloads)Creates a new download ticketvoidcreatePdf(long docId, String fileVersion)Creates the PDF conversion of the given document; if the PDF conversion was already created, nothing will happenvoidcreateThumbnail(long docId, String fileVersion)Creates the thumbail of the given document; if the thumbnail was already created, nothing will happenvoiddelete(long docId)voiddeleteLink(long id)Removes an existing linkvoiddeleteNote(long noteId)Deletes a new note by note identifierStringdeleteVersion(long docId, String version)Deletes a version by document identifier and version ID.WSDocument[]getAliases(long docId)Gets the aliases of the given documentjavax.activation.DataHandlergetContent(long docId)WSDocumentgetDocument(long docId)WSDocumentgetDocumentByCustomId(String customId)Gets document metadata of an existing document with the given custom identifierWSDocument[]getDocuments(Long[] docIds)Gets document metadata of a collection of existing documents with the given identifiersStringgetExtractedText(long docId)Gets the document's text stored in the full-text indexWSLink[]getLinks(long docId)Gets all the links of a specific documentWSNote[]getNotes(long docId)Gets the notes for the given documentWSRating[]getRatings(long docId)Gets all the ratings of the given documentWSDocument[]getRecentDocuments(Integer maxHits)Lists of last modified documents of the current sessionjavax.activation.DataHandlergetResource(long docId, String fileVersion, String suffix)Gets the content of a resource associated to the given document.javax.activation.DataHandlergetVersionContent(long docId, String version)WSDocument[]getVersions(long docId)Gets the version history of an existing document with the given identifierbooleanisReadable(long docId)Tests if a document is readableWSLinklink(long doc1, long doc2, String type)Creates a new link between two documents.WSDocument[]list(long folderId)WSDocument[]listDocuments(long folderId, String fileName)voidlock(long docId)Locks an existing document with the given identifier.voidmove(long docId, long folderId)Moves an existing document with the given identifiervoidpromoteVersion(long docId, String version)Promotes an old version to the current default one.WSRatingrateDocument(long docId, int vote)Puts a new rating on the given documentvoidreindex(long docId, String content)Re-indexes(or indexes from scratch) a documentvoidrename(long docId, String name)Renames the title of an existing document with the given identifier.javax.ws.rs.core.ResponsereplaceFile(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)voidrestore(long docId, long folderId)Restores a deleted documentWSNotesaveNote(long docId, WSNote note)Adds a new note for the given documentvoidsendEmail(Long[] docIds, String recipients, String subject, String message)Sends a set of documents as mail attachmentsvoidsetPassword(long docId, String password)Puts a password protection to the documentvoidunlock(long docId)Unlocks an existing document with the given identifier.booleanunprotect(long docId, String password)Unprotects a document that is password protected.voidunsetPassword(long docId, String currentPassword)Removes the password protection from the documentvoidupdate(WSDocument document)Updates an existing document with the value object containing the document's metadata.javax.ws.rs.core.Responseupload(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)voiduploadResource(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)Uploads a new resource attached to the given document.
-
-
-
Method Detail
-
create
@POST @Path("/create") @Consumes("multipart/form-data") javax.ws.rs.core.Response create(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> atts) throws Exception- Throws:
Exception
-
getDocument
@GET @Path("/getDocument") @Produces({"application/json","application/xml"}) WSDocument getDocument(@QueryParam("docId") long docId) throws Exception- Throws:
Exception
-
checkout
@POST @Path("/checkout") @Consumes("application/x-www-form-urlencoded") void checkout(@FormParam("docId") long docId) throws Exception- Throws:
Exception
-
checkin
@POST @Path("/checkin") @Consumes("multipart/form-data") @Produces({"text/plain","application/json","application/xml"}) javax.ws.rs.core.Response checkin(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments) throws Exception- Throws:
Exception
-
replaceFile
@POST @Path("/replaceFile") @Consumes("multipart/form-data") @Produces({"text/plain","application/json","application/xml"}) javax.ws.rs.core.Response replaceFile(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments) throws Exception- Throws:
Exception
-
upload
@POST @Path("/upload") @Consumes("multipart/form-data") @Produces({"text/plain","application/json","application/xml"}) javax.ws.rs.core.Response upload(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments) throws Exception- Throws:
Exception
-
delete
@DELETE @Path("/delete") void delete(@QueryParam("docId") long docId) throws Exception- Throws:
Exception
-
list
@GET @Path("/list") @Produces("application/json") WSDocument[] list(@QueryParam("folderId") long folderId) throws Exception- Throws:
Exception
-
listDocuments
@GET @Path("/listDocuments") WSDocument[] listDocuments(@QueryParam("folderId") long folderId, @QueryParam("fileName") String fileName) throws Exception- Throws:
Exception
-
update
@PUT @Path("/update") void update(WSDocument document) throws ExceptionUpdates an existing document with the value object containing the document's metadata.- Parameters:
document- the document to update- Throws:
Exception- error in the server application
-
getContent
@GET @Path("/getContent") @Produces("application/octet-stream") javax.activation.DataHandler getContent(@QueryParam("docId") long docId) throws Exception- Throws:
Exception
-
getVersionContent
@GET @Path("/getVersionContent") @Produces("application/octet-stream") javax.activation.DataHandler getVersionContent(@QueryParam("docId") long docId, @QueryParam("version") String version) throws Exception- Throws:
Exception
-
addNote
@POST @Path("/addNote") @Consumes("application/x-www-form-urlencoded") WSNote addNote(@FormParam("docId") long docId, @FormParam("note") String note) throws ExceptionAdds a new note for the given document- Parameters:
docId- identifier of the documentnote- the note to add- Returns:
- the added note
- Throws:
Exception- error in the server application
-
deleteNote
@DELETE @Path("/deleteNote") void deleteNote(@QueryParam("noteId") long noteId) throws ExceptionDeletes a new note by note identifier- Parameters:
noteId- identifier of the note- Throws:
Exception- error in the server application
-
getNotes
@GET @Path("/getNotes") WSNote[] getNotes(@QueryParam("docId") long docId) throws ExceptionGets the notes for the given document- Parameters:
docId- identifier of the document- Returns:
- array of notes
- Throws:
Exception- error in the server application
-
rateDocument
@PUT @Path("/rateDocument") WSRating rateDocument(@QueryParam("docId") long docId, @QueryParam("vote") int vote) throws ExceptionPuts a new rating on the given document- Parameters:
docId- identifier of the documentvote- the vote- Returns:
- the rating
- Throws:
Exception- error in the server application
-
getRatings
@GET @Path("/getRatings") WSRating[] getRatings(@QueryParam("docId") long docId) throws ExceptionGets all the ratings of the given document- Parameters:
docId- identifier of the document- Returns:
- the ratings
- Throws:
Exception- error in the server application
-
deleteVersion
@DELETE @Path("/deleteVersion") String deleteVersion(@QueryParam("docId") long docId, @QueryParam("version") String version) throws ExceptionDeletes a version by document identifier and version ID. You can not delete the latest version of a document- Parameters:
docId- identifier of the documentversion- the document's version- Returns:
- the latest version of the document
- Throws:
Exception- error in the server application
-
move
@PUT @Path("/move") void move(@QueryParam("docId") long docId, @QueryParam("folderId") long folderId) throws ExceptionMoves an existing document with the given identifier- Parameters:
docId- The document idfolderId- Identifier of the new document's folder- Throws:
Exception- error in the server application
-
createThumbnail
@PUT @Path("/createThumbnail") void createThumbnail(@QueryParam("docId") long docId, @QueryParam("fileVersion") String fileVersion) throws ExceptionCreates the thumbail of the given document; if the thumbnail was already created, nothing will happen- Parameters:
docId- The document idfileVersion- The specific file version(it can be empty)- Throws:
Exception- error in the server application
-
createPdf
@PUT @Path("/createPdf") void createPdf(@QueryParam("docId") long docId, @QueryParam("fileVersion") String fileVersion) throws ExceptionCreates the PDF conversion of the given document; if the PDF conversion was already created, nothing will happen- Parameters:
docId- The document idfileVersion- The specific file version(it can be empty)- Throws:
Exception- error in the server application
-
promoteVersion
@PUT @Path("/promoteVersion") void promoteVersion(@QueryParam("docId") long docId, @QueryParam("version") String version) throws ExceptionPromotes an old version to the current default one. If you promote a prior version, what it does is make it the default version again. (regardless of there being many versions).- Parameters:
docId- the document to be updatedversion- the version- Throws:
Exception- if an error occurs, this exception is thrown
-
rename
@PUT @Path("/rename") void rename(@QueryParam("docId") long docId, @QueryParam("name") String name) throws ExceptionRenames the title of an existing document with the given identifier.- Parameters:
docId- The document idname- The new document filename- Throws:
Exception- error in the server application
-
getVersions
@GET @Path("/getVersions") WSDocument[] getVersions(@QueryParam("docId") long docId) throws ExceptionGets the version history of an existing document with the given identifier- Parameters:
docId- The document id- Returns:
- Array of versions
- Throws:
Exception- error in the server application
-
createAlias
@POST @Path("/createAlias") WSDocument createAlias(long docId, long folderId, String type) throws ExceptionCreates a new document alias for the given document inside a specified folder- Parameters:
docId- The original document idfolderId- Identifier of the folder in which will be stored the alias.type- Type of the alias- Returns:
- The value object containing the document's metadata
- Throws:
Exception- error in the server application
-
createDownloadTicket
@POST @Path("/createDownloadTicket") @Consumes("application/x-www-form-urlencoded") String createDownloadTicket(long docId, String suffix, Integer expireHours, String expireDate, Integer maxDownloads) throws ExceptionCreates a new download ticket- Parameters:
docId- identifier of the documentsuffix- can be null or 'conversion.pdf'expireHours- expiration time expressed in hoursexpireDate- exact expiration date expressed in the format yyyy-MM-ddmaxDownloads- maximum number of admitted downloads- Returns:
- the download ticket
- Throws:
Exception- error in the server application
-
deleteLink
@DELETE @Path("/deleteLink") void deleteLink(long id) throws ExceptionRemoves an existing link- Parameters:
id- ID of the link- Throws:
Exception- error in the server application
-
getAliases
@GET @Path("/getAliases") WSDocument[] getAliases(long docId) throws ExceptionGets the aliases of the given document- Parameters:
docId- The master document ID- Returns:
- Arrays of aliases
- Throws:
Exception- error in the server application
-
getDocumentByCustomId
@GET @Path("/getDocumentByCustomId") WSDocument getDocumentByCustomId(String customId) throws ExceptionGets document metadata of an existing document with the given custom identifier- Parameters:
customId- The custom id- Returns:
- A value object containing the document's metadata
- Throws:
Exception- error in the server application
-
getDocuments
@GET @Path("/getDocuments") WSDocument[] getDocuments(Long[] docIds) throws ExceptionGets document metadata of a collection of existing documents with the given identifiers- Parameters:
docIds- identifiers of the documents- Returns:
- the list of documents
- Throws:
Exception- error in the server application
-
getExtractedText
@GET @Path("/getExtractedText") String getExtractedText(long docId) throws ExceptionGets the document's text stored in the full-text index- Parameters:
docId- The document id- Returns:
- The requested document's text
- Throws:
Exception- error in the server application
-
getRecentDocuments
@GET @Path("/getRecentDocuments") WSDocument[] getRecentDocuments(Integer maxHits) throws ExceptionLists of last modified documents of the current session- Parameters:
maxHits- Maximum number of returned records- Returns:
- Array of documents
- Throws:
Exception- error in the server application
-
getLinks
@GET @Path("/getLinks") WSLink[] getLinks(long docId) throws ExceptionGets all the links of a specific document- Parameters:
docId- ID of the document- Returns:
- The new links of the document
- Throws:
Exception- error in the server application
-
getResource
@GET @Path("/getResource") javax.activation.DataHandler getResource(long docId, String fileVersion, String suffix) throws ExceptionGets the content of a resource associated to the given document.- Parameters:
docId- The document idfileVersion- The specific file version(it can be empty)suffix- Suffix specification(it can be empty, conversion.pdf to get the PDF conversion)- Returns:
- The requested resource's binary
- Throws:
Exception- error in the server application
-
isReadable
boolean isReadable(long docId) throws ExceptionTests if a document is readable- Parameters:
docId- The document id- Returns:
- True if the identifier denotes a document, otherwise false
- Throws:
Exception- error in the server application
-
link
WSLink link(long doc1, long doc2, String type) throws Exception
Creates a new link between two documents.- Parameters:
doc1- ID of document 1doc2- ID of document 2type- The link type(it can be empty)- Returns:
- the new link
- Throws:
Exception- error in the server application
-
lock
void lock(long docId) throws Exception
Locks an existing document with the given identifier.- Parameters:
docId- The document id- Throws:
Exception- error in the server application
-
reindex
void reindex(long docId, String content) throws ExceptionRe-indexes(or indexes from scratch) a document- Parameters:
docId- The document idcontent- The content to be used (if null the file is parsed)- Throws:
Exception- error in the server application
-
uploadResource
@Consumes("multipart/form-data") void uploadResource(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments) throws ExceptionUploads a new resource attached to the given document. If the resource already exists it is overwritten.- Throws:
Exception- error in the server application
-
restore
void restore(long docId, long folderId) throws ExceptionRestores a deleted document- Parameters:
docId- The document idfolderId- Id of the folder in which the document must be restored- Throws:
Exception- error in the server application
-
saveNote
WSNote saveNote(long docId, WSNote note) throws Exception
Adds a new note for the given document- Parameters:
docId- identifier of the documentnote- the note to add- Returns:
- the added note
- Throws:
Exception- error in the server application
-
sendEmail
void sendEmail(Long[] docIds, String recipients, String subject, String message) throws Exception
Sends a set of documents as mail attachments- Parameters:
docIds- Set of document identifiersrecipients- Set of recipients(comma separated)subject- The email subjectmessage- The email message body- Throws:
Exception- error in the server application
-
setPassword
void setPassword(long docId, String password) throws ExceptionPuts a password protection to the document- Parameters:
docId- identifier of the documentpassword- the new password- Throws:
Exception- error in the server application
-
unlock
void unlock(long docId) throws ExceptionUnlocks an existing document with the given identifier.- Parameters:
docId- identifier of the document- Throws:
Exception- error in the server application
-
unprotect
boolean unprotect(long docId, String password) throws ExceptionUnprotects a document that is password protected. If the given password is right, the document remains unprotected for the duration of the session- Parameters:
docId- identifier of the documentpassword- the password- Returns:
- was it uprotected?
- Throws:
Exception- error in the server application
-
-