Class Upload


  • @RequiredRole("edit")
    public class Upload
    extends APIRequestHandler
    /api/edit/transcripts/attributes/upload : Handler for receiving and processing transcript attribute values in a CSV file.

    /api/edit/transcripts/attributes/upload

    POST uploads a CSV file and imports the specified transcript attributes.

    The multipart-encoded parameters are:

    csv
    CSV file containing the attribute values to import.
    idColumn
    The (zero based) index of the column that identifies the transcript; if the transcript exists, its attribute values will be updated, otherwise, the row is ignored.
    columnLayer
    Multiple values, where the index of the value corresponds to the (zero based) CSV column index, and the value is blank to ignore the column, or the layer ID of the transcript attribute to update.

    Output: A JSON-encoded response containing a model with the following attributes:

    updated
    the number of existing transcript that were updated.
    missing
    the number of transcript that were not found.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • Upload

        public Upload()
        Default constructor.
    • Method Detail

      • post

        public javax.json.JsonObject post​(RequestParameters requestParameters,
                                          Consumer<Integer> httpStatus)
        The POST method for the servlet.
        Parameters:
        requestParameters - Request parameter map.
        httpStatus - Receives the response status code, in case of error.
        Returns:
        JSON-encoded object representing the response
      • standardizeLabel

        public String standardizeLabel​(String label,
                                       nzilbb.ag.Layer layer)
        Attempts to standardize the label for a given layer.
        Parameters:
        label - The proposed label.
        layer - The layer the label corresponds to.
        Returns:
        The standardized label, or the raw label if no standardization is appropriate.