use of org.openforis.collect.io.metadata.IdmlImportTask 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);
}
use of org.openforis.collect.io.metadata.IdmlImportTask 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();
}
}
use of org.openforis.collect.io.metadata.IdmlImportTask 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);
}
use of org.openforis.collect.io.metadata.IdmlImportTask 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();
}
}
use of org.openforis.collect.io.metadata.IdmlImportTask in project collect by openforis.
the class SurveyRestoreJob method initializeTask.
@Override
protected void initializeTask(Worker task) {
if (task instanceof SurveyBackupInfoExtractorTask) {
SurveyBackupInfoExtractorTask t = (SurveyBackupInfoExtractorTask) task;
File infoFile = backupFileExtractor.extract(SurveyBackupJob.INFO_FILE_NAME);
t.setFile(infoFile);
} else if (task instanceof IdmlUnmarshallTask) {
IdmlUnmarshallTask t = (IdmlUnmarshallTask) task;
File idmlFile = backupFileExtractor.extractIdmlFile();
t.setFile(idmlFile);
t.setSurveyManager(surveyManager);
t.setValidate(false);
} else if (task instanceof IdmlImportTask) {
IdmlImportTask t = (IdmlImportTask) task;
t.setSurveyManager(surveyManager);
File idmlFile = backupFileExtractor.extractIdmlFile();
t.setFile(idmlFile);
t.setSurveyUri(surveyUri);
t.setSurveyName(surveyName);
t.setImportInPublishedSurvey(restoreIntoPublishedSurvey);
t.setValidate(false);
t.setUserGroup(userGroup);
t.setActiveUser(activeUser);
} else if (task instanceof CodeListImagesImportTask) {
CodeListImagesImportTask t = (CodeListImagesImportTask) task;
t.setCodeListManager(codeListManager);
t.setZipFile(zipFile);
t.setSurvey(survey);
} else if (task instanceof SamplingDesignCleanTask) {
SamplingDesignCleanTask t = (SamplingDesignCleanTask) task;
t.setSurveyId(survey.getId());
} else if (task instanceof SamplingDesignImportTask) {
SamplingDesignImportTask t = (SamplingDesignImportTask) task;
File samplingDesignFile = backupFileExtractor.extract(SurveyBackupJob.SAMPLING_DESIGN_ENTRY_NAME);
t.setSamplingDesignManager(samplingDesignManager);
t.setFile(samplingDesignFile);
t.setSkipValidation(true);
t.setOverwriteAll(true);
t.setSurvey(survey);
} else if (task instanceof SpeciesBackupImportTask) {
SpeciesBackupImportTask t = (SpeciesBackupImportTask) task;
t.setSpeciesManager(speciesManager);
t.setSurvey(survey);
} else if (task instanceof SurveyFilesImportTask) {
SurveyFilesImportTask t = (SurveyFilesImportTask) task;
t.setSurvey(survey);
t.setBackupFileExtractor(backupFileExtractor);
} else if (task instanceof DataCleansingImportTask) {
DataCleansingImportTask t = (DataCleansingImportTask) task;
t.setSurvey(survey);
t.setInputFile(backupFileExtractor.extract(SurveyBackupJob.DATA_CLEANSING_METADATA_ENTRY_NAME));
}
super.initializeTask(task);
}
Aggregations