@Singleton
public class ImportExportService
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
SESSION_UNZIPPED_STUDY_DIR |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupAfterStudyImport() |
java.io.File |
createStudyExportZipFile(Study study)
Returns a JATOS study archive packed as ZIP.
|
com.fasterxml.jackson.databind.node.ObjectNode |
importStudy(User signedinUser,
java.io.File file)
Import a uploaded JATOS study archive
There are 5 possible cases:
(udir - name of uploaded study asset dir, cdir - name of current study asset dir)
|
java.lang.Long |
importStudyConfirmed(User signedinUser,
boolean keepProperties,
boolean keepAssets,
boolean keepCurrentAssetsName,
boolean renameAssets) |
public static final java.lang.String SESSION_UNZIPPED_STUDY_DIR
public com.fasterxml.jackson.databind.node.ObjectNode importStudy(User signedinUser, java.io.File file) throws java.io.IOException, ForbiddenException
1) study exists - udir exists - udir == cdir : ask confirmation to overwrite study and/or dir 2) study exists - udir exists - udir != cdir : ask confirmation to overwrite study and/or (dir && rename to cdir) 3) study exists - !udir exists : shouldn't happen, ask confirmation to overwrite study 4) !study exists - udir exists : ask to rename dir (generate new dir name) 5) !study exists - !udir exists : new study - write both
java.io.IOExceptionForbiddenExceptionpublic java.lang.Long importStudyConfirmed(User signedinUser, boolean keepProperties, boolean keepAssets, boolean keepCurrentAssetsName, boolean renameAssets) throws java.io.IOException, ForbiddenException, NotFoundException
signedinUser - The signed-in user.keepProperties - If true and the study exists already in JATOS the current properties are kept.
Default is `false` (properties are overwritten by default). If the study doesn't
already exist, this parameter has no effect.keepAssets - If true and the study exists already in JATOS the current study assets directory is
kept. Default is `false` (assets are overwritten by default). If the study doesn't
already exist, this parameter has no effect.keepCurrentAssetsName - If the assets are going to be overwritten (`keepAssets=false`), this flag indicates
if the name of the currently installed assets directory should be kept. A `false`
indicates that the name should be taken from the uploaded one. Default is `true`.renameAssets - If the study assets directory already exists in JATOS but belongs to a different
study, it cannot be overwritten. In this case you can set `renameAssets=true` to let
JATOS add a suffix to the assets directory name (original name + "_" + a number).
Default is `true`.java.io.IOExceptionForbiddenExceptionNotFoundExceptionpublic void cleanupAfterStudyImport()
public java.io.File createStudyExportZipFile(Study study) throws java.io.IOException
java.io.IOException