Class ImportDataCommand

java.lang.Object
org.labkey.remoteapi.Command<ResponseType,org.apache.hc.client5.http.classic.methods.HttpPost>
org.labkey.remoteapi.PostCommand<ImportDataResponse>
org.labkey.remoteapi.query.ImportDataCommand
All Implemented Interfaces:
HasRequiredVersion

public class ImportDataCommand extends PostCommand<ImportDataResponse>
Import data in bulk from a text, local file, or a file contained within a module on the LabKey Server.
  • Field Details

    • _importIdentity

      public Boolean _importIdentity
    • _importLookupByAlternateKey

      public Boolean _importLookupByAlternateKey
  • Constructor Details

    • ImportDataCommand

      public ImportDataCommand(String schemaName, String queryName)
      Constructs an ImportDataCommand for the given schemaName and queryName.
      Parameters:
      schemaName - The schemaName
      queryName - The queryName.
  • Method Details

    • getSchemaName

      public String getSchemaName()
      Returns the schema name.
      Returns:
      The schema name.
    • getQueryName

      public String getQueryName()
      Returns the query name
      Returns:
      the query name.
    • setText

      public void setText(String text)
      Submits tsv or csv data as text to the server for import.
      See Also:
    • setPath

      public void setPath(String path)
      Import data from a file relative from the server's webdav root.
    • setModuleResource

      public void setModuleResource(String module, String moduleResource)
      Import data from a resource file embedded in a module.
      Parameters:
      module - module name
      moduleResource - path to the file from the exploded module's directory
    • setFile

      public void setFile(File file)
      Uploads a file for import.
      See Also:
    • isImportIdentity

      public Boolean isImportIdentity()
    • setImportIdentity

      public void setImportIdentity(Boolean importIdentity)
    • isImportLookupByAlternateKey

      public Boolean isImportLookupByAlternateKey()
    • setImportLookupByAlternateKey

      public void setImportLookupByAlternateKey(Boolean importLookupByAlternateKey)
    • getFormat

      public String getFormat()
    • setFormat

      public void setFormat(String format)
    • getInsertOption

      public ImportDataCommand.InsertOption getInsertOption()
    • setInsertOption

      public void setInsertOption(ImportDataCommand.InsertOption insertOption)
    • isUseAsync

      public boolean isUseAsync()
    • setUseAsync

      public void setUseAsync(boolean useAsync)
      Import the data in a pipeline job. Currently only supported when submitting data as a file.
      See Also:
    • isSaveToPipeline

      public boolean isSaveToPipeline()
    • setSaveToPipeline

      public void setSaveToPipeline(boolean saveToPipeline)
      Save the uploaded file to the pipeline root under the "QueryImportFiles" directory. Currently only supported when submitting data as a file.
      See Also:
    • getJsonObject

      public org.json.JSONObject getJsonObject()
      Description copied from class: PostCommand
      Returns the JSON object to post or null for no JSON. Override this method to provide parameters as JSON.
      Overrides:
      getJsonObject in class PostCommand<ImportDataResponse>
      Returns:
      The JSON object to post.
    • createRequest

      protected org.apache.hc.client5.http.classic.methods.HttpPost createRequest(URI uri)
      Description copied from class: PostCommand
      Creates the HttpPost instance used for the request. Override to modify the HttpPost object before use or to send something other than JSON in the post body. In your override, create the HttpPost and set the request entity appropriately.
      Overrides:
      createRequest in class PostCommand<ImportDataResponse>
      Parameters:
      uri - the uri to convert
      Returns:
      The PostMethod object.
    • createResponse

      protected ImportDataResponse createResponse(String text, int status, String contentType, org.json.JSONObject json)
      Description copied from class: Command
      Creates an instance of the response class, initialized with the response text, the HTTP status code, and parsed JSONObject.

      Override this method to create an instance of a different class that extends CommandResponse

      Overrides:
      createResponse in class Command<ImportDataResponse,org.apache.hc.client5.http.classic.methods.HttpPost>
      Parameters:
      text - The response text from the server.
      status - The HTTP status code.
      contentType - The Content-Type header value.
      json - The parsed JSONObject (or null if no JSON was returned).
      Returns:
      An instance of the response object.