Search in sources :

Example 41 with CollectTaxonomy

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

the class SpeciesService method findByCode.

@Secured("ROLE_ENTRY")
public List<TaxonOccurrenceProxy> findByCode(String taxonomyName, String searchString, int maxResults, TaxonSearchParameters parameters) {
    CollectTaxonomy taxonomy = loadTaxonomyByActiveSurvey(taxonomyName);
    List<TaxonOccurrence> list = speciesManager.findByCode(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 42 with CollectTaxonomy

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

the class SurveyValidator method validateTaxonomy.

private SurveyValidationResult validateTaxonomy(TaxonAttributeDefinition attrDef) {
    CollectSurvey survey = (CollectSurvey) attrDef.getSurvey();
    boolean surveyIsStored = survey.getId() != null;
    if (surveyIsStored) {
        // validate taxonomies only when survey is stored
        String taxonomyName = attrDef.getTaxonomy();
        CollectTaxonomy taxonomy = findTaxonomy(survey, taxonomyName);
        if (taxonomy == null) {
            return new SurveyValidationResult(attrDef.getPath(), "survey.validation.attribute.taxon.invalid_taxonomy", taxonomyName);
        }
    }
    return new SurveyValidationResult();
}
Also used : CollectSurvey(org.openforis.collect.model.CollectSurvey) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy)

Example 43 with CollectTaxonomy

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

the class TaxonAttributeVM method getTaxonomyNames.

@DependsOn("surveyId")
public List<String> getTaxonomyNames() {
    List<CollectTaxonomy> taxonomies = speciesManager.loadTaxonomiesBySurvey(survey);
    List<String> result = new ArrayList<String>();
    for (CollectTaxonomy taxonomy : taxonomies) {
        result.add(taxonomy.getName());
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) CollectTaxonomy(org.openforis.collect.model.CollectTaxonomy) DependsOn(org.zkoss.bind.annotation.DependsOn)

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