Project

General

Profile

Revision cbe5c67d

IDcbe5c67defd4222e00e5c0c65d41e0684724ca91
Parent 9a5cb77a
Child 35eb3496

Added by Katja Luther over 2 years ago

fix problem when reusing name for new taxon

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonNodeServiceImpl.java
83 83
    private IAgentService agentService;
84 84

  
85 85
    @Autowired
86
    private INameService nameService;
87

  
88
    @Autowired
86 89
    private ITaxonNodeFilterDao nodeFilterDao;
87 90

  
88 91
    @Autowired
......
690 693
    @Transactional
691 694
    public UpdateResult createNewTaxonNode(UUID parentNodeUuid, Taxon newTaxon, Reference ref, String microref){
692 695
        UpdateResult result = new UpdateResult();
693

  
696
        if (newTaxon.getName().getId() != 0){
697
            TaxonName name = nameService.load(newTaxon.getName().getUuid());
698
            newTaxon.setName(name);
699
        }
694 700
        UUID taxonUUID = taxonService.saveOrUpdate(newTaxon);
695 701
        newTaxon = (Taxon) taxonService.load(taxonUUID);
696 702

  
......
729 735
        }
730 736
//        child = dao.save(child);
731 737

  
732
        dao.saveOrUpdate(child);
738
//        dao.saveOrUpdate(child);
733 739
        result.addUpdatedObject(parent);
734 740
        if (child != null){
735 741
            result.setCdmEntity(child);
......
764 770
        if (monitor == null){
765 771
            monitor = DefaultProgressMonitor.NewInstance();
766 772
        }
773
        TaxonNode subTree = load(config.getSubtreeUuid());
774
        TreeIndex subTreeIndex = null;
775
        if (subTree != null){
776
            subTreeIndex = TreeIndex.NewInstance(subTree.treeIndex());
777
            Long count = dao.countChildrenOf(subTree, subTree.getClassification(), true);
778
            int intCount = count.intValue();
779
            monitor.beginTask("Update Secundum Reference", intCount);
780
        }
781

  
767 782

  
768
        monitor.beginTask("Update Secundum Reference", 100);
769 783
        if (config.getSubtreeUuid() == null){
770 784
            result.setError();
771 785
            result.addException(new NullPointerException("No subtree given"));
772 786
            monitor.done();
773 787
            return result;
774 788
        }
775
        TaxonNode subTree = load(config.getSubtreeUuid());
789

  
776 790
        if (subTree == null){
777 791
            result.setError();
778 792
            result.addException(new NullPointerException("Subtree does not exist"));
779 793
            monitor.done();
780 794
            return result;
781 795
        }
782
        TreeIndex subTreeIndex = TreeIndex.NewInstance(subTree.treeIndex());
796

  
783 797

  
784 798
        //Reference ref = config.getNewSecundum();
785 799
        if (config.isIncludeAcceptedTaxa()){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)