- public static TaxonEditorInput NewInstanceFromTaxonBase(UUID taxonBaseUuid){
- ConversationHolder conversation = CdmStore.createConversation();
-
- TaxonEditorInput input = null;
-
- TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
- if (taxonBase != null){
- if(taxonBase.isInstanceOf(Taxon.class)){
- Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
-
- if (taxon.getTaxonNodes().size() == 0 && taxon.isMisapplication()){
- // TODO get accepted taxon
- MessagingUtils.info("trying to open misapplied Name ");
-
- Set<Taxon> acceptedTaxa = new HashSet<Taxon>();
- Set<TaxonRelationship> relations = taxon.getRelationsFromThisTaxon();
- for(TaxonRelationship relation : relations){
- if(relation.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
- acceptedTaxa.add(relation.getToTaxon());
- }
- }
- input = getInputForMultipleTaxa(conversation, acceptedTaxa);
-
- }else{
- input = getInputForMultipleNodes(conversation, taxon.getTaxonNodes());
- }
- }else if(taxonBase instanceof Synonym){
- Synonym synonym = (Synonym) taxonBase;
-
- Set<Taxon> taxa = synonym.getAcceptedTaxa();
- input = getInputForMultipleTaxa(conversation, taxa);
- }
- if (input != null){
- input.setInitiallySelectedTaxonBase(taxonBase);
- }
- }
-
-
- return input;
- }