Search in sources :

Example 1 with IdmlUnmarshallTask

use of org.openforis.collect.io.metadata.IdmlUnmarshallTask in project collect by openforis.

the class XMLSurveyRestoreJob method initializeTask.

@Override
protected void initializeTask(Worker task) {
    if (task instanceof IdmlUnmarshallTask) {
        IdmlUnmarshallTask t = (IdmlUnmarshallTask) task;
        t.setFile(file);
        t.setSurveyManager(surveyManager);
        t.setValidate(false);
    } else if (task instanceof IdmlImportTask) {
        IdmlImportTask t = (IdmlImportTask) task;
        t.setSurveyManager(surveyManager);
        t.setFile(file);
        t.setSurveyUri(surveyUri);
        t.setSurveyName(surveyName);
        t.setImportInPublishedSurvey(restoreIntoPublishedSurvey);
        t.setValidate(validateSurvey);
        t.setUserGroup(userGroup);
        t.setActiveUser(activeUser);
    }
    super.initializeTask(task);
}
Also used : IdmlUnmarshallTask(org.openforis.collect.io.metadata.IdmlUnmarshallTask) IdmlImportTask(org.openforis.collect.io.metadata.IdmlImportTask)

Example 2 with IdmlUnmarshallTask

use of org.openforis.collect.io.metadata.IdmlUnmarshallTask in project collect by openforis.

the class AbstractSurveyRestoreJob method onTaskCompleted.

@Override
protected void onTaskCompleted(Worker task) {
    super.onTaskCompleted(task);
    if (task instanceof IdmlUnmarshallTask) {
        CollectSurvey s = ((IdmlUnmarshallTask) task).getSurvey();
        this.surveyUri = s.getUri();
    } else if (task instanceof IdmlImportTask) {
        IdmlImportTask t = (IdmlImportTask) task;
        // get output survey and set it into job instance instance variable
        this.survey = t.getSurvey();
    }
}
Also used : IdmlUnmarshallTask(org.openforis.collect.io.metadata.IdmlUnmarshallTask) CollectSurvey(org.openforis.collect.model.CollectSurvey) IdmlImportTask(org.openforis.collect.io.metadata.IdmlImportTask)

Example 3 with IdmlUnmarshallTask

use of org.openforis.collect.io.metadata.IdmlUnmarshallTask in project collect by openforis.

the class CESurveyRestoreJob method initializeTask.

@Override
protected void initializeTask(Worker task) {
    if (task instanceof IdmlUnmarshallTask) {
        IdmlUnmarshallTask t = (IdmlUnmarshallTask) task;
        t.setFile(idmlFile);
        t.setSurveyManager(surveyManager);
        t.setValidate(false);
    } else if (task instanceof IdmlImportTask) {
        IdmlImportTask t = (IdmlImportTask) task;
        t.setSurveyManager(surveyManager);
        t.setFile(idmlFile);
        t.setSurveyUri(surveyUri);
        t.setSurveyName(surveyName);
        t.setImportInPublishedSurvey(restoreIntoPublishedSurvey);
        t.setActiveUser(activeUser);
        t.setUserGroup(userGroup);
        t.setValidate(false);
    } else if (task instanceof CEPropertiesImportTask) {
        CEPropertiesImportTask t = (CEPropertiesImportTask) task;
        t.setSurveyManager(surveyManager);
        t.setSurvey(survey);
        t.setFile(zipFileExtractor.extract("project_definition.properties"));
    } else if (task instanceof CollectEarthUniqueSurveyFileImportTask) {
        CollectEarthUniqueSurveyFileImportTask t = (CollectEarthUniqueSurveyFileImportTask) task;
        t.setSurveyManager(surveyManager);
        t.setSurvey(survey);
        t.setZipFileExtractor(zipFileExtractor);
    } else if (task instanceof GridFilesImportTask) {
        GridFilesImportTask t = (GridFilesImportTask) task;
        t.setSurveyManager(surveyManager);
        t.setSurvey(survey);
        t.setZipFileExtractor(zipFileExtractor);
    }
    super.initializeTask(task);
}
Also used : IdmlUnmarshallTask(org.openforis.collect.io.metadata.IdmlUnmarshallTask) IdmlImportTask(org.openforis.collect.io.metadata.IdmlImportTask)

Example 4 with IdmlUnmarshallTask

use of org.openforis.collect.io.metadata.IdmlUnmarshallTask in project collect by openforis.

the class SurveyBackupInfoExtractorJob method initializeTask.

@Override
protected void initializeTask(Worker task) {
    if (task instanceof SurveyBackupVerifierTask) {
        SurveyBackupVerifierTask t = (SurveyBackupVerifierTask) task;
        t.setZipFile(zipFile);
    } else if (task instanceof SurveyBackupInfoExtractorTask) {
        File infoFile = backupFileExtractor.extractInfoFile();
        SurveyBackupInfoExtractorTask t = (SurveyBackupInfoExtractorTask) task;
        t.setFile(infoFile);
    } else if (task instanceof IdmlUnmarshallTask) {
        File idmlFile = zipFile == null ? file : backupFileExtractor.extractIdmlFile();
        IdmlUnmarshallTask t = (IdmlUnmarshallTask) task;
        t.setSurveyManager(surveyManager);
        t.setValidate(validate);
        t.setFile(idmlFile);
    }
}
Also used : SurveyBackupInfoExtractorTask(org.openforis.collect.io.internal.SurveyBackupInfoExtractorTask) SurveyBackupVerifierTask(org.openforis.collect.io.internal.SurveyBackupVerifierTask) IdmlUnmarshallTask(org.openforis.collect.io.metadata.IdmlUnmarshallTask) File(java.io.File) ZipFile(java.util.zip.ZipFile)

Example 5 with IdmlUnmarshallTask

use of org.openforis.collect.io.metadata.IdmlUnmarshallTask in project collect by openforis.

the class SurveyRestoreJob method onTaskCompleted.

@Override
protected void onTaskCompleted(Worker task) {
    super.onTaskCompleted(task);
    if (task instanceof SurveyBackupInfoExtractorTask) {
        SurveyBackupInfoExtractorTask t = (SurveyBackupInfoExtractorTask) task;
        this.backupInfo = t.getInfo();
    } else if (task instanceof IdmlUnmarshallTask) {
        CollectSurvey s = ((IdmlUnmarshallTask) task).getSurvey();
        s.setUserGroupId(userGroup.getId());
        this.surveyUri = s.getUri();
    } else if (task instanceof IdmlImportTask) {
        IdmlImportTask t = (IdmlImportTask) task;
        // get output survey and set it into job instance instance variable
        this.survey = t.getSurvey();
    } else if (task instanceof SamplingDesignImportTask) {
        saveSurvey();
    }
}
Also used : SurveyBackupInfoExtractorTask(org.openforis.collect.io.internal.SurveyBackupInfoExtractorTask) SamplingDesignImportTask(org.openforis.collect.io.metadata.samplingdesign.SamplingDesignImportTask) IdmlUnmarshallTask(org.openforis.collect.io.metadata.IdmlUnmarshallTask) CollectSurvey(org.openforis.collect.model.CollectSurvey) IdmlImportTask(org.openforis.collect.io.metadata.IdmlImportTask)

Aggregations

IdmlUnmarshallTask (org.openforis.collect.io.metadata.IdmlUnmarshallTask)7 IdmlImportTask (org.openforis.collect.io.metadata.IdmlImportTask)5 File (java.io.File)3 SurveyBackupInfoExtractorTask (org.openforis.collect.io.internal.SurveyBackupInfoExtractorTask)3 ZipFile (java.util.zip.ZipFile)2 SamplingDesignImportTask (org.openforis.collect.io.metadata.samplingdesign.SamplingDesignImportTask)2 CollectSurvey (org.openforis.collect.model.CollectSurvey)2 DataCleansingImportTask (org.openforis.collect.datacleansing.io.DataCleansingImportTask)1 SurveyRestoreJob (org.openforis.collect.io.SurveyRestoreJob)1 Input (org.openforis.collect.io.data.RecordProviderInitializerTask.Input)1 SurveyBackupVerifierTask (org.openforis.collect.io.internal.SurveyBackupVerifierTask)1 CodeListImagesImportTask (org.openforis.collect.io.metadata.CodeListImagesImportTask)1 SurveyFilesImportTask (org.openforis.collect.io.metadata.SurveyFilesImportTask)1 SpeciesBackupImportTask (org.openforis.collect.io.metadata.species.SpeciesBackupImportTask)1