Search in sources :

Example 26 with CollectSurvey

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);
    }
}
Also used : ReferenceDataSchema(org.openforis.idm.metamodel.ReferenceDataSchema) SamplingPointDefinition(org.openforis.idm.metamodel.ReferenceDataSchema.SamplingPointDefinition) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Example 27 with CollectSurvey

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();
}
Also used : SpeciesImportProcess(org.openforis.collect.manager.speciesimport.SpeciesImportProcess) SpeciesImportStatus(org.openforis.collect.manager.speciesimport.SpeciesImportStatus) CollectSurvey(org.openforis.collect.model.CollectSurvey) File(java.io.File) Secured(org.springframework.security.access.annotation.Secured)

Example 28 with CollectSurvey

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);
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) Secured(org.springframework.security.access.annotation.Secured)

Example 29 with CollectSurvey

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);
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) TaxonSummaries(org.openforis.collect.metamodel.TaxonSummaries) TaxonSummariesProxy(org.openforis.collect.metamodel.proxy.TaxonSummariesProxy) Secured(org.springframework.security.access.annotation.Secured)

Example 30 with CollectSurvey

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;
}
Also used : SessionState(org.openforis.collect.web.session.SessionState) CollectSurvey(org.openforis.collect.model.CollectSurvey)

Aggregations

CollectSurvey (org.openforis.collect.model.CollectSurvey)329 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)53 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)40 UIOptions (org.openforis.collect.metamodel.ui.UIOptions)38 CollectRecord (org.openforis.collect.model.CollectRecord)30 RecordFilter (org.openforis.collect.model.RecordFilter)27 Transactional (org.springframework.transaction.annotation.Transactional)26 EntityDefinition (org.openforis.idm.metamodel.EntityDefinition)25 ArrayList (java.util.ArrayList)23 File (java.io.File)21 CollectAnnotations (org.openforis.collect.metamodel.CollectAnnotations)21 Secured (org.springframework.security.access.annotation.Secured)20 User (org.openforis.collect.model.User)19 NodeDefinition (org.openforis.idm.metamodel.NodeDefinition)19 SessionState (org.openforis.collect.web.session.SessionState)18 AttributeDefinition (org.openforis.idm.metamodel.AttributeDefinition)17 Test (org.junit.Test)16 CollectRecordSummary (org.openforis.collect.model.CollectRecordSummary)15 CodeList (org.openforis.idm.metamodel.CodeList)15 Schema (org.openforis.idm.metamodel.Schema)15