Class RestDocumentService
- java.lang.Object
-
- com.logicaldoc.webservice.AbstractService
-
- com.logicaldoc.webservice.soap.endpoint.SoapDocumentService
-
- com.logicaldoc.webservice.rest.endpoint.RestDocumentService
-
- All Implemented Interfaces:
DocumentService
,DocumentService
- Direct Known Subclasses:
RestDocumentSwagger
@Path("/") @Consumes({"application/xml","application/json"}) @Produces("application/json") public class RestDocumentService extends SoapDocumentService implements DocumentService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
RestDocumentService.CheckinDocumentMultipartRequest
class
RestDocumentService.CreateDocumentMultipartRequest
class
RestDocumentService.ReplaceFileMultipartRequest
class
RestDocumentService.UploadDocumentMultipartRequest
class
RestDocumentService.UploadResourceMultipartRequest
-
Constructor Summary
Constructors Constructor Description RestDocumentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WSNote
addNote(long docId, String note)
Adds a new note for the given documentvoid
checkin(String docId, String comment, String releaseStr, String filename, org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
Check-in an existing document Performs a check-in (commit) operation of new content over an existing document.void
checkout(long docId)
Executed the checkoutWSDocument
copy(long docId, long folderId)
Copies a document into another folderWSDocument
create(WSDocument document, org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail)
Creates a new document using the metadata document object provided as JSON/XMLWSDocument
createAlias(long docId, long folderId, String type)
Creates a new document alias for the given document inside a specified folderString
createDownloadTicket(long docId, String suffix, Integer expireHours, String expireDate, Integer maxDownloads)
Creates a new download ticketvoid
createPdf(long docId, String fileVersion)
Creates the PDF conversion of the given document; if the PDF conversion was already created, nothing will happenvoid
createThumbnail(long docId, String fileVersion, String type)
Creates the thumbail of the given document; if the thumbnail was already created, nothing will happenvoid
delete(long docId)
Deletes a documentvoid
deleteLink(long id)
Removes an existing linkvoid
deleteNote(long noteId)
Deletes a new note by note identifierString
deleteVersion(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.DataHandler
getContent(long docId)
Retrieves the file content of a document.WSDocument
getDocument(long docId)
Retrieves a document from the databaseWSDocument
getDocumentByCustomId(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 identifiersString
getExtractedText(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.DataHandler
getResource(long docId, String fileVersion, String suffix)
Gets the content of a resource associated to the given document.javax.activation.DataHandler
getThumbnail(String type, String docPath, List<javax.ws.rs.core.PathSegment> docPathList)
Retrieves the thumbnail imagejavax.activation.DataHandler
getVersionContent(long docId, String version)
Retrieves the file content of a version.WSDocument[]
getVersions(long docId)
Gets the version history of an existing document with the given identifierboolean
isReadable(long docId)
Tests if a document is readableWSLink
link(long doc1, long doc2, String type)
Creates a new link between two documents.WSDocument[]
list(long folderId)
Lists the documents in a folderWSDocument[]
listDocuments(long folderId, String fileName)
Lists the documents in a foldervoid
lock(long docId)
Locks an existing document with the given identifier.void
move(long docId, long folderId)
Moves an existing document with the given identifiervoid
promoteVersion(long docId, String version)
Promotes an old version to the current default one.WSRating
rateDocument(long docId, int vote)
Puts a new rating on the given documentvoid
reindex(long docId, String content)
Re-indexes(or indexes from scratch) a documentvoid
rename(long docId, String name)
Renames the title of an existing document with the given identifier.void
replaceFile(Integer docId, String fileVersion, String comment, org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
Replace the file of a version Replaces the file associated to a given version.void
restore(long docId, long folderId)
Restores a deleted documentWSNote
saveNote(long docId, WSNote note)
Adds a new note for the given documentvoid
sendEmail(Long[] docIds, String recipients, String subject, String message)
Sends a set of documents as mail attachmentsvoid
setPassword(long docId, String password)
Puts a password protection to the documentvoid
unlock(long docId)
Unlocks an existing document with the given identifier.boolean
unprotect(long docId, String password)
Unprotects a document that is password protected.void
unsetPassword(long docId, String currentPassword)
Removes the password protection from the documentvoid
update(WSDocument document)
Updates an existing document with the value object containing the document's metadata.Long
upload(String docId, String folderId, String release, String filename, String language, org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
Uploads a document Creates or updates an existing document, if used in update mode docId must be provided, when used in create mode folderId is required.void
uploadResource(Integer docId, String fileVersion, String suffix, org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail)
Uploads a new resource of the document Uploads a new resource attached to the given document.-
Methods inherited from class com.logicaldoc.webservice.soap.endpoint.SoapDocumentService
addNote, checkin, checkin, checkinDocument, checkinDocument, checkout, copy, create, create, createAlias, createDownloadTicket, createPdf, createThumbnail, delete, deleteLink, deleteNote, deleteVersion, getAliases, getContent, getDocument, getDocumentByCustomId, getDocuments, getExtractedText, getLinks, getNotes, getRatings, getRecentDocuments, getResource, getVersion, getVersionContent, getVersions, isReadable, link, listDocuments, lock, move, promoteVersion, rateDocument, reindex, rename, replaceFile, restore, saveNote, sendEmail, setPassword, unlock, unprotect, unsetPassword, update, upload, uploadResource
-
Methods inherited from class com.logicaldoc.webservice.AbstractService
convertDateToString, convertStringToDate, getContext, getMessageContext, isValidateSession, setContext, setMessageContext, setValidateSession
-
-
-
-
Method Detail
-
create
@POST @Path("/create") @Consumes("multipart/form-data") @Produces("application/json") public WSDocument create(WSDocument document, org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail)
Creates a new document using the metadata document object provided as JSON/XML- Specified by:
create
in interfaceDocumentService
- Parameters:
document
- the document's metadatacontentDetail
- the file content- Returns:
- the created document
-
getDocument
@GET @Path("/getDocument") @Produces({"application/json","application/xml"}) public WSDocument getDocument(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Retrieves a document from the database- Specified by:
getDocument
in interfaceDocumentService
- Parameters:
docId
- identifier of the document- Returns:
- the document object representation
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
checkout
@POST @Path("/checkout") @Consumes("application/x-www-form-urlencoded") public void checkout(@FormParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Executed the checkout- Specified by:
checkout
in interfaceDocumentService
- Parameters:
docId
- identifier of the document- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
checkin
@POST @Path("/checkin") @Consumes("multipart/form-data") public void checkin(String docId, String comment, String releaseStr, String filename, org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
Description copied from interface:DocumentService
Check-in an existing document Performs a check-in (commit) operation of new content over an existing document. The document must be in checked-out status- Specified by:
checkin
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentcomment
- version commentreleaseStr
- it this is a major version or notfilename
- filename of the documentfiledataDetail
- binary content of the file
-
upload
@POST @Path("/upload") @Consumes("multipart/form-data") public Long upload(String docId, String folderId, String release, String filename, String language, org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
Description copied from interface:DocumentService
Uploads a document Creates or updates an existing document, if used in update mode docId must be provided, when used in create mode folderId is required. Returns the ID of the created/updated document. <br/>Example: curl -u admin:admin -H ''Accept: application/json'' -X POST -F folderId=4 -F filename=newDoc.txt -F filedata=@newDoc.txt http://localhost:8080/services/rest/document/upload- Specified by:
upload
in interfaceDocumentService
- Parameters:
docId
- identifier of the document (string format)folderId
- identifier of the folderrelease
- if the upload must produce a major release or nowfilename
- name of the filelanguage
- the document's languagefiledataDetail
- the binary content- Returns:
- identifier of the updated document
-
replaceFile
@POST @Path("/replaceFile") @Consumes("multipart/form-data") public void replaceFile(Integer docId, String fileVersion, String comment, org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
Replace the file of a version Replaces the file associated to a given version.- Specified by:
replaceFile
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentfileVersion
- the file versioncomment
- version commentfiledataDetail
- binary content of the file
-
delete
@DELETE @Path("/delete") public void delete(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Deletes a document- Specified by:
delete
in interfaceDocumentService
- Parameters:
docId
- identifier of the document to delete- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
list
@GET @Path("/list") @Produces("application/json") public WSDocument[] list(@QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Lists the documents in a folder- Specified by:
list
in interfaceDocumentService
- Parameters:
folderId
- identifier of the folder- Returns:
- array of documents contained in the folder
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
listDocuments
@GET @Path("/listDocuments") public WSDocument[] listDocuments(@QueryParam("folderId") long folderId, @QueryParam("fileName") String fileName) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Lists the documents in a folder- Specified by:
listDocuments
in interfaceDocumentService
- Parameters:
folderId
- identifier of the folderfileName
- a file name to use as filter- Returns:
- array of documents contained in the folder
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getContent
@GET @Path("/getContent") @Produces("application/octet-stream") public javax.activation.DataHandler getContent(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Retrieves the file content of a document.- Specified by:
getContent
in interfaceDocumentService
- Parameters:
docId
- identifier of the document- Returns:
- the contents
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
getVersionContent
@GET @Path("/getVersionContent") @Produces("application/octet-stream") public javax.activation.DataHandler getVersionContent(@QueryParam("docId") long docId, @QueryParam("version") String version) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Retrieves the file content of a version.- Specified by:
getVersionContent
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentversion
- version specification- Returns:
- the contents
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
deleteVersion
@DELETE @Path("/deleteVersion") public String deleteVersion(@QueryParam("docId") long docId, @QueryParam("version") String version) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Deletes a version by document identifier and version ID. You can not delete the latest version of a document- Specified by:
deleteVersion
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentversion
- the document's version- Returns:
- the latest version of the document
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
update
@PUT @Path("/update") public void update(WSDocument document) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Updates an existing document with the value object containing the document's metadata.- Specified by:
update
in interfaceDocumentService
- Parameters:
document
- the document to update- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
addNote
@POST @Path("/addNote") @Consumes("application/x-www-form-urlencoded") public WSNote addNote(@FormParam("docId") long docId, @FormParam("note") String note) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Adds a new note for the given document- Specified by:
addNote
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentnote
- the note to add- Returns:
- the added note
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
deleteNote
@DELETE @Path("/deleteNote") public void deleteNote(@QueryParam("noteId") long noteId) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Deletes a new note by note identifier- Specified by:
deleteNote
in interfaceDocumentService
- Parameters:
noteId
- identifier of the note- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getNotes
@GET @Path("/getNotes") public WSNote[] getNotes(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets the notes for the given document- Specified by:
getNotes
in interfaceDocumentService
- Parameters:
docId
- identifier of the document- Returns:
- array of notes
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
rateDocument
@PUT @Path("/rateDocument") public WSRating rateDocument(@QueryParam("docId") long docId, @QueryParam("vote") int vote) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Puts a new rating on the given document- Specified by:
rateDocument
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentvote
- the vote- Returns:
- the voted document
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getRatings
@GET @Path("/getRatings") public WSRating[] getRatings(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets all the ratings of the given document- Specified by:
getRatings
in interfaceDocumentService
- Parameters:
docId
- identifier of the document- Returns:
- the ratings
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
move
@PUT @Path("/move") public void move(@QueryParam("docId") long docId, @QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Moves an existing document with the given identifier- Specified by:
move
in interfaceDocumentService
- Parameters:
docId
- The document idfolderId
- Identifier of the new document's folder- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
copy
@PUT @Path("/move") @Produces("application/json") public WSDocument copy(@QueryParam("docId") long docId, @QueryParam("folderId") long folderId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Copies a document into another folder- Specified by:
copy
in interfaceDocumentService
- Parameters:
docId
- The document idfolderId
- Identifier of the new document's folder- Returns:
- The new copy
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
createThumbnail
@PUT @Path("/createThumbnail") public void createThumbnail(@QueryParam("docId") long docId, @QueryParam("fileVersion") String fileVersion, @QueryParam("type") String type) throws AuthenticationException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Creates the thumbail of the given document; if the thumbnail was already created, nothing will happen- Specified by:
createThumbnail
in interfaceDocumentService
- Parameters:
docId
- The document idfileVersion
- The specific file version(it can be empty)type
- The thumbnail type(eg: thumbnail, tile, mobile)- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
createPdf
@PUT @Path("/createPdf") public void createPdf(@QueryParam("docId") long docId, @QueryParam("fileVersion") String fileVersion) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Creates the PDF conversion of the given document; if the PDF conversion was already created, nothing will happen- Specified by:
createPdf
in interfaceDocumentService
- Parameters:
docId
- The document idfileVersion
- The specific file version(it can be empty)- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
promoteVersion
@PUT @Path("/promoteVersion") public void promoteVersion(@QueryParam("docId") long docId, @QueryParam("version") String version) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Promotes 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).- Specified by:
promoteVersion
in interfaceDocumentService
- Parameters:
docId
- the document to be updatedversion
- the version- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
rename
@PUT @Path("/rename") public void rename(@QueryParam("docId") long docId, @QueryParam("name") String name) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Renames the title of an existing document with the given identifier.- Specified by:
rename
in interfaceDocumentService
- Parameters:
docId
- The document idname
- The new document filename- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getVersions
@GET @Path("/getVersions") public WSDocument[] getVersions(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets the version history of an existing document with the given identifier- Specified by:
getVersions
in interfaceDocumentService
- Parameters:
docId
- The document id- Returns:
- Array of versions
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
createAlias
@POST @Path("/createAlias") @Consumes("application/x-www-form-urlencoded") public WSDocument createAlias(@FormParam("docId") long docId, @FormParam("folderId") long folderId, @FormParam("type") String type) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Creates a new document alias for the given document inside a specified folder- Specified by:
createAlias
in interfaceDocumentService
- 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:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
createDownloadTicket
@POST @Path("/createDownloadTicket") @Consumes("application/x-www-form-urlencoded") public String createDownloadTicket(@FormParam("docId") long docId, @FormParam("suffix") String suffix, @FormParam("expireHours") Integer expireHours, @FormParam("expireDate") String expireDate, @FormParam("maxDownloads") Integer maxDownloads) throws AuthenticationException, WebserviceException, PersistenceException, PermissionException
Description copied from interface:DocumentService
Creates a new download ticket- Specified by:
createDownloadTicket
in interfaceDocumentService
- 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:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databasePermissionException
- The user does not have the download permission
-
deleteLink
@DELETE @Path("/deleteLink") public void deleteLink(@QueryParam("id") long id) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Removes an existing link- Specified by:
deleteLink
in interfaceDocumentService
- Parameters:
id
- ID of the link- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getAliases
@GET @Path("/getAliases") public WSDocument[] getAliases(@QueryParam("docId") long docId) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets the aliases of the given document- Specified by:
getAliases
in interfaceDocumentService
- Parameters:
docId
- The master document ID- Returns:
- Arrays of aliases
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getDocumentByCustomId
@GET @Path("/getDocumentByCustomId") public WSDocument getDocumentByCustomId(@QueryParam("customId") String customId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets document metadata of an existing document with the given custom identifier- Specified by:
getDocumentByCustomId
in interfaceDocumentService
- Parameters:
customId
- The custom id- Returns:
- A value object containing the document's metadata
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getDocuments
@GET @Path("/getDocuments") public WSDocument[] getDocuments(@QueryParam("docIds") Long[] docIds) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets document metadata of a collection of existing documents with the given identifiers- Specified by:
getDocuments
in interfaceDocumentService
- Parameters:
docIds
- identifiers of the documents- Returns:
- the list of documents
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getExtractedText
@GET @Path("/getExtractedText") @Produces("text/plain") public String getExtractedText(@QueryParam("docId") long docId) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets the document's text stored in the full-text index- Specified by:
getExtractedText
in interfaceDocumentService
- Parameters:
docId
- The document id- Returns:
- The requested document's text
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getRecentDocuments
@GET @Path("/getRecentDocuments") public WSDocument[] getRecentDocuments(@QueryParam("maxHits") Integer maxHits) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Lists of last modified documents of the current session- Specified by:
getRecentDocuments
in interfaceDocumentService
- Parameters:
maxHits
- Maximum number of returned records- Returns:
- Array of documents
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getLinks
@GET @Path("/getLinks") public WSLink[] getLinks(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Gets all the links of a specific document- Specified by:
getLinks
in interfaceDocumentService
- Parameters:
docId
- ID of the document- Returns:
- The new links of the document
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
getResource
@GET @Path("/getResource") @Produces("application/octet-stream") public javax.activation.DataHandler getResource(@QueryParam("docId") long docId, @QueryParam("fileVersion") String fileVersion, @QueryParam("suffix") String suffix) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Gets the content of a resource associated to the given document.- Specified by:
getResource
in interfaceDocumentService
- 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:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
isReadable
@GET @Path("/isReadable") public boolean isReadable(@QueryParam("docId") long docId) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Tests if a document is readable- Specified by:
isReadable
in interfaceDocumentService
- Parameters:
docId
- The document id- Returns:
- True if the identifier denotes a document, otherwise false
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
link
@POST @Path("/link") @Consumes("application/x-www-form-urlencoded") public WSLink link(@FormParam("doc1") long doc1, @FormParam("doc2") long doc2, @FormParam("type") String type) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Creates a new link between two documents.- Specified by:
link
in interfaceDocumentService
- Parameters:
doc1
- ID of document 1doc2
- ID of document 2type
- The link type(it can be empty)- Returns:
- the new link
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
lock
@PUT @Path("/lock") public void lock(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Locks an existing document with the given identifier.- Specified by:
lock
in interfaceDocumentService
- Parameters:
docId
- The document id- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
reindex
@POST @Path("/reindex") @Consumes("application/x-www-form-urlencoded") public void reindex(@FormParam("doc1") long docId, @FormParam("content") String content) throws AuthenticationException, ParseException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Re-indexes(or indexes from scratch) a document- Specified by:
reindex
in interfaceDocumentService
- Parameters:
docId
- The document idcontent
- The content to be used (if null the file is parsed)- Throws:
AuthenticationException
- Invalid credentialsParseException
- Error parsing the contentWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
uploadResource
@POST @Path("/uploadResource") @Consumes("multipart/form-data") public void uploadResource(Integer docId, String fileVersion, String suffix, org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException, IOException
Description copied from interface:DocumentService
Uploads a new resource of the document Uploads a new resource attached to the given document. If the resource already exists it is overwritten- Specified by:
uploadResource
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentfileVersion
- version of the filesuffix
- suffix specificationcontentDetail
- file content- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O error
-
restore
@PUT @Path("/restore") public void restore(@QueryParam("docId") long docId, @QueryParam("folderId") long folderId) throws AuthenticationException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Restores a deleted document- Specified by:
restore
in interfaceDocumentService
- Parameters:
docId
- The document idfolderId
- Id of the folder in which the document must be restored- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
saveNote
@POST @Path("/saveNote") @Consumes("application/x-www-form-urlencoded") public WSNote saveNote(@FormParam("docId") long docId, @FormParam("note") WSNote note) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Adds a new note for the given document- Specified by:
saveNote
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentnote
- the note to add- Returns:
- the added note
- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
sendEmail
@POST @Path("/sendEmail") @Consumes("application/x-www-form-urlencoded") public void sendEmail(@FormParam("docIds") Long[] docIds, @FormParam("recipients") String recipients, @FormParam("subject") String subject, @FormParam("message") String message) throws AuthenticationException, WebserviceException, PersistenceException, IOException, javax.mail.MessagingException
Description copied from interface:DocumentService
Sends a set of documents as mail attachments- Specified by:
sendEmail
in interfaceDocumentService
- Parameters:
docIds
- Set of document identifiersrecipients
- Set of recipients(comma separated)subject
- The email subjectmessage
- The email message body- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O errorjavax.mail.MessagingException
- Error in the communication with the mail server
-
setPassword
@POST @Path("/setPassword") @Consumes("application/x-www-form-urlencoded") public void setPassword(@FormParam("docId") long docId, @FormParam("password") String password) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Puts a password protection to the document- Specified by:
setPassword
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentpassword
- the new password- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
unlock
@PUT @Path("/unlock") public void unlock(@QueryParam("docId") long docId) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Unlocks an existing document with the given identifier.- Specified by:
unlock
in interfaceDocumentService
- Parameters:
docId
- identifier of the document- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
unsetPassword
@POST @Path("/unsetPassword") @Consumes("application/x-www-form-urlencoded") public void unsetPassword(@FormParam("docId") long docId, @FormParam("currentPassword") String currentPassword) throws AuthenticationException, PermissionException, WebserviceException, PersistenceException
Description copied from interface:DocumentService
Removes the password protection from the document- Specified by:
unsetPassword
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentcurrentPassword
- the password- Throws:
AuthenticationException
- Invalid credentialsPermissionException
- The current user does not have enough permissionsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the database
-
unprotect
@POST @Path("/unprotect") @Consumes("application/x-www-form-urlencoded") public boolean unprotect(@FormParam("docId") long docId, @FormParam("password") String password) throws PersistenceException
Description copied from interface:DocumentService
Unprotects a document that is password protected. If the given password is right, the document remains unprotected for the duration of the session- Specified by:
unprotect
in interfaceDocumentService
- Parameters:
docId
- identifier of the documentpassword
- the password- Returns:
- was it uprotected?
- Throws:
PersistenceException
- Error in the database
-
getThumbnail
@GET @Path("/thumbnail/{type}/{docpath:.*}") @Produces("image/png") public javax.activation.DataHandler getThumbnail(@PathParam("type") String type, @PathParam("docpath") String docPath, @PathParam("docpath") List<javax.ws.rs.core.PathSegment> docPathList) throws AuthenticationException, WebserviceException, PersistenceException, IOException, PermissionException
Description copied from interface:DocumentService
Retrieves the thumbnail image- Specified by:
getThumbnail
in interfaceDocumentService
- Parameters:
type
- type of the thumbnaildocPath
- path of the documentdocPathList
- path of the document- Returns:
- image content
- Throws:
AuthenticationException
- Invalid credentialsWebserviceException
- A generic error in the WebServicePersistenceException
- Error in the databaseIOException
- I/O errorPermissionException
- The current user does not have enough permissions
-
-