Class Tasks


  • @RequiredRole("admin")
    public class Tasks
    extends TableServletBase
    /api/admin/elicit/tasks[/task_id] : Administration of elicitation task records.

    Allows administration (Create/Read/Update/Delete) of task records via JSON-encoded objects with the following attributes:

    task_id
    The database key for the record.
    task_name
    The name of the task.
    description
    Description of the task.
    corpus_name
    The corpus for elicited transcripts/recordings.
    transcript_type
    The transcript type for elicited transcripts/recordings.
    preamble
    HTML-encoded text the participant sees when they are about to start the task.
    consent
    Optional HTML-encoded consent form to be 'signed' by the participant.
    endUrl
    Optional URL to send participants to after they finish the task ({participant}, if present in the URL, is replaced by the participant's ID).
    _cantDelete
    This is not a database field, but rather is present in records returned from the server that can not currently be deleted; a string representing the reason the record can't be deleted.

    The following operations, specified by the HTTP method, are supported:

    POST
    Create a new record.
    • Request Body - a JSON-encoded object representing the new record (excluding task_id).
    • Response Body - the standard JSON envelope, with the model as an object representing the new record (including task_id).
    • Response Status
      • 200 : The record was successfully created.
      • 409 : The record could not be added because it was already there.
    GET
    Read the records.
    • Parameters
      • pageNumber (integer) : The (zero-based) page to return.
      • pageLength (integer) : How many rows per page (default is 20).
      • Accept (string) : Equivalent of the "Accept" request header (see below).
    • "Accept" request header/parameter "text/csv" to return records as Comma Separated Values. If not specified, records are returned as a JSON-encoded array of objects.
    • Response Body - the standard JSON envelope, with the model as a corresponding list of records.
    • Response Status
      • 200 : The records could be listed.
    PUT
    Update an existing record, specified by the task_id given in the request body.
    • Request Body - a JSON-encoded object representing the record.
    • Response Body - the standard JSON envelope, with the model as an object representing the record.
    • Response Status
      • 200 : The record was successfully updated.
      • 404 : The record was not found.
    DELETE
    Delete an existing record.
    • Request Path - /api/admin/elicit/tasks/task_id where task_id is the ID of the task to delete.
    • Response Body - the standard JSON envelope, including a message if the request succeeds or an error explaining the reason for failure.
    • Response Status
      • 200 : The record was successfully deleted.
      • 400 : No task_id was specified in the URL path, or the record exists but could not be deleted.
      • 404 : The record was not found.

    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • Tasks

        public Tasks()
    • Method Detail

      • CreateDefaultResources

        public static void CreateDefaultResources​(Connection connection,
                                                  int task_id)
                                           throws SQLException
        Create default resource strings for the given task.
        Parameters:
        connection -
        task_id -
        Throws:
        SQLException