Class UploadRefs
java.lang.Object
com.kingsrook.qqq.backend.core.jobs.uploads.UploadRefs
Uploads for jobs and the assistant (spec section 3.2): a file is streamed
straight into the uploads storage table (no temp file) and gets an opaque
ref, bound to the uploading user, that expires (default 7 days; a job that
uses it extends it). The jobs_upload row records the ref, owner, size, and
where the bytes are.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidextendForJob(String ref, Integer jobId) A job uses this upload: keep it at least uploadExpiryDays from now.static QRecordThe upload row for a ref the current user may use (owner, or jobs_admin), if it has not expired.static StorageInputWhere an upload's bytes are (checks the ref as get does).static UploadRefregister(String fileName, StorageInput existing) Give a ref to a file that is already in a storage table (e.g., the bulk insert wizard's process upload), owned by the current user.static UploadRefstore(String fileName, String contentType, InputStream inputStream) Stream a file into the uploads storage table as the current user; return its ref.static UploadReftoUploadRef(QRecord row) The upload row as an UploadRef.
-
Method Details
-
store
public static UploadRef store(String fileName, String contentType, InputStream inputStream) throws QException Stream a file into the uploads storage table as the current user; return its ref. The stream is read once and never buffered whole.- Throws:
QException
-
register
Give a ref to a file that is already in a storage table (e.g., the bulk insert wizard's process upload), owned by the current user. No copy.- Throws:
QException
-
get
The upload row for a ref the current user may use (owner, or jobs_admin), if it has not expired. Throws QNotFoundException otherwise (never says whose it was).- Throws:
QException
-
open
Where an upload's bytes are (checks the ref as get does).- Throws:
QException
-
extendForJob
A job uses this upload: keep it at least uploadExpiryDays from now.- Throws:
QException
-
toUploadRef
-