Interface DocumentService
-
- All Superinterfaces:
com.google.gwt.user.client.rpc.RemoteService
- All Known Implementing Classes:
DocumentServiceImpl
@RemoteServiceRelativePath("document") public interface DocumentService extends com.google.gwt.user.client.rpc.RemoteServiceThe client side stub for the Document Service. This service allows r/w operations on documents.- Since:
- 6.0
- Author:
- Marco Meschieri - LogicalDOC
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDocumentService.Instance
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBookmarks(long[] targetIds, int type)Adds new bookmarksGUIDocument[]addDocuments(boolean importZip, String charset, boolean immediateIndexing, GUIDocument metadata)GUIDocument[]addDocuments(String language, long folderId, boolean importZip, String charset, boolean immediateIndexing, Long templateId)Adds new documents previously uploadedlongaddNote(long docId, String note)Adds a new document note on the given documentvoidarchiveDocuments(long[] docIds, String comment)Archives a set of documentslongarchiveFolder(long folderId, String comment)Archives the documents in a folderGUIDocument[]bulkUpdate(long[] ids, GUIDocument vo, boolean ignoreEmptyFields)Applies to a selection of documents all the given dataGUIDocumentcheckin(GUIDocument document, boolean major)Checks-in a new document versionGUIDocumentcheckinContent(long docId, String content)Checks-in a new document's text contentvoidcheckout(long[] docIds)Checks out the documentvoidcleanUploadedFileFolder()Cleans the uploaded files folderGUIDocumentconvert(long docId, String fileVersion, String format)Converts a document in a given formatlongcountDocuments(long[] folderIds, int status)Counts the documents in a given status contained the specified folder's treesGUIDocumentcreateDocument(GUIDocument document, String content)Creates a new document with the given text contentString[]createDownloadTicket(long docId, String suffix, Integer expireHours, Date expireDate, Integer maxDownloads)Creates a download ticketGUIDocumentcreateWithContent(GUIDocument vo, String content, boolean checkout)Creates a new empty documentvoiddeDuplicate(Long folderId, boolean retainNewest)Convert duplicates with aliases, just one of the documents is maintainedvoiddelete(long[] ids)Deletes a selection of documentsvoiddeleteBookmarks(long[] bookmarkIds)Deletes a set of bookmarksvoiddeleteFromTrash(Long[] ids)Deletes a selection of documents from trashvoiddeleteLinks(long[] ids)Deletes a selection of linksvoiddeleteNotes(long[] ids)Deletes a selection of document notesIntegerdeleteRating(long id)Deletes a votevoiddeleteTicket(long ticketId)GUIDocumentdeleteVersions(long[] ids)Deletes a selection of versionsvoiddisableTicket(long ticketId)voidemptyTrash()Clear the user's trashvoidenableTicket(long ticketId)voidenforceFilesIntoFolderStorage(long folderId)Enforces that all the files in the given tree are stored in the storage configured in the owning folder.GUIEmailextractEmail(long docId, String fileVersion)Extracts the email representation from a .eml or .msg fileGUIDocumentgetById(long docId)Retrieves a specific document by its IDStringgetContentAsString(long docId)Retrieves the document's content as a stringGUIDocumentNote[]getNotes(long docId, String fileVersion, Collection<String> types)Retrieves the notes of a documentGUIRatinggetRating(long docId)Retrieves the rating of the given documentGUIRatinggetUserRating(long docId)Retrieves the vote of the current user on the specified documentGUIVersion[]getVersionsById(long id1, long id2)Retrieves two specific versions by its IDvoidindexDocuments(Long[] docIds)Indexes the given set of documentsvoidlinkDocuments(long[] inDocIds, long[] outDocIds)Links a set of documentsvoidlock(long[] docIds, String comment)Locks a set of documentsvoidmakeImmutable(long[] docIds, String comment)Makes immutable a set of documentsvoidmarkHistoryAsRead(String event)Marks as read the histories related to the current user and the given event.voidmarkIndexable(long[] docIds, int policy)Marks a set of documents as indexablevoidmarkUnindexable(long[] docIds)Marks a set of documents as unindexableGUIDocumentmerge(long[] docIds, long targetFolderId, String fileName)Merges a set of documents into a single PDFGUIDocumentpromoteVersion(long docId, String version)If you promote a prior version, what it does is make it the default version again.GUIDocumentrename(long documentId, String name)Renames the given documentGUIDocumentreplaceAlias(long aliasId)Replaces an alias with a copy of the original filevoidreplaceFile(long docId, String fileVersion, String comment)Replaces the file associated to a given versionvoidrestore(Long[] docIds, long folderId)Restores a given documentGUIDocumentsave(GUIDocument document)Saves the document in the DBGUIDocumentsaveEmailAttachment(long docId, String fileVersion, String attachmentFileName)Extracts an email attachment and saves it in the same folder of the documentvoidsaveNotes(long docId, GUIDocumentNote[] notes, Collection<String> types)Saves a set of notesintsaveRating(GUIRating rating)Save a rating vote on a documentStringsendAsEmail(GUIEmail email, String locale)Sends a document as email(attachment or download ticket)voidsetPassword(long docId, String password)Puts a password protection to the documentvoidunarchiveDocuments(long[] docIds)Restores a given set of archived documentsvoidunlock(long[] docIds)Unlocks a set of documentsbooleanunprotect(long docId, String password)Checks if the document can be accessed with the given passwordvoidunsetPassword(long docId, String password)Removes the password protection from the documentvoidupdateBookmark(GUIBookmark bookmark)Updates a single bookmark's datavoidupdateLink(long id, String type)Updates the links typevoidupdateNote(long docId, long noteId, String note)Updates a document note on the given documentintupdatePages(long docId)Counts the pages of a document and updates the DB.voidvalidate(GUIDocument document)Validates the metadata
-
-
-
Method Detail
-
getById
GUIDocument getById(long docId) throws ServerException
Retrieves a specific document by its ID- Parameters:
docId- identifier of the document- Returns:
- the document retrieved by the server application
- Throws:
ServerException- an error happened in the server application
-
save
GUIDocument save(GUIDocument document) throws ServerException
Saves the document in the DB- Parameters:
document- The document to save- Returns:
- The saved document
- Throws:
ServerException- an error happened in the server application
-
validate
void validate(GUIDocument document) throws ServerException
Validates the metadata- Parameters:
document- The document to validate- Throws:
ServerException- in case of invalid instance, this exception contains the errors
-
rename
GUIDocument rename(long documentId, String name) throws ServerException
Renames the given document- Parameters:
documentId- identifier of the documentsname- the new document's filename- Returns:
- The updated document
- Throws:
ServerException- an error happened in the server application
-
getVersionsById
GUIVersion[] getVersionsById(long id1, long id2) throws ServerException
Retrieves two specific versions by its ID- Parameters:
id1- identifier of the first versionid2- identifier of the second version- Returns:
- the two versions
- Throws:
ServerException- an error happened in the server application
-
sendAsEmail
String sendAsEmail(GUIEmail email, String locale) throws ServerException
Sends a document as email(attachment or download ticket)- Parameters:
email- the email to sendlocale- the locale specification- Returns:
- "ok" otherwise an error code
- Throws:
ServerException- an error happened in the server application
-
extractEmail
GUIEmail extractEmail(long docId, String fileVersion) throws ServerException
Extracts the email representation from a .eml or .msg file- Parameters:
docId- the identifier of the mail documentfileVersion- the File Version- Returns:
- the email representation
- Throws:
ServerException- an error happened in the server application
-
saveEmailAttachment
GUIDocument saveEmailAttachment(long docId, String fileVersion, String attachmentFileName) throws ServerException
Extracts an email attachment and saves it in the same folder of the document- Parameters:
docId- the identifier of the mail documentfileVersion- the File VersionattachmentFileName- name of the attachment- Returns:
- the just created document
- Throws:
ServerException- an error happened in the server application
-
updateLink
void updateLink(long id, String type) throws ServerExceptionUpdates the links type- Parameters:
id- The link identifiertype- The new type to be set- Throws:
ServerException- an error happened in the server application
-
deleteLinks
void deleteLinks(long[] ids) throws ServerExceptionDeletes a selection of links- Parameters:
ids- identifiers of the links- Throws:
ServerException- an error happened in the server application
-
deleteVersions
GUIDocument deleteVersions(long[] ids) throws ServerException
Deletes a selection of versions- Parameters:
ids- identifiers of the versions- Returns:
- the document the deleted versions belongs to
- Throws:
ServerException- an error happened in the server application
-
linkDocuments
void linkDocuments(long[] inDocIds, long[] outDocIds) throws ServerExceptionLinks a set of documents- Parameters:
inDocIds- identifiers of the documents for the IN directionoutDocIds- identifiers of the documents for the OUT direction- Throws:
ServerException- an error happened in the server application
-
delete
void delete(long[] ids) throws ServerExceptionDeletes a selection of documents- Parameters:
ids- identifiers of the documents- Throws:
ServerException- an error happened in the server application
-
deleteFromTrash
void deleteFromTrash(Long[] ids) throws ServerException
Deletes a selection of documents from trash- Parameters:
ids- identifiers of documents- Throws:
ServerException- an error happened in the server application
-
emptyTrash
void emptyTrash() throws ServerExceptionClear the user's trash- Throws:
ServerException- an error happened in the server application
-
makeImmutable
void makeImmutable(long[] docIds, String comment) throws ServerExceptionMakes immutable a set of documents- Parameters:
docIds- identifiers of the documentscomment- the commit- Throws:
ServerException- an error happened in the server application
-
archiveDocuments
void archiveDocuments(long[] docIds, String comment) throws ServerExceptionArchives a set of documents- Parameters:
docIds- identifiers of the documentscomment- the commit- Throws:
ServerException- an error happened in the server application
-
archiveFolder
long archiveFolder(long folderId, String comment) throws ServerExceptionArchives the documents in a folder- Parameters:
folderId- identifier of the foldercomment- a comment for the action- Returns:
- number of records added to the archive
- Throws:
ServerException- an error happened in the server application
-
convert
GUIDocument convert(long docId, String fileVersion, String format) throws ServerException
Converts a document in a given format- Parameters:
docId- identifier of the document to convertfileVersion- version of the fileformat- the format to convert to (e.g.: pdf, txt, ...- Returns:
- the converted document
- Throws:
ServerException- an error happened in the server application
-
countDocuments
long countDocuments(long[] folderIds, int status) throws ServerExceptionCounts the documents in a given status contained the specified folder's trees- Parameters:
folderIds- identifiers of the foldersstatus- a filter on the document's status- Returns:
- the count
- Throws:
ServerException- an error happened in the server application
-
unlock
void unlock(long[] docIds) throws ServerExceptionUnlocks a set of documents- Parameters:
docIds- identifiers of the documents- Throws:
ServerException- an error happened in the server application
-
lock
void lock(long[] docIds, String comment) throws ServerExceptionLocks a set of documents- Parameters:
docIds- identifiers of the documentscomment- the comment to the lock- Throws:
ServerException- an error happened in the server application
-
checkout
void checkout(long[] docIds) throws ServerExceptionChecks out the document- Parameters:
docIds- identifiers of the documents- Throws:
ServerException- an error happened in the server application
-
addDocuments
GUIDocument[] addDocuments(String language, long folderId, boolean importZip, String charset, boolean immediateIndexing, Long templateId) throws ServerException
Adds new documents previously uploaded- Parameters:
language- The language applied to all documentsfolderId- The destination folder identifierimportZip- If .zip files have to be unpacked and the contained documents importedcharset- Charset to use to process the .zip filesimmediateIndexing- If the documents must be immediately indexedtemplateId- The documents template- Returns:
- The list of created documents
- Throws:
ServerException- an error happened in the server application
-
addDocuments
GUIDocument[] addDocuments(boolean importZip, String charset, boolean immediateIndexing, GUIDocument metadata) throws ServerException
- Throws:
ServerException
-
createDownloadTicket
String[] createDownloadTicket(long docId, String suffix, Integer expireHours, Date expireDate, Integer maxDownloads) throws ServerException
Creates a download ticket- Parameters:
docId- identifier of the documentsuffix- the suffix(null or 'pdf')expireHours- how many validity hoursexpireDate- the exact expiration datemaxDownloads- maximum number of allowed downloads- Returns:
- the generated ticket ID, a sample URL using the browser's URL, a sample URL using the server.url setting
- Throws:
ServerException- an error happened in the server application
-
deleteTicket
void deleteTicket(long ticketId) throws ServerException- Throws:
ServerException
-
enableTicket
void enableTicket(long ticketId) throws ServerException- Throws:
ServerException
-
disableTicket
void disableTicket(long ticketId) throws ServerException- Throws:
ServerException
-
indexDocuments
void indexDocuments(Long[] docIds) throws ServerException
Indexes the given set of documents- Parameters:
docIds- The set of documents to index- Throws:
ServerException- an error happened in the server application
-
checkin
GUIDocument checkin(GUIDocument document, boolean major) throws ServerException
Checks-in a new document version- Parameters:
document- The document to updatemajor- True if this is a major version- Returns:
- The updated document
- Throws:
ServerException- an error happened in the server application
-
checkinContent
GUIDocument checkinContent(long docId, String content) throws ServerException
Checks-in a new document's text content- Parameters:
docId- identifier of the documentcontent- content of the file- Returns:
- the document
- Throws:
ServerException- an error happened in the server application
-
replaceFile
void replaceFile(long docId, String fileVersion, String comment) throws ServerExceptionReplaces the file associated to a given version- Parameters:
docId- the identifier of the documentfileVersion- the file versioncomment- the comment- Throws:
ServerException- an error happened in the server application
-
promoteVersion
GUIDocument promoteVersion(long docId, String version) throws ServerException
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 identifier of the documentversion- version specification- Returns:
- the document
- Throws:
ServerException- an error happened in the server application
-
createDocument
GUIDocument createDocument(GUIDocument document, String content) throws ServerException
Creates a new document with the given text content- Parameters:
document- the document to createcontent- the contents- Returns:
- the created document
- Throws:
ServerException- an error happened in the server application
-
getContentAsString
String getContentAsString(long docId) throws ServerException
Retrieves the document's content as a string- Parameters:
docId- identifier of the document- Returns:
- the document's extracted content
- Throws:
ServerException- an error happened in the server application
-
restore
void restore(Long[] docIds, long folderId) throws ServerException
Restores a given document- Parameters:
docIds- identifiers of the documentsfolderId- identifier of the folder in which to restore the documents- Throws:
ServerException- an error happened in the server application
-
unarchiveDocuments
void unarchiveDocuments(long[] docIds) throws ServerExceptionRestores a given set of archived documents- Parameters:
docIds- identifiers of the documents- Throws:
ServerException- an error happened in the server application
-
addBookmarks
void addBookmarks(long[] targetIds, int type) throws ServerExceptionAdds new bookmarks- Parameters:
targetIds- identfiers of the documents or folders to bookmarktype- the type of bookmark (0 = document, 1 = folder)- Throws:
ServerException- an error happened in the server application
-
deleteBookmarks
void deleteBookmarks(long[] bookmarkIds) throws ServerExceptionDeletes a set of bookmarks- Parameters:
bookmarkIds- identifiers of the bookmarks to delete- Throws:
ServerException- an error happened in the server application
-
updateBookmark
void updateBookmark(GUIBookmark bookmark) throws ServerException
Updates a single bookmark's data- Parameters:
bookmark- the bookmark to update- Throws:
ServerException- an error happened in the server application
-
markHistoryAsRead
void markHistoryAsRead(String event) throws ServerException
Marks as read the histories related to the current user and the given event.- Parameters:
event- The history event to mark as read- Throws:
ServerException- an error happened in the server application
-
markUnindexable
void markUnindexable(long[] docIds) throws ServerExceptionMarks a set of documents as unindexable- Parameters:
docIds- identifiers of the documents- Throws:
ServerException- an error happened in the server application
-
markIndexable
void markIndexable(long[] docIds, int policy) throws ServerExceptionMarks a set of documents as indexable- Parameters:
docIds- identifiers of the documentspolicy- indexing policy:Constants.INDEX_TO_INDEXorConstants.INDEX_TO_INDEX_METADATA- Throws:
ServerException- an error happened in the server application
-
cleanUploadedFileFolder
void cleanUploadedFileFolder() throws ServerExceptionCleans the uploaded files folder- Throws:
ServerException- an error happened in the server application
-
getRating
GUIRating getRating(long docId) throws ServerException
Retrieves the rating of the given document- Parameters:
docId- identifier of the document- Returns:
- the rating retrieved by the server application
- Throws:
ServerException- an error happened in the server application
-
saveRating
int saveRating(GUIRating rating) throws ServerException
Save a rating vote on a document- Parameters:
rating- the document's rating- Returns:
- the new document rating value
- Throws:
ServerException- an error happened in the server application
-
addNote
long addNote(long docId, String note) throws ServerExceptionAdds a new document note on the given document- Parameters:
docId- identifier of the documentnote- the note's text- Returns:
- identifier of the created note
- Throws:
ServerException- an error happened in the server application
-
updateNote
void updateNote(long docId, long noteId, String note) throws ServerExceptionUpdates a document note on the given document- Parameters:
docId- identifier of the documentnoteId- identifier of the notenote- text of the note- Throws:
ServerException- an error happened in the server application
-
getNotes
GUIDocumentNote[] getNotes(long docId, String fileVersion, Collection<String> types) throws ServerException
Retrieves the notes of a document- Parameters:
docId- identifier of the documentfileVersion- file version specificationtypes- optional filter for the note type- Returns:
- the notes on the given version
- Throws:
ServerException- an error happened in the server application
-
saveNotes
void saveNotes(long docId, GUIDocumentNote[] notes, Collection<String> types) throws ServerExceptionSaves a set of notes- Parameters:
docId- identifier of the documentnotes- the notes to savetypes- optional filter for the note type- Throws:
ServerException- an error happened in the server application
-
deleteNotes
void deleteNotes(long[] ids) throws ServerExceptionDeletes a selection of document notes- Parameters:
ids- identifiers of the notes- Throws:
ServerException- an error happened in the server application
-
bulkUpdate
GUIDocument[] bulkUpdate(long[] ids, GUIDocument vo, boolean ignoreEmptyFields) throws ServerException
Applies to a selection of documents all the given data- Parameters:
ids- identifiers of the documents to updatevo- the value object to use as templateignoreEmptyFields- flag to skip fields empty in thevo- Returns:
- the updated documents
- Throws:
ServerException- an error happened in the server application
-
createWithContent
GUIDocument createWithContent(GUIDocument vo, String content, boolean checkout) throws ServerException
Creates a new empty document- Parameters:
vo- the value object to use as templatecontent- the text body of the new documentcheckout- if the new document must be checked out- Returns:
- the created document
- Throws:
ServerException- an error happened in the server application
-
setPassword
void setPassword(long docId, String password) throws ServerExceptionPuts a password protection to the document- Parameters:
docId- the identifier of the document to protectpassword- the password to assign- Throws:
ServerException- an error happened in the server application
-
unsetPassword
void unsetPassword(long docId, String password) throws ServerExceptionRemoves the password protection from the document- Parameters:
docId- the identifier of the document to unprotectpassword- the password to clear- Throws:
ServerException- an error happened in the server application
-
unprotect
boolean unprotect(long docId, String password) throws ServerExceptionChecks if the document can be accessed with the given password- Parameters:
docId- the identifier of the document to unprotectpassword- the password to clear- Returns:
- is the password is correct
- Throws:
ServerException- an error happened in the server application
-
getUserRating
GUIRating getUserRating(long docId) throws ServerException
Retrieves the vote of the current user on the specified document- Parameters:
docId- the identifier of the document- Returns:
- the rating
- Throws:
ServerException- an error happened in the server application
-
deleteRating
Integer deleteRating(long id) throws ServerException
Deletes a vote- Parameters:
id- identifier of the rating to delete- Returns:
- the result
- Throws:
ServerException- an error happened in the server application
-
replaceAlias
GUIDocument replaceAlias(long aliasId) throws ServerException
Replaces an alias with a copy of the original file- Parameters:
aliasId- ID of the alias to replace- Returns:
- the just created document
- Throws:
ServerException- an error happened in the server application
-
deDuplicate
void deDuplicate(Long folderId, boolean retainNewest) throws ServerException
Convert duplicates with aliases, just one of the documents is maintained- Parameters:
folderId- optional ID of the folder to processretainNewest- true if the newest has to be retained, otherwise it will be the oldest.- Throws:
ServerException- an error happened in the server application
-
enforceFilesIntoFolderStorage
void enforceFilesIntoFolderStorage(long folderId) throws ServerExceptionEnforces that all the files in the given tree are stored in the storage configured in the owning folder. The process is asynchronous, at the end an internal message to the user will be sent to alert him about its end.- Parameters:
folderId- identifier of the tree root- Throws:
ServerException- an error happened in the server application
-
merge
GUIDocument merge(long[] docIds, long targetFolderId, String fileName) throws ServerException
Merges a set of documents into a single PDF- Parameters:
docIds- identifiers of the documents to mergetargetFolderId- identifier of the folder that will receive the merged PDFfileName- file name of the merged file- Returns:
- the newly created merged document
- Throws:
ServerException- an error happened in the server application
-
updatePages
int updatePages(long docId) throws ServerExceptionCounts the pages of a document and updates the DB.- Parameters:
docId- identifier of the document- Returns:
- number of pages
- Throws:
ServerException- an error happened in the server application
-
-