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