Class Upload
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.edit.participants.attributes.Upload
-
@RequiredRole("edit") public class Upload extends APIRequestHandler
/api/edit/participants/attributes/upload : Handler for receiving and processing participant attribute values in a CSV file./api/edit/participants/attributes/upload
POST uploads a CSV file and imports the specified participant 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 participant;
if the participant exists, its attribute values will be updated,
otherwise, and new participant will be created with the specified
attribute values. If set to -1, all participant are new, and created
with automatically generated IDs, formatted using the
participantNameFormat
system attribute. - 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, the layer ID of the participant attribute to update,
or
_password
if the columns contains the participants' passwords (for logging in to do elicitation tasks).
Output: A JSON-encoded response containing a
model
with the following attributes:- updated
- the number of existing participants that were updated.
- created
- the number of new participants that were created.
- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_CREATED, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNAUTHORIZED, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Upload()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.json.JsonObjectpost(RequestParameters requestParameters, Consumer<Integer> httpStatus)The POST method for the servlet.StringstandardizeLabel(String label, nzilbb.ag.Layer layer)Attempts to standardize the label for a given layer.-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
getContext, GetSystemAttribute, init, writeResponse
-
-
-
-
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.
-
-