Search in sources :

Example 36 with CollectTaxonomy

use of org.openforis.collect.model.CollectTaxonomy in project collect by openforis.

the class SpeciesImportProcessIntegrationTest method importCSVFile.

public SpeciesImportProcess importCSVFile(String fileName) throws Exception {
    File file = getTestFile(fileName);
    CollectTaxonomy taxonomy = new CollectTaxonomy();
    taxonomy.setSurvey(survey);
    taxonomy.setName(TEST_TAXONOMY_NAME);
    speciesManager.save(taxonomy);
    SpeciesImportProcess process = new SpeciesImportProcess(surveyManager, speciesManager, survey, taxonomy.getId(), file, new CSVFileOptions(), true);
    process.call();
    return process;
}
Also used : SpeciesImportProcess(org.openforis.collect.manager.speciesimport.SpeciesImportProcess) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) File(java.io.File) CSVFileOptions(org.openforis.collect.io.parsing.CSVFileOptions)

Example 37 with CollectTaxonomy

use of org.openforis.collect.model.CollectTaxonomy in project collect by openforis.

the class SpeciesService method findByFamilyScientificName.

@Secured("ROLE_ENTRY")
public List<TaxonOccurrenceProxy> findByFamilyScientificName(String taxonomyName, String searchString, int maxResults, TaxonSearchParameters parameters) {
    CollectTaxonomy taxonomy = loadTaxonomyByActiveSurvey(taxonomyName);
    List<TaxonOccurrence> list = speciesManager.findByFamilyScientificName(taxonomy, searchString, maxResults, parameters);
    return Proxies.fromList(list, TaxonOccurrenceProxy.class);
}
Also used : TaxonOccurrence(org.openforis.idm.model.TaxonOccurrence) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) Secured(org.springframework.security.access.annotation.Secured)

Example 38 with CollectTaxonomy

use of org.openforis.collect.model.CollectTaxonomy in project collect by openforis.

the class SpeciesService method findByScientificName.

@Secured("ROLE_ENTRY")
public List<TaxonOccurrenceProxy> findByScientificName(String taxonomyName, String searchString, int maxResults, TaxonSearchParameters parameters) {
    CollectTaxonomy taxonomy = loadTaxonomyByActiveSurvey(taxonomyName);
    List<TaxonOccurrence> list = speciesManager.findByScientificName(taxonomy, searchString, maxResults, parameters);
    return Proxies.fromList(list, TaxonOccurrenceProxy.class);
}
Also used : TaxonOccurrence(org.openforis.idm.model.TaxonOccurrence) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) Secured(org.springframework.security.access.annotation.Secured)

Example 39 with CollectTaxonomy

use of org.openforis.collect.model.CollectTaxonomy in project collect by openforis.

the class SpeciesService method saveTaxonomy.

@Secured("ROLE_ADMIN")
public TaxonomyProxy saveTaxonomy(TaxonomyProxy proxy) {
    CollectSurvey survey = sessionManager.getActiveDesignerSurvey();
    CollectTaxonomy taxonomy;
    Integer taxonomyId = proxy.getId();
    if (taxonomyId == null) {
        taxonomy = new CollectTaxonomy();
    } else {
        taxonomy = speciesManager.loadTaxonomyById(survey, taxonomyId);
    }
    String oldName = taxonomy.getName();
    String newName = proxy.getName();
    if (oldName != null && !oldName.equals(newName)) {
        updateTaxonAttributeDefinitions(oldName, newName);
    }
    proxy.copyPropertiesForUpdate(taxonomy);
    speciesManager.save(taxonomy);
    return new TaxonomyProxy(taxonomy);
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) TaxonomyProxy(org.openforis.collect.model.proxy.TaxonomyProxy) Secured(org.springframework.security.access.annotation.Secured)

Example 40 with CollectTaxonomy

use of org.openforis.collect.model.CollectTaxonomy in project collect by openforis.

the class SpeciesService method findByFamilyCode.

@Secured("ROLE_ENTRY")
public List<TaxonOccurrenceProxy> findByFamilyCode(String taxonomyName, String searchString, int maxResults, TaxonSearchParameters parameters) {
    CollectTaxonomy taxonomy = loadTaxonomyByActiveSurvey(taxonomyName);
    List<TaxonOccurrence> list = speciesManager.findByFamilyCode(taxonomy, searchString, maxResults, parameters);
    return Proxies.fromList(list, TaxonOccurrenceProxy.class);
}
Also used : TaxonOccurrence(org.openforis.idm.model.TaxonOccurrence) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

CollectTaxonomy (org.openforis.collect.model.CollectTaxonomy)43 Taxon (org.openforis.idm.model.species.Taxon)13 TaxonOccurrence (org.openforis.idm.model.TaxonOccurrence)8 Secured (org.springframework.security.access.annotation.Secured)8 Test (org.junit.Test)7 CollectIntegrationTest (org.openforis.collect.CollectIntegrationTest)7 TaxonSummaries (org.openforis.collect.metamodel.TaxonSummaries)7 CollectSurvey (org.openforis.collect.model.CollectSurvey)7 ArrayList (java.util.ArrayList)5 TaxonSummary (org.openforis.collect.metamodel.TaxonSummary)5 TaxonVernacularName (org.openforis.idm.model.species.TaxonVernacularName)5 SpeciesImportProcess (org.openforis.collect.manager.speciesimport.SpeciesImportProcess)4 SpeciesImportStatus (org.openforis.collect.manager.speciesimport.SpeciesImportStatus)3 CsvWriter (org.openforis.commons.io.csv.CsvWriter)3 File (java.io.File)2 List (java.util.List)2 SpeciesBackupImportJob (org.openforis.collect.io.metadata.species.SpeciesBackupImportJob)2 TaxonomyDefinition (org.openforis.idm.metamodel.ReferenceDataSchema.TaxonomyDefinition)2 Transactional (org.springframework.transaction.annotation.Transactional)2 HashSet (java.util.HashSet)1