Class RestDocumentService

    • Constructor Detail

      • RestDocumentService

        public RestDocumentService()
    • Method Detail

      • create

        @POST
        @Path("/create")
        @Consumes("multipart/form-data")
        public javax.ws.rs.core.Response create​(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> atts)
                                         throws Exception
        Specified by:
        create in interface DocumentService
        Throws:
        Exception
      • checkout

        @POST
        @Path("/checkout")
        @Consumes("application/x-www-form-urlencoded")
        public void checkout​(@FormParam("docId")
                             long docId)
                      throws Exception
        Specified by:
        checkout in interface DocumentService
        Throws:
        Exception
      • checkin

        @POST
        @Path("/checkin")
        @Consumes("multipart/form-data")
        @Produces({"text/plain","application/json","application/xml"})
        public javax.ws.rs.core.Response checkin​(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)
                                          throws Exception
        Specified by:
        checkin in interface DocumentService
        Throws:
        Exception
      • upload

        @POST
        @Path("/upload")
        @Consumes("multipart/form-data")
        @Produces({"text/plain","application/json","application/xml"})
        public javax.ws.rs.core.Response upload​(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)
                                         throws Exception
        Specified by:
        upload in interface DocumentService
        Throws:
        Exception
      • replaceFile

        @POST
        @Path("/replaceFile")
        @Consumes("multipart/form-data")
        @Produces({"text/plain","application/json","application/xml"})
        public javax.ws.rs.core.Response replaceFile​(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)
                                              throws Exception
        Specified by:
        replaceFile in interface DocumentService
        Throws:
        Exception
      • getContent

        @GET
        @Path("/getContent")
        @Produces("application/octet-stream")
        public javax.activation.DataHandler getContent​(@QueryParam("docId")
                                                       long docId)
                                                throws Exception
        Specified by:
        getContent in interface DocumentService
        Throws:
        Exception
      • getVersionContent

        @GET
        @Path("/getVersionContent")
        @Produces("application/octet-stream")
        public javax.activation.DataHandler getVersionContent​(@QueryParam("docId")
                                                              long docId,
                                                              @QueryParam("version")
                                                              String version)
                                                       throws Exception
        Specified by:
        getVersionContent in interface DocumentService
        Throws:
        Exception
      • deleteVersion

        @DELETE
        @Path("/deleteVersion")
        public String deleteVersion​(@QueryParam("docId")
                                    long docId,
                                    @QueryParam("version")
                                    String version)
                             throws Exception
        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 interface DocumentService
        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
      • update

        @PUT
        @Path("/update")
        public void update​(WSDocument document)
                    throws Exception
        Description copied from interface: DocumentService
        Updates an existing document with the value object containing the document's metadata.
        Specified by:
        update in interface DocumentService
        Parameters:
        document - the document to update
        Throws:
        Exception - error in the server application
      • addNote

        @POST
        @Path("/addNote")
        @Consumes("application/x-www-form-urlencoded")
        public WSNote addNote​(@FormParam("docId")
                              long docId,
                              @FormParam("note")
                              String note)
                       throws Exception
        Description copied from interface: DocumentService
        Adds a new note for the given document
        Specified by:
        addNote in interface DocumentService
        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")
        public void deleteNote​(@QueryParam("noteId")
                               long noteId)
                        throws Exception
        Adds a new note for the given document
        Specified by:
        deleteNote in interface DocumentService
        Parameters:
        noteId - identifier of the note
        Throws:
        Exception - error in the server application
      • getNotes

        @GET
        @Path("/getNotes")
        public WSNote[] getNotes​(@QueryParam("docId")
                                 long docId)
                          throws Exception
        Gets the notes for the given document
        Specified by:
        getNotes in interface DocumentService
        Parameters:
        docId - identifier of the document
        Returns:
        array of notes
        Throws:
        Exception - error in the server application
      • rateDocument

        @PUT
        @Path("/rateDocument")
        public WSRating rateDocument​(@QueryParam("docId")
                                     long docId,
                                     @QueryParam("vote")
                                     int vote)
                              throws Exception
        Puts a new rating on the given document
        Specified by:
        rateDocument in interface DocumentService
        Parameters:
        docId - identifier of the document
        vote - the vote
        Returns:
        the rating
        Throws:
        Exception - error in the server application
      • getRatings

        @GET
        @Path("/getRatings")
        public WSRating[] getRatings​(@QueryParam("docId")
                                     long docId)
                              throws Exception
        Gets all the ratings of the given document
        Specified by:
        getRatings in interface DocumentService
        Parameters:
        docId - identifier of the document
        Returns:
        the ratings
        Throws:
        Exception - error in the server application
      • move

        @PUT
        @Path("/move")
        public void move​(@QueryParam("docId")
                         long docId,
                         @QueryParam("folderId")
                         long folderId)
                  throws Exception
        Description copied from interface: DocumentService
        Moves an existing document with the given identifier
        Specified by:
        move in interface DocumentService
        Parameters:
        docId - The document id
        folderId - Identifier of the new document's folder
        Throws:
        Exception - error in the server application
      • createThumbnail

        @PUT
        @Path("/createThumbnail")
        public void createThumbnail​(@QueryParam("docId")
                                    long docId,
                                    @QueryParam("fileVersion")
                                    String fileVersion,
                                    @QueryParam("type")
                                    String type)
                             throws Exception
        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 interface DocumentService
        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
      • createPdf

        @PUT
        @Path("/createPdf")
        public void createPdf​(@QueryParam("docId")
                              long docId,
                              @QueryParam("fileVersion")
                              String fileVersion)
                       throws Exception
        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 interface DocumentService
        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")
        public void promoteVersion​(@QueryParam("docId")
                                   long docId,
                                   @QueryParam("version")
                                   String version)
                            throws Exception
        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 interface DocumentService
        Parameters:
        docId - the document to be updated
        version - the version
        Throws:
        Exception - if an error occurs, this exception is thrown
      • rename

        @PUT
        @Path("/rename")
        public void rename​(@QueryParam("docId")
                           long docId,
                           @QueryParam("name")
                           String name)
                    throws Exception
        Description copied from interface: DocumentService
        Renames the title of an existing document with the given identifier.
        Specified by:
        rename in interface DocumentService
        Parameters:
        docId - The document id
        name - The new document filename
        Throws:
        Exception - error in the server application
      • getVersions

        @GET
        @Path("/getVersions")
        public WSDocument[] getVersions​(@QueryParam("docId")
                                        long docId)
                                 throws Exception
        Description copied from interface: DocumentService
        Gets the version history of an existing document with the given identifier
        Specified by:
        getVersions in interface DocumentService
        Parameters:
        docId - The document id
        Returns:
        Array of versions
        Throws:
        Exception - error in the server application
      • 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 Exception
        Description copied from interface: DocumentService
        Creates a new document alias for the given document inside a specified folder
        Specified by:
        createAlias in interface DocumentService
        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")
        public String createDownloadTicket​(@FormParam("docId")
                                           long docId,
                                           @FormParam("suffix")
                                           String suffix,
                                           @FormParam("expireHours")
                                           Integer expireHours,
                                           @FormParam("expireDate")
                                           String expireDate,
                                           @FormParam("maxDownloads")
                                           Integer maxDownloads)
                                    throws Exception
        Description copied from interface: DocumentService
        Creates a new download ticket
        Specified by:
        createDownloadTicket in interface DocumentService
        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")
        public void deleteLink​(@QueryParam("id")
                               long id)
                        throws Exception
        Description copied from interface: DocumentService
        Removes an existing link
        Specified by:
        deleteLink in interface DocumentService
        Parameters:
        id - ID of the link
        Throws:
        Exception - error in the server application
      • getAliases

        @GET
        @Path("/getAliases")
        public WSDocument[] getAliases​(@QueryParam("docId")
                                       long docId)
                                throws Exception
        Description copied from interface: DocumentService
        Gets the aliases of the given document
        Specified by:
        getAliases in interface DocumentService
        Parameters:
        docId - The master document ID
        Returns:
        Arrays of aliases
        Throws:
        Exception - error in the server application
      • getDocumentByCustomId

        @GET
        @Path("/getDocumentByCustomId")
        public WSDocument getDocumentByCustomId​(@QueryParam("customId")
                                                String customId)
                                         throws Exception
        Description copied from interface: DocumentService
        Gets document metadata of an existing document with the given custom identifier
        Specified by:
        getDocumentByCustomId in interface DocumentService
        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")
        public WSDocument[] getDocuments​(@QueryParam("docIds")
                                         Long[] docIds)
                                  throws Exception
        Description copied from interface: DocumentService
        Gets document metadata of a collection of existing documents with the given identifiers
        Specified by:
        getDocuments in interface DocumentService
        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")
        public String getExtractedText​(@QueryParam("docId")
                                       long docId)
                                throws Exception
        Description copied from interface: DocumentService
        Gets the document's text stored in the full-text index
        Specified by:
        getExtractedText in interface DocumentService
        Parameters:
        docId - The document id
        Returns:
        The requested document's text
        Throws:
        Exception - error in the server application
      • getRecentDocuments

        @GET
        @Path("/getRecentDocuments")
        public WSDocument[] getRecentDocuments​(@QueryParam("maxHits")
                                               Integer maxHits)
                                        throws Exception
        Description copied from interface: DocumentService
        Lists of last modified documents of the current session
        Specified by:
        getRecentDocuments in interface DocumentService
        Parameters:
        maxHits - Maximum number of returned records
        Returns:
        Array of documents
        Throws:
        Exception - error in the server application
      • getLinks

        @GET
        @Path("/getLinks")
        public WSLink[] getLinks​(@QueryParam("docId")
                                 long docId)
                          throws Exception
        Description copied from interface: DocumentService
        Gets all the links of a specific document
        Specified by:
        getLinks in interface DocumentService
        Parameters:
        docId - ID of the document
        Returns:
        The new links of the document
        Throws:
        Exception - error in the server application
      • getResource

        @GET
        @Path("/getResource")
        public javax.activation.DataHandler getResource​(@QueryParam("docId")
                                                        long docId,
                                                        @QueryParam("fileVersion")
                                                        String fileVersion,
                                                        @QueryParam("suffix")
                                                        String suffix)
                                                 throws Exception
        Description copied from interface: DocumentService
        Gets the content of a resource associated to the given document.
        Specified by:
        getResource in interface DocumentService
        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

        @GET
        @Path("/isReadable")
        public boolean isReadable​(@QueryParam("docId")
                                  long docId)
                           throws Exception
        Description copied from interface: DocumentService
        Tests if a document is readable
        Specified by:
        isReadable in interface DocumentService
        Parameters:
        docId - The document id
        Returns:
        True if the identifier denotes a document, otherwise false
        Throws:
        Exception - error in the server application
      • 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 Exception
        Description copied from interface: DocumentService
        Creates a new link between two documents.
        Specified by:
        link in interface DocumentService
        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

        @PUT
        @Path("/lock")
        public void lock​(@QueryParam("docId")
                         long docId)
                  throws Exception
        Description copied from interface: DocumentService
        Locks an existing document with the given identifier.
        Specified by:
        lock in interface DocumentService
        Parameters:
        docId - The document id
        Throws:
        Exception - error in the server application
      • reindex

        @POST
        @Path("/reindex")
        @Consumes("application/x-www-form-urlencoded")
        public void reindex​(@FormParam("doc1")
                            long docId,
                            @FormParam("content")
                            String content)
                     throws Exception
        Description copied from interface: DocumentService
        Re-indexes(or indexes from scratch) a document
        Specified by:
        reindex in interface DocumentService
        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")
        public void uploadResource​(List<org.apache.cxf.jaxrs.ext.multipart.Attachment> attachments)
                            throws Exception
        Description copied from interface: DocumentService
        Uploads a new resource attached to the given document. If the resource already exists it is overwritten.
        Specified by:
        uploadResource in interface DocumentService
        Parameters:
        attachments - the attachments to upload
        Throws:
        Exception - error in the server application
      • restore

        @PUT
        @Path("/restore")
        public void restore​(@QueryParam("docId")
                            long docId,
                            @QueryParam("folderId")
                            long folderId)
                     throws Exception
        Description copied from interface: DocumentService
        Restores a deleted document
        Specified by:
        restore in interface DocumentService
        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

        @POST
        @Path("/saveNote")
        @Consumes("application/x-www-form-urlencoded")
        public WSNote saveNote​(@FormParam("docId")
                               long docId,
                               @FormParam("note")
                               WSNote note)
                        throws Exception
        Description copied from interface: DocumentService
        Adds a new note for the given document
        Specified by:
        saveNote in interface DocumentService
        Parameters:
        docId - identifier of the document
        note - the note to add
        Returns:
        the added note
        Throws:
        Exception - error in the server application
      • 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 Exception
        Description copied from interface: DocumentService
        Sends a set of documents as mail attachments
        Specified by:
        sendEmail in interface DocumentService
        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

        @POST
        @Path("/setPassword")
        @Consumes("application/x-www-form-urlencoded")
        public void setPassword​(@FormParam("docId")
                                long docId,
                                @FormParam("password")
                                String password)
                         throws Exception
        Description copied from interface: DocumentService
        Puts a password protection to the document
        Specified by:
        setPassword in interface DocumentService
        Parameters:
        docId - identifier of the document
        password - the new password
        Throws:
        Exception - error in the server application
      • unlock

        @PUT
        @Path("/unlock")
        public void unlock​(@QueryParam("docId")
                           long docId)
                    throws Exception
        Description copied from interface: DocumentService
        Unlocks an existing document with the given identifier.
        Specified by:
        unlock in interface DocumentService
        Parameters:
        docId - identifier of the document
        Throws:
        Exception - error in the server application
      • unsetPassword

        @POST
        @Path("/unsetPassword")
        @Consumes("application/x-www-form-urlencoded")
        public void unsetPassword​(@FormParam("docId")
                                  long docId,
                                  @FormParam("currentPassword")
                                  String currentPassword)
                           throws Exception
        Description copied from interface: DocumentService
        Removes the password protection from the document
        Specified by:
        unsetPassword in interface DocumentService
        Parameters:
        docId - identifier of the document
        currentPassword - the password
        Throws:
        Exception - error in the server application
      • unprotect

        @POST
        @Path("/unprotect")
        @Consumes("application/x-www-form-urlencoded")
        public boolean unprotect​(@FormParam("docId")
                                 long docId,
                                 @FormParam("password")
                                 String password)
                          throws Exception
        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 interface DocumentService
        Parameters:
        docId - identifier of the document
        password - the password
        Returns:
        was it uprotected?
        Throws:
        Exception - error in the server application
      • 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 Exception
        Specified by:
        getThumbnail in interface DocumentService
        Throws:
        Exception