+// TODO: if new entity is an hybrid, the hybrid names should be saved first.. see newTaxonnodeWizard
+ Taxon taxon = getEntity();
+ if (!taxon.getName().getHybridChildRelations().isEmpty() || !taxon.getName().getHybridParentRelations().isEmpty()){
+ Set<TaxonName> namesToSave = new HashSet<>();
+ for (HybridRelationship hybridRelationship: taxon.getName().getHybridChildRelations()){
+ if (hybridRelationship.getParentName() != taxon.getName()){
+ if (!hybridRelationship.getParentName().isPersited()){
+ namesToSave.add(hybridRelationship.getParentName());
+ }
+ }else if (hybridRelationship.getHybridName() != taxon.getName()){
+ if (!hybridRelationship.getHybridName().isPersited()){
+ namesToSave.add(hybridRelationship.getHybridName());
+ }
+ }
+
+ }
+
+ for (HybridRelationship hybridRelationship: taxon.getName().getHybridParentRelations()){
+ if (hybridRelationship.getParentName() != taxon.getName()){
+ if (!hybridRelationship.getParentName().isPersited()){
+ namesToSave.add(hybridRelationship.getParentName());
+ }
+ }else if (hybridRelationship.getHybridName() != taxon.getName()){
+ if (!hybridRelationship.getHybridName().isPersited()){
+ namesToSave.add(hybridRelationship.getHybridName());
+ }
+ }
+
+ }
+ CdmStore.getService(INameService.class).save(namesToSave);
+ }
+ CdmStore.getService(ITaxonService.class).save(taxon);