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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations