Class WorkflowRestService

java.lang.Object
org.imixs.workflow.jaxrs.WorkflowRestService

@Path("/workflow") @Produces({"text/html","application/xml","application/json","text/xml"}) public class WorkflowRestService extends Object
The WorkflowService Handler supports methods to process different kind of request URIs
Author:
rsoika
  • Constructor Details

    • WorkflowRestService

      public WorkflowRestService()
  • Method Details

    • getHelpHTML

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

      @GET @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}") public jakarta.ws.rs.core.Response getWorkItem(@PathParam("uniqueid") String uniqueid, @QueryParam("items") String items, @QueryParam("format") String format)
      returns a single workitem defined by $uniqueid
      Parameters:
      uniqueid -
      Returns:
    • getWorkItemFile

      @GET @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}/file/{file}") public jakarta.ws.rs.core.Response getWorkItemFile(@PathParam("uniqueid") String uniqueid, @PathParam("file") @Encoded String file, @Context jakarta.ws.rs.core.UriInfo uriInfo)
      Returns a file attachment located in the property $file of the specified workitem

      The file name will be encoded. With a URLDecode the filename is decoded in different formats and searched in the file list. This is not a nice solution.

      Parameters:
      uniqueid -
      Returns:
    • getEvents

      @GET @Path("/workitem/events/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}") public jakarta.ws.rs.core.Response getEvents(@PathParam("uniqueid") String uniqueid, @QueryParam("format") String format)
      Returns a collection of events of a workitem, visible to the current user
      Parameters:
      uniqueid - of workitem
      Returns:
      list of event entities
    • getWorkList

      @GET @Path("/worklist") public jakarta.ws.rs.core.Response getWorkList(@QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
      Returns a collection of workitems representing the worklist by the current user
      Parameters:
      start -
      count -
      type -
      sortorder -
    • getTaskListByOwner

      @GET @Path("/tasklist/owner/{owner}") public jakarta.ws.rs.core.Response getTaskListByOwner(@PathParam("owner") String owner, @QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
    • getTaskListByAuthor

      @GET @Path("/tasklist/author/{user}") public jakarta.ws.rs.core.Response getTaskListByAuthor(@PathParam("user") String user, @QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
      Returns a collection of workitems for which the specified user has explicit write permission.
      Parameters:
      start -
      count -
      type -
      sortorder -
    • getTaskListByWriteAccess

      @GET @Path("/tasklist/writeaccess") public jakarta.ws.rs.core.Response getTaskListByWriteAccess(@QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
      Returns a collection of workitems where the current user has a write permission. This means that the current userID or at least one of its roles is contained in the $writeaccess property.
      Parameters:
      start -
      count -
      type -
      sortorder -
    • getTaskListByCreator

      @GET @Path("/tasklist/creator/{creator}") public jakarta.ws.rs.core.Response getTaskListByCreator(@PathParam("creator") String creator, @QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
    • getTaskListByProcessID

      @GET @Path("/tasklist/processid/{processid}") public jakarta.ws.rs.core.Response getTaskListByProcessID(@PathParam("processid") int processid, @QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
    • getTaskListByGroup

      @GET @Path("/tasklist/group/{processgroup}") public jakarta.ws.rs.core.Response getTaskListByGroup(@PathParam("processgroup") String processgroup, @QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
    • getTaskListByRef

      @GET @Path("/tasklist/ref/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}") public jakarta.ws.rs.core.Response getTaskListByRef(@PathParam("uniqueid") String uniqueid, @QueryParam("type") String type, @DefaultValue("0") @QueryParam("pageIndex") int pageIndex, @DefaultValue("10") @QueryParam("pageSize") int pageSize, @DefaultValue("") @QueryParam("sortBy") String sortBy, @DefaultValue("false") @QueryParam("sortReverse") Boolean sortReverse, @QueryParam("items") String items, @QueryParam("format") String format)
    • postFormWorkitem

      @POST @Path("/workitem") @Consumes("application/x-www-form-urlencoded") public jakarta.ws.rs.core.Response postFormWorkitem(InputStream requestBodyStream, @QueryParam("items") String items)
      This method expects a form post and processes the WorkItem by the WorkflowService EJB. After the workItem was processed the method redirect the request to the provided action URI. The action URI can also be computed by the Imixs Workflow ResutlPlugin
      Parameters:
      requestBodyStream - - form content
      action - - return URI
      Returns:
    • postFormWorkitemByUnqiueID

      @POST @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}") @Consumes("application/x-www-form-urlencoded") public jakarta.ws.rs.core.Response postFormWorkitemByUnqiueID(@PathParam("uniqueid") String uid, InputStream requestBodyStream, @QueryParam("items") String items)
      This method expects a form post and processes the WorkItem by the WorkflowService EJB. After the workItem was processed the method redirect the request to the provided action URI. The action URI can also be computed by the Imixs Workflow ResutlPlugin
      Parameters:
      requestBodyStream - - form content
      items - - optional item list to be returned in the result
      Returns:
    • putFormWorkitem

      @PUT @Path("/workitem") @Consumes("application/x-www-form-urlencoded") public jakarta.ws.rs.core.Response putFormWorkitem(InputStream requestBodyStream, @QueryParam("items") String items)
      This method expects a form post.
      Parameters:
      requestBodyStream -
      items - - optional item list to be returned in the result
      Returns:
      See Also:
      • putWorkitemDefault
    • postWorkitem

      @POST @Path("/workitem") @Consumes({"application/xml","text/xml","application/json"}) public jakarta.ws.rs.core.Response postWorkitem(XMLDocument xmlworkitem, @QueryParam("items") String items)
      This method post a ItemCollection object to be processed by the WorkflowManager. The method test for the properties $taskidid and $eventid NOTE!! - this method did not update an existing instance of a workItem. The behavior is different to the method putWorkitem(). It need to be discussed if the behavior is wrong or not.
      Parameters:
      workitem - - new workItem data
      items - - optional item list to be returned in the result
    • putWorkitem

      @PUT @Path("/workitem") @Consumes({"application/xml","text/xml","application/json"}) public jakarta.ws.rs.core.Response putWorkitem(XMLDocument workitem, @QueryParam("items") String items)
      Delegater
      Parameters:
      workitem -
      items - - optional item list to be returned in the result
      Returns:
    • postWorkitemByUniqueID

      @POST @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}") @Consumes({"application/xml","text/xml","application/json"}) public jakarta.ws.rs.core.Response postWorkitemByUniqueID(@PathParam("uniqueid") String uniqueid, XMLDocument xmlworkitem, @QueryParam("items") String items)
    • putWorkitemByUniqueID

      @PUT @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}") @Consumes({"application/xml","text/xml","application/json"}) public jakarta.ws.rs.core.Response putWorkitemByUniqueID(@PathParam("uniqueid") String uniqueid, XMLDocument xmlworkitem, @QueryParam("items") String items)
      Delegater for PUT postXMLWorkitemByUniqueID
      Parameters:
      workitem -
      items - - optional item list to be returned in the result
      Returns:
    • postWorkitems

      @POST @Path("/workitems") @Consumes({"application/xml","text/xml","application/json"}) public jakarta.ws.rs.core.Response postWorkitems(XMLDataCollection worklist)
      This method post a collection of ItemCollection objects to be processed by the WorkflowManager.
      Parameters:
      worklist - - workitem list data
      items - - optional item list to be returned in the result
    • putWorkitems

      @PUT @Path("/workitems") @Consumes({"application/xml","text/xml","application/json"}) public jakarta.ws.rs.core.Response putWorkitems(XMLDataCollection worklist)
    • postTypedWorkitemJSON

      @POST @Path("/workitem/typed") @Produces({"application/json","application/xml","text/xml"}) @Consumes("application/json") public jakarta.ws.rs.core.Response postTypedWorkitemJSON(InputStream requestBodyStream, @QueryParam("error") String error, @QueryParam("items") String items)
      This method expects JSON in BADGARFISH notation to processed by the WorkflowService EJB.

      The Method returns a workitem with the new data. If a processException Occurs the method returns an object with the error code

      The JSON is parsed manually by teh imixs json parser. The expreced notation is:

      ... value":{"@type":"xs:int","$":"10"}

      Parameters:
      requestBodyStream -
      items - - optional item list to be returned in the result
      Returns:
      JSON object
      Throws:
      Exception
    • putTypedWorkitemJSON

      @PUT @Path("/workitem/typed") @Consumes("application/json") public jakarta.ws.rs.core.Response putTypedWorkitemJSON(InputStream requestBodyStream, @QueryParam("error") String error, @QueryParam("items") String items)
      Delegater for PUT postJSONTypedWorkitem
      Parameters:
      workitem -
      items - - optional item list to be returned in the result
      Returns:
    • postTypedWorkitemJSONByUniqueID

      @POST @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}/typed") @Consumes("application/json") public jakarta.ws.rs.core.Response postTypedWorkitemJSONByUniqueID(@PathParam("uniqueid") String uniqueid, InputStream requestBodyStream, @QueryParam("error") String error, @QueryParam("items") String items)
    • putTypedWorkitemJSONByUniqueID

      @PUT @Path("/workitem/{uniqueid : ([0-9a-f]{8}-.*|[0-9a-f]{11}-.*)}/typed") @Consumes("application/json") public jakarta.ws.rs.core.Response putTypedWorkitemJSONByUniqueID(@PathParam("uniqueid") String uniqueid, InputStream requestBodyStream, @QueryParam("error") String error, @QueryParam("items") String items)
      Delegater for PUT postJSONWorkitemByUniqueID
      Parameters:
      workitem -
      items - - optional item list to be returned in the result
      Returns:
    • parseWorkitem

      public ItemCollection parseWorkitem(InputStream requestBodyStream)
      This method expects a form post. The method parses the input stream to extract the provides field/value pairs. NOTE: The method did not(!) assume that the put/post request contains a complete workItem. For this reason the method loads the existing instance of the corresponding workItem (identified by the $uniqueid) and adds the values provided by the put/post request into the existing instance. The following kind of lines which can be included in the InputStream will be skipped ------------------------------1a26f3661ff7 Content-Disposition: form-data; name="query" Connection: keep-alive Content-Type: multipart/form-data; boundary=---------------------------195571638125373 Content-Length: 5680 -----------------------------195571638125373
      Parameters:
      requestBodyStream -
      Returns:
      a workitem