Search in sources :

Example 1 with TaxonomyProxy

use of org.openforis.collect.model.proxy.TaxonomyProxy 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)

Aggregations

CollectSurvey (org.openforis.collect.model.CollectSurvey)1 CollectTaxonomy (org.openforis.collect.model.CollectTaxonomy)1 TaxonomyProxy (org.openforis.collect.model.proxy.TaxonomyProxy)1 Secured (org.springframework.security.access.annotation.Secured)1