Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Brief Description

The Batch Job service allows the user to invoke batch jobs in a specific context, such as in the context of a single record, a list of records, or a group of records. Some batch jobs may also be invoked with no externally-provided context.

Batch jobs are written in Java, and conform to a specific Java interface. These jobs have access to a broad cross-section of the services RESTful APIs; they can create, update, delete and search records; relate records; and perform many other actions. The results (output) of the batch jobs are returned as service invocation responses.

Assumptions

Implementers can add batch jobs by creating new Java classes that implement the Batch Invocable (and hence, Invocable) interfaces.

A sample batch job, CreateAndLinkLoanOutBatchJob, is included in the batch module in the services source code repository.

This batch job demonstrates partial automation of the process of loaning out a CollectionObject. The job:

  • Accepts the CSID of a single CollectionObject record as its invocation context.
  • Creates a new Loan Out record.
  • Relates that Loan Out record to the specified CollectionObject.
  • Returns the CSID of the newly-created Loan Out record.

REST-based API

The Batch Job Service offers a REST-based Application Programming Interface (API) to CRUD (create, read, update, and delete) operations on individual Batch Job instances, plus list operations on multiple Batch Job instances. These follow the Common model for CollectionSpace REST services.

...

Code Block
GET /cspace-services/batch/ HTTP/1.1
Filtering

In addition to the standard paging params, batch jobs can be filtered for an invocation context, by specifying the document type and the invocation mode (both must be specified together)by various characteristics:

  • doctype={document type name, e.g., CollectionObject, Intake, etc.}
  • invmode={single, |list, group|group|nocontext}
  • classname={classname}

For example, to get the batch jobs that can be invoked with a list of CollectionObjects:

Code Block
GET /cspace-services/batch?doctype=CollectionObject&invmode=list HTTP/1.1

If multiple filter parameters are supplied, the filters are by default combined using an AND operator, so the results must satisfy all of the specified filters. This can be changed by adding the combine=or parameter to the list request. Setting combine to or causes the supplied filters to be combined using an OR operator, so batch jobs satisfying any of the filters are returned.

Batch Job Invocation services

...