Search in sources :

Example 6 with SurveyBackupInfo

use of org.openforis.collect.io.SurveyBackupInfo in project collect by openforis.

the class SurveyBackupInfoCreatorTask method execute.

@Override
protected void execute() throws Throwable {
    SurveyBackupInfo info = new SurveyBackupInfo();
    info.setSurveyUri(survey.getUri());
    info.setSurveyName(survey.getName());
    info.store(outputStream);
}
Also used : SurveyBackupInfo(org.openforis.collect.io.SurveyBackupInfo)

Example 7 with SurveyBackupInfo

use of org.openforis.collect.io.SurveyBackupInfo in project collect by openforis.

the class DataRestoreController method extractSurveyUri.

private String extractSurveyUri(File tempFile) throws ZipException, IOException, FileNotFoundException {
    BackupFileExtractor backupFileExtractor = null;
    try {
        backupFileExtractor = new BackupFileExtractor(tempFile);
        File infoFile = backupFileExtractor.extractInfoFile();
        SurveyBackupInfo backupInfo = SurveyBackupInfo.parse(new FileInputStream(infoFile));
        String surveyUri = backupInfo.getSurveyUri();
        return surveyUri;
    } finally {
        IOUtils.closeQuietly(backupFileExtractor);
    }
}
Also used : SurveyBackupInfo(org.openforis.collect.io.SurveyBackupInfo) BackupFileExtractor(org.openforis.collect.io.BackupFileExtractor) File(java.io.File) MultipartFile(org.springframework.web.multipart.MultipartFile) FileInputStream(java.io.FileInputStream)

Aggregations

SurveyBackupInfo (org.openforis.collect.io.SurveyBackupInfo)7 BackupFileExtractor (org.openforis.collect.io.BackupFileExtractor)4 File (java.io.File)3 FileInputStream (java.io.FileInputStream)2 CollectSurvey (org.openforis.collect.model.CollectSurvey)2 MultipartFile (org.springframework.web.multipart.MultipartFile)2 DataRestoreJob (org.openforis.collect.io.data.DataRestoreJob)1 UserGroup (org.openforis.collect.model.UserGroup)1 Version (org.openforis.commons.versioning.Version)1