Interface ItemImportService
-
- All Known Implementing Classes:
ItemImportServiceImpl
public interface ItemImportServiceImport 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddBTEItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template, String bteInputType, String workingDir)Add itemsvoidaddItems(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template)Add itemsvoidaddItemsAtomic(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template)voidcleanupZipTemp()CleanupvoiddeleteBatchUpload(Context c, String uploadId)Delete a batch by IDvoiddeleteItems(Context c, String mapfile)Delete items via mapfilevoidemailErrorMessage(EPerson eperson, String error)Since the BTE batch import is done in a new thread we are unable to communicate with calling method about success or failure.voidemailSuccessMessage(Context context, EPerson eperson, String fileName)Since the BTE batch import is done in a new thread we are unable to communicate with calling method about success or failure.List<BatchUpload>getImportsAvailable(EPerson eperson)Get imports available for a personStringgetImportUploadableDirectory(EPerson ePerson)Get import upload directoryStringgetTempWorkDir()Get temporary work directoryFilegetTempWorkDirFile()Get temporary work directory (as File)voidprocessUIImport(String url, Collection owningCollection, String[] collections, String resumeDir, String inputType, Context context, boolean template)Given a public URL to a zip file that has the Simple Archive Format, this method imports the contents to DSpacevoidreplaceItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template)Replace itemsvoidsetQuiet(boolean isQuiet)Set quiet flagvoidsetResume(boolean isResume)Set resume flagvoidsetTest(boolean isTest)Set test flagvoidsetUseWorkflow(boolean useWorkflow)Set use workflowvoidsetUseWorkflowSendEmail(boolean useWorkflowSendMail)Stringunzip(File zipfile)Unzip a fileStringunzip(File zipfile, String destDir)Unzip a file to a destinationStringunzip(String sourcedir, String zipfilename)Unzip a file in a specific source directory
-
-
-
Method Detail
-
addItemsAtomic
void addItemsAtomic(Context c, List<Collection> mycollections, String sourceDir, String mapFile, boolean template) throws Exception
- Parameters:
c- DSpace Contextmycollections- List of CollectionssourceDir- source locationmapFile- map filetemplate- 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 Contextmycollections- List of CollectionssourceDir- source locationmapFile- map filetemplate- 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- filedestDir- 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 directoryzipfilename- 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 fileowningCollection- The owning collection the items will belong tocollections- The collections the created items will be inserted to, apart from the owning oneresumeDir- In case of a resume request, the directory that containsthe old mapfile and datainputType- The input type of the data (bibtex, csv, etc.), in case of local filecontext- The contexttemplate- whether to use template item- Throws:
Exception- if error
-
emailSuccessMessage
void emailSuccessMessage(Context context, EPerson eperson, String fileName) throws javax.mail.MessagingException
Since the BTE 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 Contexteperson- - eperson to send the email tofileName- - the filepath to the mapfile created by the batch import- Throws:
javax.mail.MessagingException- if error
-
emailErrorMessage
void emailErrorMessage(EPerson eperson, String error) throws javax.mail.MessagingException
Since the BTE batch import is done in a new thread we are unable to communicate with calling method about success or failure. We accomplis this communication with email instead. Send an error email if the batch import fails- Parameters:
eperson- - EPerson to send the error message toerror- - the error message- Throws:
javax.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 ContextuploadId- 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 Contextmycollections- List of Collectionssourcedir- source directorymapfile- map filetemplate- 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 Contextmapfile- map file- Throws:
Exception- if error
-
addBTEItems
void addBTEItems(Context c, List<Collection> mycollections, String sourcedir, String mapfile, boolean template, String bteInputType, String workingDir) throws Exception
Add items- Parameters:
c- DSpace Contextmycollections- List of Collectionssourcedir- source directorymapfile- map filetemplate- whether to use template itembteInputType- The input type of the data (bibtex, csv, etc.), in case of local fileworkingDir- working directory- 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
-
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
-
-