Interface ItemImportService

All Known Implementing Classes:
ItemImportServiceImpl

public interface ItemImportService
Import items into DSpace. The conventional use is upload files by copying them. DSpace writes the item's bitstreams into its assetstore. Metadata is also loaded to the DSpace database.

A second use assumes the bitstream files already exist in a storage resource accessible to DSpace. In this case the bitstreams are 'registered'. That is, the metadata is loaded to the DSpace database and DSpace is given the location of the file which is subsumed into DSpace.

The distinction is controlled by the format of lines in the 'contents' file. See comments in processContentsFile() below.

Modified by David Little, UCSD Libraries 12/21/04 to allow the registration of files (bitstreams) into DSpace.

  • Method Details

    • addItemsAtomic

      void addItemsAtomic(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception
      Parameters:
      c - DSpace Context
      mycollections - List of Collections
      sourceDir - source location
      mapFile - map file
      template - whether to use template item
      Throws:
      Exception - if error
    • addItems

      void addItems(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception
      Add items
      Parameters:
      c - DSpace Context
      mycollections - List of Collections
      sourceDir - source location
      mapFile - map file
      template - whether to use template item
      Throws:
      Exception - if error
    • unzip

      String unzip(File zipfile) throws IOException
      Unzip a file
      Parameters:
      zipfile - file
      Returns:
      unzip location
      Throws:
      IOException - if error
    • unzip

      String unzip(File zipfile, String destDir) throws IOException
      Unzip a file to a destination
      Parameters:
      zipfile - file
      destDir - destination directory
      Returns:
      unzip location
      Throws:
      IOException - if error
    • unzip

      String unzip(String sourcedir, String zipfilename) throws IOException
      Unzip a file in a specific source directory
      Parameters:
      sourcedir - source directory
      zipfilename - file name
      Returns:
      unzip location
      Throws:
      IOException - if error
    • processUIImport

      void processUIImport(String url, Collection owningCollection, String[] collections, String resumeDir, String inputType, Context context, boolean template) throws Exception
      Given a public URL to a zip file that has the Simple Archive Format, this method imports the contents to DSpace
      Parameters:
      url - The public URL of the zip file
      owningCollection - The owning collection the items will belong to
      collections - The collections the created items will be inserted to, apart from the owning one
      resumeDir - In case of a resume request, the directory that containsthe old mapfile and data
      inputType - The input type of the data (bibtex, csv, etc.), in case of local file
      context - The context
      template - whether to use template item
      Throws:
      Exception - if error
    • emailSuccessMessage

      void emailSuccessMessage(Context context, EPerson eperson, String fileName) throws jakarta.mail.MessagingException
      If a batch import is done in a new thread we are unable to communicate with calling method about success or failure. We accomplish this communication with email instead. Send a success email once the batch import is complete
      Parameters:
      context - - the current Context
      eperson - - eperson to send the email to
      fileName - - the filepath to the mapfile created by the batch import
      Throws:
      jakarta.mail.MessagingException - if error
    • emailErrorMessage

      void emailErrorMessage(EPerson eperson, String error) throws jakarta.mail.MessagingException
      If a batch import is done in a new thread we are unable to communicate with calling method about success or failure. We accomplish this communication with email instead. Send an error email if the batch import fails
      Parameters:
      eperson - - EPerson to send the error message to
      error - - the error message
      Throws:
      jakarta.mail.MessagingException - if error
    • getImportsAvailable

      List<BatchUpload> getImportsAvailable(EPerson eperson) throws Exception
      Get imports available for a person
      Parameters:
      eperson - EPerson object
      Returns:
      List of batch uploads
      Throws:
      Exception - if error
    • getImportUploadableDirectory

      String getImportUploadableDirectory(EPerson ePerson) throws Exception
      Get import upload directory
      Parameters:
      ePerson - EPerson object
      Returns:
      directory
      Throws:
      Exception - if error
    • deleteBatchUpload

      void deleteBatchUpload(Context c, String uploadId) throws Exception
      Delete a batch by ID
      Parameters:
      c - DSpace Context
      uploadId - identifier
      Throws:
      Exception - if error
    • replaceItems

      void replaceItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template) throws Exception
      Replace items
      Parameters:
      c - DSpace Context
      mycollections - List of Collections
      sourcedir - source directory
      mapfile - map file
      template - whether to use template item
      Throws:
      Exception - if error
    • deleteItems

      void deleteItems(Context c, String mapfile) throws Exception
      Delete items via mapfile
      Parameters:
      c - DSpace Context
      mapfile - map file
      Throws:
      Exception - if error
    • getTempWorkDir

      String getTempWorkDir()
      Get temporary work directory
      Returns:
      directory as string
    • getTempWorkDirFile

      File getTempWorkDirFile() throws IOException
      Get temporary work directory (as File)
      Returns:
      directory as File
      Throws:
      IOException - if the directory cannot be created.
    • cleanupZipTemp

      void cleanupZipTemp()
      Cleanup
    • setTest

      void setTest(boolean isTest)
      Set test flag
      Parameters:
      isTest - true or false
    • setExcludeContent

      void setExcludeContent(boolean isExcludeContent)
      Set exclude-content flag.
      Parameters:
      isExcludeContent - true or false
    • setResume

      void setResume(boolean isResume)
      Set resume flag
      Parameters:
      isResume - true or false
    • setUseWorkflow

      void setUseWorkflow(boolean useWorkflow)
      Set use workflow
      Parameters:
      useWorkflow - whether to enable workflow
    • setUseWorkflowSendEmail

      void setUseWorkflowSendEmail(boolean useWorkflowSendMail)
      Parameters:
      useWorkflowSendMail - whether to send mail
    • setQuiet

      void setQuiet(boolean isQuiet)
      Set quiet flag
      Parameters:
      isQuiet - true or false
    • setHandler

      void setHandler(DSpaceRunnableHandler handler)
      Set the DSpace Runnable Handler
      Parameters:
      handler -