Class DocumentClient

java.lang.Object
org.imixs.melman.AbstractClient
org.imixs.melman.DocumentClient
Direct Known Subclasses:
WorkflowClient

public class DocumentClient extends AbstractClient
This ServiceClient is a WebService REST Client which encapsulate the communication with a REST web serice based on the Imixs Workflow REST API. The Implementation is based on the JAXB API 2.0.
Author:
Ralph Soika
  • Field Details

  • Constructor Details

    • DocumentClient

      public DocumentClient(String base_uri)
      Initialize the client by a BASE_URL.
      Parameters:
      base_uri -
  • Method Details

    • getPageSize

      public int getPageSize()
    • setPageSize

      public void setPageSize(int pageSize)
    • getPageIndex

      public int getPageIndex()
    • setPageIndex

      public void setPageIndex(int pageIndex)
    • getItems

      public String getItems()
    • setItems

      public void setItems(String items)
      Set a comma separated list of items to be returned.
      Parameters:
      items -
    • getType

      public String getType()
      retruns the document type. The default value is "workitem"
      Returns:
    • setType

      public void setType(String type)
    • getSortBy

      public String getSortBy()
    • setSortBy

      public void setSortBy(String sortBy)
    • isSortReverse

      public boolean isSortReverse()
    • setSortReverse

      public void setSortReverse(boolean sortReverse)
    • setSortOrder

      public void setSortOrder(String sortBy, boolean sortReverse)
    • saveDocument

      public org.imixs.workflow.ItemCollection saveDocument(org.imixs.workflow.ItemCollection document) throws RestAPIException
      Creates or updates a single document instance.
      Parameters:
      document - - a ItemCollection representing the document.
      Returns:
      updated document instance
      Throws:
      RestAPIException
    • createAdminPJob

      public org.imixs.workflow.ItemCollection createAdminPJob(org.imixs.workflow.ItemCollection document) throws RestAPIException
      Creates a new AdminPJobInstance
      Parameters:
      document - - a ItemCollection representing the job.
      Returns:
      updated job instance
      Throws:
      RestAPIException
    • getDocument

      public org.imixs.workflow.ItemCollection getDocument(String uniqueid) throws RestAPIException
      Returns a single document instance by UniqueID.
      Parameters:
      uniqueid -
      Returns:
      workitem
      Throws:
      RestAPIException
    • deleteDocument

      public void deleteDocument(String uniqueid) throws RestAPIException
      Deletes a single workItem or document instance by UniqueID.
      Parameters:
      userid -
      Throws:
      RestAPIException
    • searchDocuments

      public List<org.imixs.workflow.ItemCollection> searchDocuments(String query) throws RestAPIException, UnsupportedEncodingException
      Returns the the search result of a lucene search.

      The method creates a search URL and requests a CustomResource by GET. The lucene search phrase is encoded by this method. The method throws a UnsupportedEncodingException if the query string can not be encoded.

      Parameters:
      query - - lucene search query
      Returns:
      result list
      Throws:
      RestAPIException
      UnsupportedEncodingException
    • queryDocuments

      public List<org.imixs.workflow.ItemCollection> queryDocuments(String jpqlStatement) throws RestAPIException, UnsupportedEncodingException
      Returns the the search result of a JPQL statement.

      The method creates a search URL and requests a CustomResource by GET. The JPQL statement is encoded by this method. The method throws a UnsupportedEncodingException if the query string can not be encoded.

      Parameters:
      jpqlStatement - - lucene search query / JQPL statement
      Returns:
      result list
      Throws:
      RestAPIException
      UnsupportedEncodingException
    • countDocuments

      public long countDocuments(String query) throws RestAPIException, UnsupportedEncodingException
      Counts a given lucene search result

      The method returns the count of documents included in the result of a given lucene query

      Parameters:
      query - - lucene search query
      Returns:
      count of total hits
      Throws:
      RestAPIException
      UnsupportedEncodingException
    • postXMLDocument

      public org.imixs.workflow.xml.XMLDataCollection postXMLDocument(String uri, org.imixs.workflow.xml.XMLDocument xmlWorkitem) throws RestAPIException
      Posts a XMLDocument to a custom resource.

      This method expects that the response is a XMLDataCollection containing the posted document. In case of an HTTP Result other than 200=OK the method throws an exception containing the the error_code and error_message stored in the returnded XMLDocument

      Parameters:
      document - - a ItemCollection representing the document.
      Returns:
      updated document instance or null if no document was returned by the API
      Throws:
      RestAPIException
    • postXMLDataCollection

      public void postXMLDataCollection(String uri, org.imixs.workflow.xml.XMLDataCollection xmlDataCollection) throws RestAPIException
      Posts a XMLDocument collection to a custom resource.
      Parameters:
      documents - - a collection of ItemCollection objects
      Throws:
      RestAPIException