private static void failIfRequiredParametersNullOrEmpty(
GlobalDocumentId id, DocumentFileUploadForm uploadForm)
throws ChunkUploadException {
if (isNullOrEmpty(id.getDocId())) {
throw new ChunkUploadException(Status.PRECONDITION_FAILED,
"Required query string parameter 'docId' was not found.");
}
if (uploadForm.getFileStream() == null) {
throw new ChunkUploadException(Status.PRECONDITION_FAILED,
"Required form parameter 'file' containing file content was not found.");
}
if (uploadForm.getFirst() == null || uploadForm.getLast() == null) {
throw new ChunkUploadException(Status.PRECONDITION_FAILED,
"Form parameters 'first' and 'last' must both be provided.");
}
if (isNullOrEmpty(uploadForm.getFileType())) {
throw new ChunkUploadException(Status.PRECONDITION_FAILED,
"Required form parameter 'type' was not found.");
}
}