use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SamplingDesignImportService method updateSessionSurvey.
private void updateSessionSurvey() {
CollectSurvey processSurvey = importProcess.getSurvey();
if (processSurvey.isTemporary()) {
ReferenceDataSchema processReferenceDataSchema = processSurvey.getReferenceDataSchema();
SamplingPointDefinition processSamplingPoint = processReferenceDataSchema == null ? null : processReferenceDataSchema.getSamplingPointDefinition();
CollectSurvey editedSurvey = sessionManager.getActiveDesignerSurvey();
ReferenceDataSchema referenceDataSchema = editedSurvey.getReferenceDataSchema();
if (referenceDataSchema == null) {
referenceDataSchema = new ReferenceDataSchema();
editedSurvey.setReferenceDataSchema(referenceDataSchema);
}
referenceDataSchema.setSamplingPointDefinition(processSamplingPoint);
}
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SpeciesImportService method start.
@Secured("ROLE_ADMIN")
public SpeciesImportStatusProxy start(String tempFileName, CSVFileOptions csvFileOptions, int surveyId, int taxonomyId, boolean overwriteAll) throws DataImportExeption {
if (importProcess == null || !importProcess.getStatus().isRunning()) {
CollectSurvey survey = sessionManager.getActiveDesignerSurvey();
if (survey.getId() != surveyId) {
throw new IllegalStateException("Error importing species list: different survey found in session");
}
File importFile = new File(tempFileName);
importProcess = new SpeciesImportProcess(surveyManager, speciesManager, survey, taxonomyId, importFile, csvFileOptions, overwriteAll);
importProcess.init();
SpeciesImportStatus status = importProcess.getStatus();
if (status != null && !importProcess.getStatus().isError()) {
startProcessThread();
}
}
return getStatus();
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SpeciesService method loadTaxonomiesBySurvey.
@Secured("ROLE_ENTRY")
public List<TaxonomyProxy> loadTaxonomiesBySurvey(int surveyId, boolean work) {
CollectSurvey survey = surveyManager.getOrLoadSurveyById(surveyId);
List<CollectTaxonomy> result = speciesManager.loadTaxonomiesBySurvey(survey);
return Proxies.fromList(result, TaxonomyProxy.class);
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SpeciesService method loadTaxonSummaries.
@Secured("ROLE_ADMIN")
public TaxonSummariesProxy loadTaxonSummaries(int taxonomyId, int offset, int maxRecords) {
CollectSurvey survey = getActiveSurvey();
TaxonSummaries summaries = speciesManager.loadTaxonSummaries(survey, taxonomyId, offset, maxRecords);
return new TaxonSummariesProxy(summaries);
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SpeciesService method getActiveSurvey.
private CollectSurvey getActiveSurvey() {
SessionState sessionState = sessionManager.getSessionState();
CollectSurvey activeSurvey = sessionState.getActiveSurvey();
return activeSurvey;
}
Aggregations