Class UploadRefs

java.lang.Object
com.kingsrook.qqq.backend.core.jobs.uploads.UploadRefs

public final class UploadRefs extends Object
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 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

      public static UploadRef register(String fileName, StorageInput existing) throws QException
      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

      public static QRecord get(String ref) throws QException
      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

      public static StorageInput open(String ref) throws QException
      Where an upload's bytes are (checks the ref as get does).
      Throws:
      QException
    • extendForJob

      public static void extendForJob(String ref, Integer jobId) throws QException
      A job uses this upload: keep it at least uploadExpiryDays from now.
      Throws:
      QException
    • toUploadRef

      public static UploadRef toUploadRef(QRecord row)
      The upload row as an UploadRef.