Class DocumentRestService


  • @Path("/documents")
    @Produces({"text/html","application/xml","application/json","text/xml"})
    public class DocumentRestService
    extends Object
    The DocumentService provides methods to access the DocumentService EJB
    Author:
    rsoika
    • Constructor Detail

      • DocumentRestService

        public DocumentRestService()
    • Method Detail

      • getRoot

        @GET
        @Produces("application/xhtml+xml")
        public jakarta.ws.rs.core.StreamingOutput getRoot()
      • getHelpHTML

        @GET
        @Produces("text/html")
        @Path("/help")
        public jakarta.ws.rs.core.StreamingOutput getHelpHTML()
      • getDocument

        @GET
        @Path("/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}")
        public jakarta.ws.rs.core.Response getDocument​(@PathParam("uniqueid")
                                                       String uniqueid,
                                                       @QueryParam("items")
                                                       String items,
                                                       @QueryParam("format")
                                                       String format)
        returns a single document defined by $uniqueid Regex for UID - e.g: bcc776f9-4e5a-4272-a613-9f5ebf35354d Snapshot: bcc776f9-4e5a-4272-a613-9f5ebf35354d-9b6655 deprecated format : 132d37bfd51-9a7868
        Parameters:
        uniqueid -
        Returns:
      • findDocumentsByQuery

        @GET
        @Path("/search/{query}")
        public jakarta.ws.rs.core.Response findDocumentsByQuery​(@PathParam("query")
                                                                String query,
                                                                @DefaultValue("-1") @QueryParam("pageSize")
                                                                int pageSize,
                                                                @DefaultValue("0") @QueryParam("pageIndex")
                                                                int pageIndex,
                                                                @QueryParam("sortBy")
                                                                String sortBy,
                                                                @QueryParam("sortReverse")
                                                                boolean sortReverse,
                                                                @QueryParam("items")
                                                                String items,
                                                                @QueryParam("format")
                                                                String format)
        Returns a resultset for a lucene Search Query
        Parameters:
        query -
        pageSize -
        pageIndex -
        items -
        Returns:
      • findDocumentsByJPQL

        @GET
        @Path("/jpql/{query}")
        public jakarta.ws.rs.core.Response findDocumentsByJPQL​(@PathParam("query")
                                                               String query,
                                                               @DefaultValue("100") @QueryParam("pageSize")
                                                               int pageSize,
                                                               @DefaultValue("0") @QueryParam("pageIndex")
                                                               int pageIndex,
                                                               @QueryParam("items")
                                                               String items,
                                                               @QueryParam("format")
                                                               String format)
        Returns a resultset for a JPQL statement
        Parameters:
        query - - JPQL statement
        pageSize - - page size
        pageIndex - - page index (default = 0)
        items - - optional list of items
        Returns:
        result set.
      • countTotalHitsByQuery

        @GET
        @Path("/count/{query}")
        public jakarta.ws.rs.core.Response countTotalHitsByQuery​(@PathParam("query")
                                                                 String query,
                                                                 @DefaultValue("-1") @QueryParam("maxResult")
                                                                 int maxResult,
                                                                 @QueryParam("format")
                                                                 String format)
        Returns a total hits for a lucene Search Query
        Parameters:
        query -
        pageSize -
        pageIndex -
        items -
        Returns:
      • countTotalPagesByQuery

        @GET
        @Path("/countpages/{query}")
        public jakarta.ws.rs.core.Response countTotalPagesByQuery​(@PathParam("query")
                                                                  String query,
                                                                  @DefaultValue("-1") @QueryParam("pageSize")
                                                                  int pageSize,
                                                                  @QueryParam("format")
                                                                  String format)
        Returns the total pages for a lucene Search Query and a given page size.
        Parameters:
        query -
        pageSize -
        pageIndex -
        items -
        Returns:
      • postDocument

        @POST
        @Produces("application/xml")
        @Consumes({"application/xml","text/xml","application/json"})
        public jakarta.ws.rs.core.Response postDocument​(XMLDocument xmlworkitem,
                                                        @QueryParam("items")
                                                        String items)
        The method saves a document provided in xml format. The caller need to be assigned to the access role 'org.imixs.ACCESSLEVEL.MANAGERACCESS' Note: the method merges the content of the given document into an existing one because the DocumentService method save() did not merge an entity. But the rest service typically consumes only a subset of attributes. So this is the reason why we merge the entity here. In different to the behavior of the DocumentService the WorkflowService method process() did this merge automatically.
        Parameters:
        xmlworkitem - - document to be saved
        items - - optional item list to be returned in the result
        Returns:
      • putDocument

        @PUT
        @Produces("application/xml")
        @Consumes({"application/xml","text/xml","application/json"})
        public jakarta.ws.rs.core.Response putDocument​(XMLDocument xmlworkitem,
                                                       @QueryParam("items")
                                                       String items)
        Delegater putEntity @PUT
        Parameters:
        xmlworkitem - - document to be saved
        items - - optional item list to be returned in the result
        Returns:
        See Also:
        putWorkitemDefault
      • deleteEntity

        @DELETE
        @Path("/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}")
        public jakarta.ws.rs.core.Response deleteEntity​(@PathParam("uniqueid")
                                                        String uniqueid)
        This method deletes an entity
      • backup

        @PUT
        @Path("/backup/{query}")
        public jakarta.ws.rs.core.Response backup​(@PathParam("query")
                                                  String query,
                                                  @QueryParam("filepath")
                                                  String filepath,
                                                  @QueryParam("snapshots")
                                                  boolean snapshots)
        This method creates a backup of the result set form a JQPL query. The entity list will be stored into the file system. The backup can be restored by calling the restore method
        Parameters:
        query -
        filepath - - path in server filesystem
        snapshots - - opitonal backup snapshots only
        Returns:
      • restore

        @GET
        @Path("/restore")
        public jakarta.ws.rs.core.Response restore​(@QueryParam("filepath")
                                                   String filepath)
        This method restores a backup from the fileSystem
        Parameters:
        filepath - - path in server fileSystem
        Returns:
      • getConfiguration

        @GET
        @Path("/configuration")
        @Produces({"application/xml","application/json"})
        public jakarta.ws.rs.core.Response getConfiguration​(@QueryParam("format")
                                                            String format)
                                                     throws Exception
        Returns the IndexFieldListNoAnalyse from the lucensUpdateService
        Returns:
        Throws:
        Exception
      • convertResult

        public jakarta.ws.rs.core.Response convertResult​(ItemCollection workitem,
                                                         String items,
                                                         String format)
        This method converts a single ItemCollection into a Jax-rs response object.

        The method expects optional items and format string (json|xml)

        In case the result set is null, than the method returns an empty collection.

        Parameters:
        result - list of ItemCollection
        items - - optional item list
        format - - optional format string (json|xml)
        Returns:
        jax-rs Response object.
      • convertResultList

        public jakarta.ws.rs.core.Response convertResultList​(List<ItemCollection> result,
                                                             String items,
                                                             String format)
        This method converts a ItemCollection List into a Jax-rs response object.

        The method expects optional items and format string (json|xml)

        In case the result set is null, than the method returns an empty collection.

        Parameters:
        result - list of ItemCollection
        items - - optional item list
        format - - optional format string (json|xml)
        Returns:
        jax-rs Response object.