Class SimpleDocumentResource

    • Constructor Detail

      • SimpleDocumentResource

        public SimpleDocumentResource()
    • Method Detail

      • getSimpleDocumentId

        public String getSimpleDocumentId()
      • getDocument

        @GET
        @Path("{lang}")
        @Produces("application/json")
        public SimpleDocumentEntity getDocument​(@PathParam("lang")
                                                String lang)
        Returns the specified document in the specified lang.
        Parameters:
        lang - the wanted language.
        Returns:
        the specified document in the specified lang.
      • deleteDocument

        @DELETE
        @Produces("application/json")
        public void deleteDocument()
        Deletes the the specified document.
      • deleteContent

        @DELETE
        @Path("content/{lang}")
        @Produces("application/json")
        public void deleteContent​(@PathParam("lang")
                                  String lang)
        Deletes the the specified document.
        Parameters:
        lang - the lang of the content to be deleted.
      • updateDocument

        @POST
        @Path("{filename}")
        @Consumes("multipart/form-data")
        public javax.ws.rs.core.Response updateDocument​(@PathParam("filename")
                                                        String filename)
                                                 throws IOException
        Updates the document identified by the requested URI.

        A SimpleDocumentUploadData is extracted from request parameters.

        Returns:
        an HTTP response embodied an entity in a format expected by the client (that is identified by the xRequestedWith parameter).
        Throws:
        IOException - if an error occurs while updating the document.
      • getDocumentTranslations

        @GET
        @Path("translations")
        @Produces("application/json")
        public SimpleDocumentEntity[] getDocumentTranslations()
        Returns all the existing translation of a SimpleDocument.
        Returns:
        all the existing translation of a SimpleDocument.
      • validateUserAuthorization

        public void validateUserAuthorization​(UserPrivilegeValidation validation)
        Validates the authorization of the user to request this web service. For doing, the user must have the rights to access the component instance that manages this web resource. The validation is actually delegated to the validation service by passing it the required information.

        This method should be invoked for web service requiring an authorized access. For doing, the authentication of the user must be first validated. Otherwise, the annotation Authorized can be also used instead at class level for both authentication and authorization.

        Parameters:
        validation - the validation instance to use.
        Throws:
        javax.ws.rs.WebApplicationException - if the rights of the user are not enough to access this web resource.
        See Also:
        UserPrivilegeValidator
      • getFileContent

        @GET
        @Path("content/{lang}")
        @Produces("application/octet-stream")
        public javax.ws.rs.core.Response getFileContent​(@PathParam("lang")
                                                        String language)
        Returns the content of the specified document in the specified language.
        Parameters:
        language - the language of the document's content to get.
        Returns:
        the content of the specified document in the specified language.
      • lock

        @PUT
        @Path("lock/{lang}")
        @Produces("application/json")
        public String lock​(@PathParam("lang")
                           String language)
        Locks the specified document for exclusive edition.
        Returns:
        JSON status to true if the document was locked successfully - JSON status to false otherwise..
      • moveSimpleDocumentUp

        @PUT
        @Path("moveUp")
        @Produces("application/json")
        public String moveSimpleDocumentUp()
        Moves the specified document up in the list.
        Returns:
        JSON status to true if the document was locked successfully - JSON status to false otherwise..
      • moveSimpleDocumentDown

        @PUT
        @Path("moveDown")
        @Produces("application/json")
        public String moveSimpleDocumentDown()
        Moves the specified document down in the list.
        Returns:
        JSON status to true if the document was locked successfully - JSON status to false otherwise..
      • unlockDocument

        @POST
        @Path("unlock")
        @Produces("application/json")
        public String unlockDocument​(@FormParam("force")
                                     boolean force,
                                     @FormParam("webdav")
                                     boolean webdav,
                                     @FormParam("private")
                                     boolean privateVersion,
                                     @FormParam("comment")
                                     String comment)
        Unlocks the specified document for exclusive edition.
        Parameters:
        force - if the unlocking has to be forced.
        webdav - if the unlock is performed while a WebDAV access.
        privateVersion - if the document is a private version.
        comment - a comment about the unlock.
        Returns:
        JSON status to true if the document was locked successfully - JSON status to false otherwise..
      • switchDocumentVersionState

        @PUT
        @Path("switchState")
        @Produces("application/json")
        public String switchDocumentVersionState​(@FormParam("switch-version-comment")
                                                 String comment,
                                                 @FormParam("switch-version")
                                                 String version)
        Changes the document version state.
        Parameters:
        comment - comment about the version state switching.
        version - the new version state.
        Returns:
        JSON status to true if the document was locked successfully - JSON status to false otherwise..
      • switchDownloadAllowedForReaders

        @POST
        @Path("switchDownloadAllowedForReaders")
        @Produces("application/json")
        public String switchDownloadAllowedForReaders​(@FormParam("allowed")
                                                      boolean allowed)
        Forbid or allow the download of the document for readers.
        Returns:
        JSON download state for readers. allowedDownloadForReaders = true or false.
      • switchDisplayAsContentEnabled

        @POST
        @Path("switchDisplayAsContentEnabled")
        @Produces("application/json")
        public String switchDisplayAsContentEnabled​(@FormParam("enabled")
                                                    boolean enabled)
        Enable or not the display as content of an attachment.
        Returns:
        JSON display as content state. displayableAsContent = true or false.
      • switchEditSimultaneouslyEnabled

        @POST
        @Path("switchEditSimultaneouslyEnabled")
        @Produces("application/json")
        public String switchEditSimultaneouslyEnabled​(@FormParam("enabled")
                                                      boolean enabled)
        Enable or not the simultaneous edition of an attachment.
        Returns:
        JSON simultaneous edition state. editableSimultaneously = true or false.