Interface DocumentService

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      WSNote addNote​(long docId, String note)
      Adds a new note for the given document
      void checkin​(Integer docId, String comment, String release, 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 checkout
      WSDocument copy​(long docId, long folderId)
      Copies a document into another folder
      WSDocument create​(WSDocument document, org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail)
      Creates a new document
      WSDocument createAlias​(long docId, long folderId, String type)
      Creates a new document alias for the given document inside a specified folder
      String createDownloadTicket​(long docId, String suffix, Integer expireHours, String expireDate, Integer maxDownloads)
      Creates a new download ticket
      void createPdf​(long docId, String fileVersion)
      Creates the PDF conversion of the given document; if the PDF conversion was already created, nothing will happen
      void createThumbnail​(long docId, String fileVersion, String type)
      Creates the thumbail of the given document; if the thumbnail was already created, nothing will happen
      void delete​(long docId)
      Deletes a document
      void deleteLink​(long id)
      Removes an existing link
      void deleteNote​(long noteId)
      Deletes a new note by note identifier
      String deleteVersion​(long docId, String version)
      Deletes a version by document identifier and version ID.
      WSDocument[] getAliases​(long docId)
      Gets the aliases of the given document
      javax.activation.DataHandler getContent​(long docId)
      Retrieves the file content of a document.
      WSDocument getDocument​(long docId)
      Retrieves a document from the database
      WSDocument getDocumentByCustomId​(String customId)
      Gets document metadata of an existing document with the given custom identifier
      WSDocument[] getDocuments​(Long[] docIds)
      Gets document metadata of a collection of existing documents with the given identifiers
      String getExtractedText​(long docId)
      Gets the document's text stored in the full-text index
      WSLink[] getLinks​(long docId)
      Gets all the links of a specific document
      WSNote[] getNotes​(long docId)
      Gets the notes for the given document
      WSRating[] getRatings​(long docId)
      Gets all the ratings of the given document
      WSDocument[] getRecentDocuments​(Integer maxHits)
      Lists of last modified documents of the current session
      javax.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 image
      javax.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 identifier
      boolean isReadable​(long docId)
      Tests if a document is readable
      WSLink link​(long doc1, long doc2, String type)
      Creates a new link between two documents.
      WSDocument[] list​(long folderId)
      Lists the documents in a folder
      WSDocument[] listDocuments​(long folderId, String fileName)
      Lists the documents in a folder
      void lock​(long docId)
      Locks an existing document with the given identifier.
      void move​(long docId, long folderId)
      Moves an existing document with the given identifier
      void 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 document
      void reindex​(long docId, String content)
      Re-indexes(or indexes from scratch) a document
      void 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.
      void restore​(long docId, long folderId)
      Restores a deleted document
      WSNote saveNote​(long docId, WSNote note)
      Adds a new note for the given document
      void sendEmail​(Long[] docIds, String recipients, String subject, String message)
      Sends a set of documents as mail attachments
      void setPassword​(long docId, String password)
      Puts a password protection to the document
      void 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 document
      void update​(WSDocument document)
      Updates an existing document with the value object containing the document's metadata.
      Long upload​(Integer 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.
    • Method Detail

      • create

        @POST
        @Path("/create")
        @Consumes("multipart/form-data")
        @Produces("application/json")
        WSDocument create​(WSDocument document,
                          org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail)
                   throws Exception
        Creates a new document
        Parameters:
        document - the document's metadata
        contentDetail - the file binaries
        Returns:
        data structure representing the created document
        Throws:
        Exception - a generic error
      • getDocument

        @GET
        @Path("/getDocument")
        @Produces({"application/json","application/xml"})
        WSDocument getDocument​(@QueryParam("docId")
                               long docId)
                        throws Exception
        Retrieves a document from the database
        Parameters:
        docId - identifier of the document
        Returns:
        the document object representation
        Throws:
        Exception - a generic error
      • checkout

        @POST
        @Path("/checkout")
        @Consumes("application/x-www-form-urlencoded")
        void checkout​(@FormParam("docId")
                      long docId)
               throws Exception
        Executed the checkout
        Parameters:
        docId - identifier of the document
        Throws:
        Exception - a generic error
      • checkin

        @POST
        @Path("/checkin")
        @Consumes("multipart/form-data")
        void checkin​(Integer docId,
                     String comment,
                     String release,
                     String filename,
                     org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
              throws Exception
        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
        Parameters:
        docId - identifier of the document
        comment - version comment
        release - it this is a major version or not
        filename - filename of the document
        filedataDetail - binary content of the file
        Throws:
        Exception - a generic error
      • replaceFile

        @POST
        @Path("/replaceFile")
        @Consumes("multipart/form-data")
        void replaceFile​(Integer docId,
                         String fileVersion,
                         String comment,
                         org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
                  throws Exception
        Replace the file of a version. Replaces the file associated to a given version.
        Parameters:
        docId - identifier of the document
        comment - version comment
        fileVersion - the file version
        filedataDetail - binary content of the file
        Throws:
        Exception - a generic error
      • upload

        @POST
        @Path("/upload")
        @Consumes("multipart/form-data")
        Long upload​(Integer docId,
                    String folderId,
                    String release,
                    String filename,
                    String language,
                    org.apache.cxf.jaxrs.ext.multipart.Attachment filedataDetail)
             throws Exception
        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
        Parameters:
        docId - identifier of the document
        folderId - identifier of the folder
        release - if the upload must produce a major release or now
        filename - name of the file
        language - the document's language
        filedataDetail - the binary content
        Returns:
        identifier of the updated document
        Throws:
        Exception - a generic error
      • delete

        @DELETE
        @Path("/delete")
        void delete​(@QueryParam("docId")
                    long docId)
             throws Exception
        Deletes a document
        Parameters:
        docId - identifier of the document to delete
        Throws:
        Exception - a generic error
      • list

        @GET
        @Path("/list")
        @Produces("application/json")
        WSDocument[] list​(@QueryParam("folderId")
                          long folderId)
                   throws Exception
        Lists the documents in a folder
        Parameters:
        folderId - identifier of the folder
        Returns:
        array of documents contained in the folder
        Throws:
        Exception - a generic error
      • listDocuments

        @GET
        @Path("/listDocuments")
        WSDocument[] listDocuments​(@QueryParam("folderId")
                                   long folderId,
                                   @QueryParam("fileName")
                                   String fileName)
                            throws Exception
        Lists the documents in a folder
        Parameters:
        folderId - identifier of the folder
        fileName - a file name to use as filter
        Returns:
        array of documents contained in the folder
        Throws:
        Exception - a generic error
      • update

        @PUT
        @Path("/update")
        void update​(WSDocument document)
             throws Exception
        Updates 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
        Retrieves the file content of a document.
        Parameters:
        docId - identifier of the document
        Returns:
        the contents
        Throws:
        Exception - error in the server application
      • getVersionContent

        @GET
        @Path("/getVersionContent")
        @Produces("application/octet-stream")
        javax.activation.DataHandler getVersionContent​(@QueryParam("docId")
                                                       long docId,
                                                       @QueryParam("version")
                                                       String version)
                                                throws Exception
        Retrieves the file content of a version.
        Parameters:
        docId - identifier of the document
        version - version specification
        Returns:
        the contents
        Throws:
        Exception - error in the server application
      • addNote

        @POST
        @Path("/addNote")
        @Consumes("application/x-www-form-urlencoded")
        WSNote addNote​(@FormParam("docId")
                       long docId,
                       @FormParam("note")
                       String note)
                throws Exception
        Adds a new note for the given document
        Parameters:
        docId - identifier of the document
        note - 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 Exception
        Deletes 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 Exception
        Gets 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 Exception
        Puts a new rating on the given document
        Parameters:
        docId - identifier of the document
        vote - the vote
        Returns:
        the rating
        Throws:
        Exception - error in the server application
      • getRatings

        @GET
        @Path("/getRatings")
        WSRating[] getRatings​(@QueryParam("docId")
                              long docId)
                       throws Exception
        Gets 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 Exception
        Deletes a version by document identifier and version ID. You can not delete the latest version of a document
        Parameters:
        docId - identifier of the document
        version - 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 Exception
        Moves an existing document with the given identifier
        Parameters:
        docId - The document id
        folderId - Identifier of the new document's folder
        Throws:
        Exception - error in the server application
      • copy

        @PUT
        @Path("/copy")
        @Produces("application/json")
        WSDocument copy​(@QueryParam("docId")
                        long docId,
                        @QueryParam("folderId")
                        long folderId)
                 throws Exception
        Copies a document into another folder
        Parameters:
        docId - The document id
        folderId - Identifier of the new document's folder
        Returns:
        The new copy
        Throws:
        Exception - error in the server application
      • createThumbnail

        @PUT
        @Path("/createThumbnail")
        void createThumbnail​(@QueryParam("docId")
                             long docId,
                             @QueryParam("fileVersion")
                             String fileVersion,
                             @QueryParam("type")
                             String type)
                      throws Exception
        Creates the thumbail of the given document; if the thumbnail was already created, nothing will happen
        Parameters:
        docId - The document id
        fileVersion - The specific file version(it can be empty)
        type - The thumbnail type(eg: thumbnail, tile, mobile)
        Throws:
        Exception - error in the server application
      • getThumbnail

        @GET
        @Path("/thumbnail/{type}/{docpath:.*}")
        @Produces("image/jpeg")
        javax.activation.DataHandler getThumbnail​(@PathParam("type")
                                                  String type,
                                                  @PathParam("docpath")
                                                  String docPath,
                                                  @PathParam("docpath")
                                                  List<javax.ws.rs.core.PathSegment> docPathList)
                                           throws Exception
        Retrieves the thumbnail image
        Parameters:
        type - type of the thumbnail
        docPath - path of the document
        docPathList - path of the document
        Returns:
        image content
        Throws:
        Exception - a generic error
      • createPdf

        @PUT
        @Path("/createPdf")
        void createPdf​(@QueryParam("docId")
                       long docId,
                       @QueryParam("fileVersion")
                       String fileVersion)
                throws Exception
        Creates the PDF conversion of the given document; if the PDF conversion was already created, nothing will happen
        Parameters:
        docId - The document id
        fileVersion - 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 Exception
        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).
        Parameters:
        docId - the document to be updated
        version - 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 Exception
        Renames the title of an existing document with the given identifier.
        Parameters:
        docId - The document id
        name - The new document filename
        Throws:
        Exception - error in the server application
      • getVersions

        @GET
        @Path("/getVersions")
        WSDocument[] getVersions​(@QueryParam("docId")
                                 long docId)
                          throws Exception
        Gets 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 Exception
        Creates a new document alias for the given document inside a specified folder
        Parameters:
        docId - The original document id
        folderId - 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 Exception
        Creates a new download ticket
        Parameters:
        docId - identifier of the document
        suffix - can be null or 'conversion.pdf'
        expireHours - expiration time expressed in hours
        expireDate - exact expiration date expressed in the format yyyy-MM-dd
        maxDownloads - 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 Exception
        Removes 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 Exception
        Gets 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 Exception
        Gets 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 Exception
        Gets 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")
        @Produces("text/plain")
        String getExtractedText​(long docId)
                         throws Exception
        Gets 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 Exception
        Lists 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 Exception
        Gets 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 Exception
        Gets the content of a resource associated to the given document.
        Parameters:
        docId - The document id
        fileVersion - 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 Exception
        Tests 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 1
        doc2 - ID of document 2
        type - 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 Exception
        Re-indexes(or indexes from scratch) a document
        Parameters:
        docId - The document id
        content - The content to be used (if null the file is parsed)
        Throws:
        Exception - error in the server application
      • uploadResource

        @POST
        @Path("/uploadResource")
        @Consumes("multipart/form-data")
        void uploadResource​(Integer docId,
                            String fileVersion,
                            String suffix,
                            org.apache.cxf.jaxrs.ext.multipart.Attachment contentDetail)
                     throws Exception
        Uploads a new resource of the document Uploads a new resource attached to the given document. If the resource already exists it is overwritten
        Parameters:
        docId - identifier of the document
        fileVersion - version of the file
        suffix - suffix specification
        contentDetail - file content
        Throws:
        Exception - a generic error
      • restore

        void restore​(long docId,
                     long folderId)
              throws Exception
        Restores a deleted document
        Parameters:
        docId - The document id
        folderId - 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 document
        note - 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 identifiers
        recipients - Set of recipients(comma separated)
        subject - The email subject
        message - The email message body
        Throws:
        Exception - error in the server application
      • setPassword

        void setPassword​(long docId,
                         String password)
                  throws Exception
        Puts a password protection to the document
        Parameters:
        docId - identifier of the document
        password - the new password
        Throws:
        Exception - error in the server application
      • unlock

        void unlock​(long docId)
             throws Exception
        Unlocks 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 Exception
        Unprotects 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 document
        password - the password
        Returns:
        was it uprotected?
        Throws:
        Exception - error in the server application
      • unsetPassword

        void unsetPassword​(long docId,
                           String currentPassword)
                    throws Exception
        Removes the password protection from the document
        Parameters:
        docId - identifier of the document
        currentPassword - the password
        Throws:
        Exception - error in the server application